测试:pvp测试
This commit is contained in:
@@ -49,9 +49,73 @@ export function checkHero(heroes) {
|
||||
})
|
||||
}
|
||||
|
||||
export function addItem(pinusClient, id, count, cb) {
|
||||
export function addItem(pinusClient, id: number, count: number, cb) {
|
||||
pinusClient.request('role.heroHandler.addItem', { id, count }, res => {
|
||||
checkSuccessResponse(res);
|
||||
cb(res);
|
||||
});
|
||||
}
|
||||
|
||||
export function addItemsIfNotEnough(roleInfo, pinusClient, id: number, count: number, cb) {
|
||||
if(id == 31001) {
|
||||
if(roleInfo.coin < count) {
|
||||
return addItem(pinusClient, id, count, () => {
|
||||
roleInfo.coin += count;
|
||||
cb();
|
||||
});
|
||||
}
|
||||
} else if (id == 31002) {
|
||||
if(roleInfo.gold < count) {
|
||||
return addItem(pinusClient, id, count, () => {
|
||||
roleInfo.gold += count;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
let consumeGoods = roleInfo.consumeGoods||[];
|
||||
let cur = consumeGoods.find(cur => cur.id == id);
|
||||
if(!cur || cur.count < count) {
|
||||
return addItem(pinusClient, id, count, () => {
|
||||
if(!cur) {
|
||||
consumeGoods.push({ id, count });
|
||||
} else {
|
||||
cur.count += count;
|
||||
}
|
||||
roleInfo.consumeGoods = consumeGoods;
|
||||
});
|
||||
}
|
||||
}
|
||||
cb();
|
||||
}
|
||||
|
||||
export function checkTimeStamp(time, len, canBeZero) {
|
||||
if(canBeZero) {
|
||||
if(time == 0) return true;
|
||||
} else {
|
||||
expect(time).to.be.a('number');
|
||||
expect(time.toString().length).to.equal(len);
|
||||
}
|
||||
}
|
||||
|
||||
export function checkWarJson(heroes) {
|
||||
expect(heroes).to.be.an('array');
|
||||
heroes.forEach(hero => {
|
||||
expect(hero.actorId).to.be.a('number');
|
||||
expect(hero.skinId).to.be.a('number');
|
||||
expect(hero.actorName).to.be.a('string');
|
||||
expect(hero.dataId).to.be.a('number');
|
||||
expect(hero.relation).to.be.a('number');
|
||||
expect(hero.dirction).to.be.a('number');
|
||||
expect(hero.outIndex).to.be.a('number');
|
||||
expect(hero.x).to.be.a('number');
|
||||
expect(hero.y).to.be.a('number');
|
||||
expect(hero.var).to.be.a('number');
|
||||
expect(hero.lv).to.be.a('number');
|
||||
expect(hero.hide).to.be.a('number');
|
||||
expect(hero.initial_ai).to.be.a('number');
|
||||
expect(hero.attribute).to.be.a('string');
|
||||
expect(hero.star).to.be.a('number');
|
||||
expect(hero.skill).to.be.a('string');
|
||||
expect(hero.seid).to.be.a('string');
|
||||
expect(hero.spine).to.be.a('string');
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user