排行榜:先做一点假数据
This commit is contained in:
@@ -267,9 +267,6 @@ export class RaceActivityObject {
|
||||
this.initEvents(guildCode);
|
||||
let guild = await GuildModel.findByCode(guildCode, serverId);
|
||||
if(!guild) return false;
|
||||
let leader = <RoleType>guild.leader;
|
||||
let guildRankParam = new GuildRankParam(guild.icon, guild.name, guild.lv, leader);
|
||||
await setRank(REDIS_KEY.RACE_ACTIVITY, serverId, guild.code, 0, Math.pow(10, 11) - guild.guildCe, guildRankParam, true);
|
||||
let { name: guildName, guildCe } = guild;
|
||||
this.woodenHorses.set(guildCode, new WoodenHorse(guildCode, guildName, guildCe, serverId));
|
||||
this.guildList.push({guildCode, serverId});
|
||||
@@ -281,7 +278,7 @@ export class RaceActivityObject {
|
||||
let events = this.events.get(guildCode)||[];
|
||||
let needSendEnd = woodenHorse.calCurWoodenHorse(events);
|
||||
if(woodenHorse.status == 1 || woodenHorse.status == 2) { // 更新距离 // TODO 写进const表
|
||||
await setRankWithoutUserInfo(REDIS_KEY.RACE_ACTIVITY, serverId, guildCode, woodenHorse.distance, Math.floor((woodenHorse.time - woodenHorse.startTime)/1000), true, false);
|
||||
await setRankWithoutUserInfo(REDIS_KEY.RACE_ACTIVITY, serverId, guildCode, Math.floor(woodenHorse.distance * 1000), woodenHorse.time - woodenHorse.startTime, true, false, 6);
|
||||
if (needSendEnd) { // 抵达后发送奖励,发送消息,结算
|
||||
await sendSingleRaceActEndMsg(guildCode, woodenHorse);
|
||||
}
|
||||
@@ -462,7 +459,7 @@ export class WoodenHorse {
|
||||
* @returns {boolean} needSendEnd 是否跑到终点发送结束新号
|
||||
*/
|
||||
public calCurWoodenHorse(events: Event[]): boolean {
|
||||
console.log('**', JSON.stringify(events))
|
||||
console.log('**', this.guildName, this.status, this.distance, Date.now(), this.speed, JSON.stringify(events))
|
||||
if(this.status == 2) return false; // TODO 写进const表
|
||||
if(this.status == 0 && this.stopContinueTime && Date.now() > this.stopContinueTime) {
|
||||
this.status = 1; this.stopContinueTime = 0;
|
||||
@@ -474,7 +471,6 @@ export class WoodenHorse {
|
||||
this.status = 2;
|
||||
return true;
|
||||
}
|
||||
console.log('*********', this.distance, Date.now(), this.speed)
|
||||
|
||||
this.distance = Math.floor((this.distance + (Date.now() - this.time)/1000 * this.speed ) * 1000)/1000; // 1位小数点
|
||||
this.time = Date.now();
|
||||
@@ -511,6 +507,7 @@ export class WoodenHorse {
|
||||
for(let { id, count, endTime } of effectiveEvents) {
|
||||
this.calEvent(id, count, endTime);
|
||||
}
|
||||
console.log('**effect', this.speed, JSON.stringify(effectiveEvents));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -534,6 +531,8 @@ export class WoodenHorse {
|
||||
if (this.shieldTime < Date.now()) {
|
||||
this.stopContinueTime = endTime;
|
||||
this.status = 0; // TODO 写进const表
|
||||
this.time = endTime;
|
||||
this.speed = 0;
|
||||
}
|
||||
break;
|
||||
case RACE_EVENT.FENGCHE:
|
||||
|
||||
Reference in New Issue
Block a user