修改解锁英雄时,是否符合条件的判断标准
This commit is contained in:
parent
2390751a0f
commit
c7127b35d1
@ -93,8 +93,8 @@
|
||||
3. Response: JSON
|
||||
|
||||
|
||||
> 说明: 匹配模式可以用的英雄: (owned == true || (free == true && not expired)) && (usetype == 0 || usetype == 2)
|
||||
> 赛季排位模式可以用的英雄: (owned == true || (free == true && not expired)) && (usetype == 0 || usetype == 1)
|
||||
> 说明: 匹配模式可以用的英雄: (owned == true || (trial== true && not expired)) && (usetype == 0 || usetype == 2)
|
||||
> 赛季排位模式可以用的英雄: (owned == true || (trial== true && not expired)) && (usetype == 0 || usetype == 1)
|
||||
|
||||
|
||||
```js
|
||||
|
@ -17,23 +17,9 @@ export default class AccountController extends BaseController {
|
||||
result.cards = account.cards;
|
||||
let heros: any[] = [];
|
||||
for(let [key, hero] of account.heros) {
|
||||
heros.push({
|
||||
heroid: hero.heroid,
|
||||
owned: true,
|
||||
usetype: 0,
|
||||
level: hero.level,
|
||||
exp: hero.exp,
|
||||
free: hero.free,
|
||||
free_expire: 0
|
||||
});
|
||||
heros.push(hero.toJson());
|
||||
}
|
||||
result.heros = heros;
|
||||
// let hero = new Hero();
|
||||
// hero.free = true;
|
||||
// hero.level = 1;
|
||||
// hero.exp = 0;
|
||||
// hero.heroid = 30012;
|
||||
// account.heros.set(30012+'', hero)
|
||||
await account.save();
|
||||
result.moneys = account.moneys;
|
||||
result.normal_stat= account.normal_stat;
|
||||
|
@ -88,7 +88,7 @@ class UserClass extends FindOrCreate{
|
||||
|
||||
public async unlockHero(heroid: number) {
|
||||
if (this.heros.has(heroid + '')) {
|
||||
if (!this.heros.get(heroid + '').free) {
|
||||
if (!this.heros.get(heroid + '').trial) {
|
||||
throw new ZError(102, '你已经解锁了该英雄');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user