diff --git a/game-server/app/servers/guild/handler/gateActivityHandler.ts b/game-server/app/servers/guild/handler/gateActivityHandler.ts index f9c0b19ba..9d2f3250c 100644 --- a/game-server/app/servers/guild/handler/gateActivityHandler.ts +++ b/game-server/app/servers/guild/handler/gateActivityHandler.ts @@ -145,7 +145,7 @@ export class GateActivityHandler { let guildScore = await setRank(REDIS_KEY.GATE_ACTIVITY, serverId, guild.code, score, Date.now(), params, true); // 更新数据库 - let rec = await UserGuildActivityRecModel.pushRecord(code, newRecords); + let rec = await UserGuildActivityRecModel.pushRecord(code, newRecords, round); return resResult(STATUS.SUCCESS, { code: rec.code, @@ -212,10 +212,9 @@ export class GateActivityHandler { if(!myGuildActivityRec) return resResult(STATUS.INTERNAL_ERR); // 功劳簿计算 - let { record } = myGuildActivityRec; - let round = 0, enemyCnt = 0, littleBossCnt = 0, bossCnt = 0; + let { record, round } = myGuildActivityRec; + let enemyCnt = 0, littleBossCnt = 0, bossCnt = 0; for(let { enemyType, round: r } of record) { - if(r > round) round = r; if(enemyType == ENEMIES_TYPE.ENEMY || enemyType == ENEMIES_TYPE.ELITE_ENEMY ) { enemyCnt ++; } else if (enemyType == ENEMIES_TYPE.LITTLE_BOSS) { diff --git a/game-server/app/services/guildActivityService.ts b/game-server/app/services/guildActivityService.ts index 18d708d72..a94b75335 100644 --- a/game-server/app/services/guildActivityService.ts +++ b/game-server/app/services/guildActivityService.ts @@ -136,7 +136,7 @@ export function getRecordScore(aid: number, round: number, record: { round: numb } } - for(let i = curRound; i <= round; i++) { + for(let i = curRound + 1; i <= round; i++) { sum += gameData.gateActivityPoint.get(GET_POINT_WAYS.ROUND_START); memberRecord.round = i; console.log('********', sum, i); @@ -180,7 +180,7 @@ export async function getGuildActivityRank(guildKey: string, memberKey: string, myGuildRank = new SimpleGuildRankParam(rank, code, name, num); } else { let guild = await GuildModel.findByCode(guildCode, serverId, 'name'); - myGuildRank = new SimpleGuildRankParam(0, guildCode, guild.name, 0); + myGuildRank = new SimpleGuildRankParam(0, guildCode, guild?.name, 0); } let memberRankResult = await getRank(memberKey, serverId, roleId); diff --git a/shared/db/UserGuildActivityRec.ts b/shared/db/UserGuildActivityRec.ts index 91ca79033..f95ac8497 100644 --- a/shared/db/UserGuildActivityRec.ts +++ b/shared/db/UserGuildActivityRec.ts @@ -75,6 +75,8 @@ export default class UserGuildActivityRec extends BaseModel { // 南蛮入侵字段 @prop({ required: true, type: Record, _id: false }) record: Record[]; // 个人总军功 + @prop({ required: true }) + round: number; // 回合数 // 诸侯混战字段 @prop({ required: true, default: 0 }) @@ -113,10 +115,10 @@ export default class UserGuildActivityRec extends BaseModel { return rec; } - public static async pushRecord(code: string, records: Record[]) { + public static async pushRecord(code: string, records: Record[], round: number) { let rec: UserGuildActivityRecType = await UserGuildActivityRecModel.findOneAndUpdate( { code }, - { $push: { record: { $each: records } } }, + { $push: { record: { $each: records } }, $set: { round } }, { new: true } ).lean(); return rec; diff --git a/shared/domain/battleField/guildActivity.ts b/shared/domain/battleField/guildActivity.ts index f996eba2e..8531d206d 100644 --- a/shared/domain/battleField/guildActivity.ts +++ b/shared/domain/battleField/guildActivity.ts @@ -202,18 +202,60 @@ export class CityActivityObject { } } +class WoodenHorseMember { + roleId: string; + roleName: string; +} + // 木牛流马 export class WoodenHorse { guildCode: string; // 军团code 木马的唯一标识 guildName: string; // 军团名 - guildCe: number; // 军团速度 + guildCe: number; // 军团战力 speed: number; // 速度 durability: number; // 耐久度 distance: number; // 距离 time: number; // 到达时间 - memberCnt: number; // + memberCnt: number; // 成员人数 + members: WoodenHorseMember[]; // 成员 + + constructor(guildCode: string, guildName: string, guildCe: number) { + this.guildCode = guildCode; + this.guildName = guildName; + this.guildCe = guildCe; + } + + calSpeed(events: Event[]) { + let speed = this.speed; + for(let event of events) { + + } + return speed; + } + + getWoodenHorse(events: Event[]) { + let newObj = new WoodenHorse(this.guildCode, this.guildName, this.guildCe); + newObj.speed = this.calSpeed(events); + newObj.durability = this.durability; + newObj.distance = this.distance; + newObj.time = this.time; + newObj.memberCnt = this.memberCnt; + newObj.members = this.members; + return newObj; + } + } +export class Event { + id: number; + timestamp: number; + fromGuild: string; + toGuild: string; + startDistance: number; + effect: number[]; + endTimestamp?: number; + endDistance?: number; +} export interface GuildGateRankParam { guildRank: SimpleGuildRankParam[], diff --git a/shared/resource/warJsons/7001.json b/shared/resource/warJsons/7001.json index ac29ce9c0..678b9cc1d 100644 --- a/shared/resource/warJsons/7001.json +++ b/shared/resource/warJsons/7001.json @@ -7,15 +7,15 @@ "relation": 0, "outIndex": 0, "dirction": 2, - "x": 6, - "y": 5, - "var": 0, - "lv": 0, + "x": 10, + "y": 11, + "var": 501, + "lv": 30, "hide": 0, "initial_ai": 1, "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -26,19 +26,19 @@ "warId": 7001, "actorName": "我军", "actorId": 0, - "dataId": 1, + "dataId": 0, "relation": 0, "outIndex": 1, "dirction": 2, - "x": 8, - "y": 5, - "var": 1, - "lv": 0, + "x": 11, + "y": 11, + "var": 502, + "lv": 30, "hide": 0, "initial_ai": 1, "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -49,19 +49,19 @@ "warId": 7001, "actorName": "我军", "actorId": 0, - "dataId": 2, + "dataId": 0, "relation": 0, "outIndex": 2, "dirction": 2, - "x": 10, - "y": 5, - "var": 2, - "lv": 0, + "x": 12, + "y": 11, + "var": 503, + "lv": 30, "hide": 0, "initial_ai": 1, "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -72,19 +72,19 @@ "warId": 7001, "actorName": "我军", "actorId": 0, - "dataId": 3, + "dataId": 0, "relation": 0, "outIndex": 3, - "dirction": 2, - "x": 12, - "y": 5, - "var": 3, - "lv": 0, + "dirction": 1, + "x": 10, + "y": 10, + "var": 504, + "lv": 30, "hide": 0, "initial_ai": 1, "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -95,19 +95,19 @@ "warId": 7001, "actorName": "我军", "actorId": 0, - "dataId": 4, + "dataId": 0, "relation": 0, "outIndex": 4, - "dirction": 2, - "x": 14, - "y": 5, - "var": 4, - "lv": 0, + "dirction": 1, + "x": 11, + "y": 10, + "var": 505, + "lv": 30, "hide": 0, "initial_ai": 1, "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -118,19 +118,19 @@ "warId": 7001, "actorName": "我军", "actorId": 0, - "dataId": 5, + "dataId": 0, "relation": 0, "outIndex": 5, - "dirction": 2, - "x": 9, - "y": 5, - "var": 5, - "lv": 0, + "dirction": 1, + "x": 12, + "y": 10, + "var": 506, + "lv": 30, "hide": 0, "initial_ai": 1, "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -139,21 +139,21 @@ }, { "warId": 7001, - "actorName": "城门", - "actorId": 1083, + "actorName": "门", + "actorId": 1047, "dataId": 1001, "relation": 1, - "outIndex": 6, - "dirction": 2, - "x": 10, - "y": 4, + "outIndex": 0, + "dirction": 1, + "x": 11, + "y": 12, "var": 1001, - "lv": 0, + "lv": 1, "hide": 0, "initial_ai": 2, - "attribute": "1&10000", + "attribute": "&", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -167,16 +167,16 @@ "dataId": 2001, "relation": 2, "outIndex": 0, - "dirction": 1, - "x": 8, - "y": 9, - "var": 2001, - "lv": 0, + "dirction": 2, + "x": 3, + "y": 10, + "var": 1501, + "lv": 30, "hide": 0, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -185,44 +185,44 @@ }, { "warId": 7001, - "actorName": "步兵", - "actorId": 1001, + "actorName": "曹仁", + "actorId": 311, "dataId": 2002, "relation": 2, "outIndex": 1, - "dirction": 1, - "x": 9, - "y": 9, - "var": 2002, - "lv": 0, + "dirction": 2, + "x": 2, + "y": 8, + "var": 1502, + "lv": 35, "hide": 0, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, - "bossStage": 0, - "enemyType": 2, + "bossStage": 1, + "enemyType": 3, "dest_oppo": 1001 }, { "warId": 7001, - "actorName": "步兵", - "actorId": 1001, + "actorName": "弓兵", + "actorId": 1004, "dataId": 2003, "relation": 2, "outIndex": 2, "dirction": 1, - "x": 10, - "y": 9, - "var": 2003, - "lv": 0, + "x": 20, + "y": 8, + "var": 1503, + "lv": 30, "hide": 0, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -231,21 +231,21 @@ }, { "warId": 7001, - "actorName": "枪兵", - "actorId": 1002, + "actorName": "步兵", + "actorId": 1001, "dataId": 2004, "relation": 2, "outIndex": 3, - "dirction": 1, - "x": 11, - "y": 9, - "var": 2004, - "lv": 0, + "dirction": 2, + "x": 3, + "y": 7, + "var": 1504, + "lv": 30, "hide": 0, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -254,21 +254,90 @@ }, { "warId": 7001, - "actorName": "枪兵", - "actorId": 1002, + "actorName": "弓兵", + "actorId": 1004, "dataId": 2005, "relation": 2, "outIndex": 4, "dirction": 1, - "x": 9, - "y": 10, - "var": 2005, - "lv": 0, + "x": 19, + "y": 6, + "var": 1505, + "lv": 30, "hide": 0, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "&", + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 2, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "许褚", + "actorId": 315, + "dataId": 2006, + "relation": 2, + "outIndex": 5, + "dirction": 1, + "x": 20, + "y": 6, + "var": 1506, + "lv": 30, + "hide": 0, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 1, + "enemyType": 3, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "李典", + "actorId": 312, + "dataId": 2007, + "relation": 2, + "outIndex": 6, + "dirction": 2, + "x": 10, + "y": 4, + "var": 1507, + "lv": 35, + "hide": 0, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 1, + "enemyType": 3, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "枪兵", + "actorId": 1002, + "dataId": 2008, + "relation": 2, + "outIndex": 7, + "dirction": 2, + "x": 12, + "y": 4, + "var": 1508, + "lv": 30, + "hide": 0, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -279,19 +348,19 @@ "warId": 7001, "actorName": "枪兵", "actorId": 1002, - "dataId": 2006, + "dataId": 2009, "relation": 2, - "outIndex": 5, - "dirction": 1, - "x": 10, - "y": 10, - "var": 2006, - "lv": 0, + "outIndex": 8, + "dirction": 2, + "x": 11, + "y": 3, + "var": 1509, + "lv": 30, "hide": 0, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "&", + "seid": 0, "star": 0, "spine": 0, "bossStage": 0, @@ -301,47 +370,208 @@ { "warId": 7001, "actorName": "狼", - "actorId": 1014, - "dataId": 2007, + "actorId": 1004, + "dataId": 2010, "relation": 2, - "outIndex": 6, + "outIndex": 9, "dirction": 1, "x": 10, - "y": 11, - "var": 2007, - "lv": 0, + "y": 2, + "var": 1510, + "lv": 30, "hide": 1, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "8001&", + "seid": 0, "star": 0, "spine": 0, - "bossStage": 1, - "enemyType": 3, + "bossStage": 0, + "enemyType": 2, "dest_oppo": 1001 }, { "warId": 7001, "actorName": "怒狼王", - "actorId": 1035, - "dataId": 2008, + "actorId": 1004, + "dataId": 2011, "relation": 2, - "outIndex": 7, + "outIndex": 10, "dirction": 1, "x": 11, - "y": 11, - "var": 2008, - "lv": 0, + "y": 2, + "var": 1511, + "lv": 30, "hide": 1, "initial_ai": 4, "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", "skill": 0, - "seid": "8001&", + "seid": 0, "star": 0, "spine": 0, - "bossStage": 1, + "bossStage": 0, "enemyType": 4, "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "狼", + "actorId": 1004, + "dataId": 2012, + "relation": 2, + "outIndex": 11, + "dirction": 1, + "x": 12, + "y": 2, + "var": 1512, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 2, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "枪兵", + "actorId": 1002, + "dataId": 2001, + "relation": 2, + "outIndex": 0, + "dirction": 1, + "x": 20, + "y": 9, + "var": 1513, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 6, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "武道家", + "actorId": 1005, + "dataId": 2002, + "relation": 2, + "outIndex": 1, + "dirction": 2, + "x": 2, + "y": 8, + "var": 1514, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 6, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "枪兵", + "actorId": 1002, + "dataId": 2003, + "relation": 2, + "outIndex": 2, + "dirction": 1, + "x": 21, + "y": 8, + "var": 1515, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 6, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "武道家", + "actorId": 1005, + "dataId": 2004, + "relation": 2, + "outIndex": 3, + "dirction": 2, + "x": 2, + "y": 7, + "var": 1516, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 6, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "骑兵", + "actorId": 1003, + "dataId": 2005, + "relation": 2, + "outIndex": 4, + "dirction": 1, + "x": 10, + "y": 2, + "var": 1517, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 6, + "dest_oppo": 1001 + }, + { + "warId": 7001, + "actorName": "骑兵", + "actorId": 1003, + "dataId": 2006, + "relation": 2, + "outIndex": 5, + "dirction": 1, + "x": 11, + "y": 2, + "var": 1518, + "lv": 30, + "hide": 1, + "initial_ai": 4, + "attribute": "1&1400|2&1000|4&600|5&600|9&0|10&25000|11&20000|12&0|13&10000|14&10000|18&0", + "skill": 0, + "seid": 0, + "star": 0, + "spine": 0, + "bossStage": 0, + "enemyType": 6, + "dest_oppo": 1001 } ] \ No newline at end of file