军团活动:诸侯混战初始

This commit is contained in:
luying
2021-03-22 16:51:17 +08:00
parent d733210c3a
commit a56a6cf2f3
12 changed files with 201 additions and 34 deletions

View File

@@ -165,3 +165,11 @@ export enum ENEMIES_TYPE {
LITTLE_BOSS = 3, // 小boss
BOSS = 4, // 大boss
}
// 城池对于我的军团的状态
export enum CITY_STATUS {
NOT_OPEN = 0, // 未开放
CAN_DECLARE = 1, // 可宣战
DECLARED = 2, // 已宣战
GUARD = 3 // 已占领
}

View File

@@ -232,8 +232,8 @@ export const REDIS_KEY = {
DB_GAME: 'db_game', // 服务器列表
ONLINE_USERS: 'onlineUsers', // 在线用户情况
CHANNEL_SERVERS: 'chat:channelServers', // 渠道对应的 chat 服务器 Id,
USER_GUILD_ACTIVITY: 'usrGuildAct',
GUILD_ACTIVITY: 'guildAct',
USER_GATE_ACTIVITY: 'usrGateAct',
GATE_ACTIVITY: 'gateAct',
}
// 各排行榜对应hash的key
@@ -241,8 +241,8 @@ export const REDIS_RANK_TO_INFO = new Map([
[REDIS_KEY.TOWER_RANK, REDIS_KEY.USER_INFO],
[REDIS_KEY.PVP_RANK, REDIS_KEY.USER_INFO],
[REDIS_KEY.GUILD_ACTIVE_RANK, REDIS_KEY.GUILD_INFO],
[REDIS_KEY.GUILD_ACTIVITY, REDIS_KEY.GUILD_INFO],
[REDIS_KEY.USER_GUILD_ACTIVITY, REDIS_KEY.USER_INFO]
[REDIS_KEY.GATE_ACTIVITY, REDIS_KEY.GUILD_INFO],
[REDIS_KEY.USER_GATE_ACTIVITY, REDIS_KEY.USER_INFO]
]);
export const FUNC_OPT_TYPE = {

View File

@@ -15,7 +15,7 @@ export default class GuildActivityCity extends BaseModel {
declareGuilds: string[]; // 宣战的公会的code
@prop({ required: true, default: 0 })
declareCnt: number; // 宣战数量
declareCount: number; // 宣战数量
@prop({ required: true })
guardGuildCode: string; // 占领的军团的code
@@ -24,12 +24,20 @@ export default class GuildActivityCity extends BaseModel {
guardGuildName: string; // 占领的军团名
// 每天宣战一次
public static async getAllCities(serverId: number) {
let today = getTodayZeroDate();
let rec: GuildActivityCityType[] = await GuildActivityCityModel.find({ serverId, createdAt: { $gte: today }}).lean();
return rec;
}
// 每天宣战一次
public static async declare(serverId: number, cityId: number, guildCode: string) {
let today = getTodayZeroDate();
let rec: GuildActivityCityType = await GuildActivityCityModel.findOneAndUpdate(
{ serverId, cityId, createdAt: { $gte: today }, declareGuilds: { $nin: [guildCode] }},
{ $setOnInsert: { cityId }, $push: { declareGuilds: guildCode }, $inc: {declareCnt: 1 } },
{ $setOnInsert: { cityId }, $push: { declareGuilds: guildCode }, $inc: {declareCount: 1 } },
{new: true, upsert: true}).lean();
return rec;

View File

@@ -1,6 +1,7 @@
import { GUILDACTIVITY } from "../../pubUtils/dicParam";
import { SimpleGuildRankParam, SimpleRoleRankParam } from '../rank'
import { prop } from "@typegoose/typegoose";
import { CITY_STATUS } from "../../consts";
export class GateMembersRec {
roleId: string;
@@ -100,4 +101,16 @@ export class Member {
roleId: string; // 玩家id
@prop({required: true})
job: number; // 在军团的职位
}
}
export class CityParam {
cityId: number = 0; // 城池id
guardGuildCode: string = ''; // 占领军团id
guardGuildName: string = ''; // 占领军团名
declareCount: number = 0; // 宣战数
status: number = CITY_STATUS.NOT_OPEN; // 城池对于我军状态
constructor(cityId: number) {
this.cityId = cityId;
}
}

View File

@@ -90,4 +90,29 @@ export class SimpleRoleRankParam {
this.roleName = roleName;
this.num = num;
}
}
export class KeyName {
key: string;
serverId?: number;
guildCode?: string;
constructor(key: string) {
this.key = key;
}
getName() {
let res = this.key;
if(this.serverId) res += `:${this.serverId}`;
if(this.guildCode) res += `:${this.guildCode}`;
return res;
}
getNameWithPlus(...plus: string[]) {
let res = this.getName();
for(let p of plus) {
res += `:${p}`;
}
return res;
}
}

View File

@@ -62,6 +62,7 @@ import { dicGuildActivity, DicGuildActivity } from './dictionary/DicGuildActivit
import { dicGateActivityPoint } from './dictionary/DicGateActivityPoint';
import { dicGuildAuction } from './dictionary/DicGuildAuction';
import { getCutDay } from "./timeUtil";
import { dicCityActivity } from "./dictionary/DicCityActivity";
export const gameData = {
blurprtCompose: dicBlueprtCompose,
@@ -146,7 +147,8 @@ export const gameData = {
figureCondition: figureCondition,
guildActivity: dicGuildActivity,
gateActivityPoint: dicGateActivityPoint,
guildAuction: dicGuildAuction
guildAuction: dicGuildAuction,
cityActivity: dicCityActivity
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据

View File

@@ -10,6 +10,8 @@ export interface DicCityActivity {
readonly type: number;
// 下一次自动宣战城池
readonly nextCity: number;
// 上一个可解锁的
readonly preCity: number[];
// 难度系数
readonly difficult: number;
// 相应的出兵表
@@ -24,6 +26,7 @@ let arr = JSON.parse(str);
export const dicCityActivity = new Map<number, DicCityActivity>();
arr.forEach(o => {
o.preCity = parseNumberList(o.preCity);
dicCityActivity.set( o.id, o );
});
arr = undefined;

View File

@@ -3,6 +3,7 @@
"id": 1,
"name": "汉中",
"type": 1,
"preCity": 0,
"nextCity": 7,
"difficult": 90,
"warid": 7002,
@@ -12,6 +13,7 @@
"id": 2,
"name": "南中",
"type": 1,
"preCity": 0,
"nextCity": 7,
"difficult": 90,
"warid": 7002,
@@ -21,6 +23,7 @@
"id": 3,
"name": "柴桑",
"type": 1,
"preCity": 0,
"nextCity": 8,
"difficult": 90,
"warid": 7002,
@@ -30,6 +33,7 @@
"id": 4,
"name": "会稽",
"type": 1,
"preCity": 0,
"nextCity": 8,
"difficult": 90,
"warid": 7002,
@@ -39,6 +43,7 @@
"id": 5,
"name": "太原",
"type": 1,
"preCity": 0,
"nextCity": 9,
"difficult": 90,
"warid": 7002,
@@ -48,6 +53,7 @@
"id": 6,
"name": "巨鹿",
"type": 1,
"preCity": 0,
"nextCity": 9,
"difficult": 90,
"warid": 7002,
@@ -57,6 +63,7 @@
"id": 7,
"name": "成都",
"type": 2,
"preCity": "1&2",
"nextCity": 10,
"difficult": 100,
"warid": 7002,
@@ -66,6 +73,7 @@
"id": 8,
"name": "建业",
"type": 2,
"preCity": "3&4",
"nextCity": 10,
"difficult": 100,
"warid": 7002,
@@ -75,6 +83,7 @@
"id": 9,
"name": "邺城",
"type": 2,
"preCity": "5&6",
"nextCity": 10,
"difficult": 100,
"warid": 7002,
@@ -84,6 +93,7 @@
"id": 10,
"name": "洛阳",
"type": 3,
"preCity": "7&8&9",
"nextCity": 0,
"difficult": 110,
"warid": 7002,