军团活动:诸侯混战城池状态
This commit is contained in:
@@ -76,7 +76,7 @@ export class CityActivityHandler {
|
||||
}
|
||||
|
||||
const dbCities = await GuildActivityCityModel.getAllCities(serverId);
|
||||
let cityStatus = pubGetCityStatus(guildCode, cityId, dicCity.preCity, dbCities);
|
||||
let cityStatus = pubGetCityStatus(guildCode, cityId, dicCity, dbCities);
|
||||
if(cityStatus == CITY_STATUS.DECLARED) {
|
||||
obj.pushGuild(guildCode, serverId, cityId);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export class CityActivityHandler {
|
||||
let guildScore = await getRankScore(getCityKeyName(REDIS_KEY.CITY_ACTIVITY, cityId), serverId, guildCode);
|
||||
|
||||
const dbCities = await GuildActivityCityModel.getAllCities(serverId);
|
||||
let cityStatus = pubGetCityStatus(guildCode, cityId, dicCity.preCity, dbCities);
|
||||
let cityStatus = pubGetCityStatus(guildCode, cityId, dicCity, dbCities);
|
||||
|
||||
// 前一天中位数战力
|
||||
let medianCe = await getMedianCe(serverId);
|
||||
|
||||
@@ -13,8 +13,8 @@ import { REDIS_KEY } from "../../../consts";
|
||||
import { addActive } from "../../../services/guildService";
|
||||
import { gameData } from "../../../pubUtils/data";
|
||||
import { getGuildChannelSid } from "../../../services/chatService";
|
||||
import { guildActivityStart, gateActivityEnd, cityActivityEnd } from "../../../services/timeTaskService";
|
||||
import { UserGuildModel } from "../../../db/UserGuild";
|
||||
import { GuildActivityCityModel } from "../../../db/GuildActivityCity";
|
||||
|
||||
export default function (app: Application) {
|
||||
return new GateActivityHandler(app);
|
||||
@@ -306,6 +306,25 @@ export class GateActivityHandler {
|
||||
return resResult(STATUS.GUILD_ACTIVITY_IS_OPEN)
|
||||
}
|
||||
|
||||
// !! 注意,这条函数会改变内存中的字典表,仅用于测试中使用
|
||||
let now = new Date();
|
||||
let guildServers = pinus.app.getServersByType('guild');
|
||||
for(let server of guildServers) {
|
||||
pinus.app.rpc.guild.guildActivityRemote.updateGuildActivityData.toServer(server.id, aid, true);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
// ! 测试接口
|
||||
async debugSetDay(msg: { week: number }, session: BackendSession) {
|
||||
let guildServers = pinus.app.getServersByType('guild');
|
||||
for(let server of guildServers) {
|
||||
pinus.app.rpc.guild.guildActivityRemote.setDay.toServer(server.id, msg.week);
|
||||
}
|
||||
if(msg.week <= 2) {
|
||||
await GuildActivityCityModel.deleteMany({});
|
||||
}
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
@@ -319,6 +338,13 @@ export class GateActivityHandler {
|
||||
} else if (aid == GUILD_ACTIVITY_TYPE.RACE_ACTIVITY) {
|
||||
await pinus.app.rpc.systimer.systimerRemote.raceActivityEnd.toServer('systimer-server-1');
|
||||
}
|
||||
|
||||
// !! 注意,这条函数会改变内存中的字典表,仅用于测试中使用
|
||||
let now = new Date();
|
||||
let guildServers = pinus.app.getServersByType('guild');
|
||||
for(let server of guildServers) {
|
||||
pinus.app.rpc.guild.guildActivityRemote.updateGuildActivityData.toServer(server.id, aid, false);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ export class RaceActivityHandler {
|
||||
}
|
||||
|
||||
|
||||
let guildActivityRec = await GuildActivityRecordModel.getRecord(guildCode, serverId, this.aid);
|
||||
let guildActivityRec = await GuildActivityRecordModel.getRecord(guildCode, serverId, this.aid, obj.getEvents(guildCode, 0));
|
||||
if(!guildActivityRec) return resResult(STATUS.INTERNAL_ERR);
|
||||
|
||||
let { code: sourceCode } = guildActivityRec;
|
||||
@@ -124,14 +124,24 @@ export class RaceActivityHandler {
|
||||
}
|
||||
|
||||
|
||||
// 结束挑战
|
||||
async useItem(msg: { id: number, toGuild: string }, session: BackendSession) {
|
||||
// 使用道具
|
||||
async useItem(msg: { id: number, count: number, toGuild: string }, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let guildCode = session.get('guildCode');
|
||||
let serverId = session.get('serverId');
|
||||
let sid = session.get('sid');
|
||||
|
||||
let {id, count, toGuild} = msg;
|
||||
let obj = getRaceActivityObj();
|
||||
let event = await obj.useItem(roleId, sid, guildCode, toGuild, id, count);
|
||||
if(!event) return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
await GuildActivityRecordModel.pushEvent(guildCode, event);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
timestamp: Date.now(),
|
||||
event: obj.getEvents(guildCode, 0)
|
||||
});
|
||||
}
|
||||
|
||||
// 结束挑战
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { sendAllGuildRanks, sendGuildActEndMsg, calWoodenHorseAndSend, sendRaceStartMsg } from '../../../services/guildActivityService';
|
||||
import { gameData } from '../../../pubUtils/data';
|
||||
import { setWeek } from '../../../pubUtils/timeUtil';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new GuildActivityRemote(app);
|
||||
@@ -41,4 +43,30 @@ export class GuildActivityRemote {
|
||||
async raceActivityStart(serverId: number) {
|
||||
await sendRaceStartMsg(serverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* !! 注意,这条函数会改变内存中的字典表,影响甚大,请考虑清楚后使用
|
||||
*/
|
||||
async updateGuildActivityData(aid: number, isStart: boolean) {
|
||||
let guildActivity = gameData.guildActivity;
|
||||
let cur = guildActivity.get(aid);
|
||||
|
||||
if(isStart) {
|
||||
let now = new Date();
|
||||
cur.startMinute = now.getMinutes();
|
||||
cur.startTime = now.getHours();
|
||||
} else {
|
||||
let now = new Date(Date.now() - cur.duringTime * 1000);
|
||||
cur.startMinute = now.getMinutes();
|
||||
cur.startTime = now.getHours();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* !! 注意,这条函数会改变内存时间,影响甚大,请考虑清楚后使用
|
||||
*/
|
||||
async setDay(week: number) {
|
||||
setWeek(week);
|
||||
}
|
||||
}
|
||||
@@ -549,12 +549,13 @@ export class EquipHandler {
|
||||
if (!res)
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
let result = await addItems(roleId, roleName, sid, [{ id: jewel, count: count }]);
|
||||
if (type == 1)
|
||||
return resResult(STATUS.SUCCESS, { goods: result });
|
||||
|
||||
|
||||
if (goodInfo.lvLimited >= JEWEL_PUSH_LV) {
|
||||
pushNormalItemMsg(roleId, roleName, serverId, MSG_SOURCE.JEWEL_COMPOSE, jewel, goodInfo.name);
|
||||
}
|
||||
if (type == 1)
|
||||
return resResult(STATUS.SUCCESS, { goods: result });
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import { EquipModel } from "../../../db/Equip";
|
||||
import { getPlayerMainAttribute } from "../../../services/pvpService";
|
||||
import { FRIEND } from "../../../pubUtils/dicParam";
|
||||
import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild";
|
||||
import { createPrivateMsg, pushMsgToRole } from "../../../services/chatService";
|
||||
import { createPrivateMsg, pushMsgToRole, pushPresent } from "../../../services/chatService";
|
||||
|
||||
|
||||
export default function (app: Application) {
|
||||
@@ -605,9 +605,10 @@ export class FriendHandler {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let sid: string = session.get('sid');
|
||||
let serverId: string = session.get('serverId');
|
||||
|
||||
let { roleId: hisRoleId, items } = msg;
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.FRIEND_NAME_ONLY);
|
||||
let friends = myRelation?myRelation.friends: [];
|
||||
let curFriend = friends.find(cur => cur.roleId == hisRoleId);
|
||||
if(!curFriend) return resResult(STATUS.FRIEND_NOT_FOUND);
|
||||
@@ -636,8 +637,10 @@ export class FriendHandler {
|
||||
// TODO 日志可以转到log服
|
||||
await FriendPresentLogModel.createRecord(roleId, hisRoleId, items);
|
||||
for(let {id, count} of items ) {
|
||||
const msgData = await createPrivateMsg(roleId, roleName, MSG_TYPE.RICH_TEXT, MSG_SOURCE.ROLE_SEND_TEXT, JSON.stringify({ id, count }), hisRoleId, null);
|
||||
const msgData = await createPrivateMsg(roleId, roleName, MSG_TYPE.RICH_TEXT, MSG_SOURCE.PRIVATE_SEND_GIFT, JSON.stringify({ id, count }), hisRoleId, null);
|
||||
await pushMsgToRole(msgData);
|
||||
let hisRole = <RoleType>curFriend.role;
|
||||
await pushPresent(roleId, roleName, serverId, hisRole.roleName, id);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { RoleModel } from "../db/Role";
|
||||
import { reduceCe } from "../pubUtils/util";
|
||||
import { GUILDACTIVITY } from "../pubUtils/dicParam";
|
||||
import { gameData, getGuildAuctionRewards, getCityActivityRewards } from "../pubUtils/data";
|
||||
import { getCurHourPoint, getCutDay, nowSeconds } from "../pubUtils/timeUtil";
|
||||
import { getCurHourPoint, getCurDay, nowSeconds } from "../pubUtils/timeUtil";
|
||||
import { GUILD_ACTIVITY_STATUS, GET_POINT_WAYS, GUILD_ACTIVITY_TYPE, REDIS_KEY, AUCTION_SOURCE, MAIL_TYPE, CITY_STATUS } from "../consts";
|
||||
import { Record, UserGuildActivityRecModel } from "../db/UserGuildActivityRec";
|
||||
import { GateMembersRec, GateActivityObject, CityActivityObject, CityParam, Member, RaceActivityObject, WoodenHorse } from "../domain/battleField/guildActivity";
|
||||
@@ -18,6 +18,8 @@ import { genAuction } from "./auctionService";
|
||||
import { sendMail } from "./mailService";
|
||||
import { getHonourObject } from '../pubUtils/itemUtils';
|
||||
import { GuildActivityCityType, GuildActivityCityModel } from "../db/GuildActivityCity";
|
||||
import { DicCityActivity } from "../pubUtils/dictionary/DicCityActivity";
|
||||
import { open } from "inspector";
|
||||
|
||||
let gateActivityObj: GateActivityObject;
|
||||
let cityActivityObj: CityActivityObject;
|
||||
@@ -89,7 +91,7 @@ export function getGuildActivityStatus(id: number) {
|
||||
}
|
||||
|
||||
export function getGuildActivityByDic(dicGuildActivity: DicGuildActivity) {
|
||||
|
||||
console.log('****',dicGuildActivity.startTime, dicGuildActivity.startMinute)
|
||||
let startTime = getCurHourPoint(dicGuildActivity.startTime, dicGuildActivity.startMinute);
|
||||
let countdownTime = getCurHourPoint(dicGuildActivity.countDown);
|
||||
let { duringTime, openDay } = dicGuildActivity;
|
||||
@@ -107,7 +109,7 @@ export function getGuildActivityByDic(dicGuildActivity: DicGuildActivity) {
|
||||
status = GUILD_ACTIVITY_STATUS.END;
|
||||
}
|
||||
|
||||
let day = getCutDay();
|
||||
let day = getCurDay();
|
||||
let isOpen = openDay.includes(day);
|
||||
|
||||
return {
|
||||
@@ -302,11 +304,12 @@ export async function sendGuildActEndMsg(aid: number) {
|
||||
gateActivityObj = new GateActivityObject();
|
||||
} else if (aid == GUILD_ACTIVITY_TYPE.CITY_ACTIVITY) {
|
||||
let obj = getCityActivityObj();
|
||||
let { cities, serverlists} = obj.getAllCities();
|
||||
let { cities } = obj.getAllCities();
|
||||
for(let { serverId, cityId } of cities) {
|
||||
await cityActivitySettleReward(cityId, serverId);
|
||||
}
|
||||
// 发完之后再做下周自动宣战
|
||||
let serverlists = await getAllServers();
|
||||
for(let serverId of serverlists) {
|
||||
await autoDeclare(serverId);
|
||||
}
|
||||
@@ -479,6 +482,9 @@ async function autoDeclare(serverId: number) {
|
||||
await GuildActivityCityModel.declare(serverId, dicCity.nextCity, guardGuildCode);
|
||||
}
|
||||
}
|
||||
for(let { cityId } of allCities) {
|
||||
await GuildActivityCityModel.guard(serverId, cityId, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,32 +518,35 @@ export function getCities(guildCode: string, dbCities: GuildActivityCityType[])
|
||||
param.declareCount = curCity.declareCount||0;
|
||||
}
|
||||
|
||||
param.status = getCityStatus(guildCode, cityId, dic.preCity, dbCities);
|
||||
param.status = getCityStatus(guildCode, cityId, dic, dbCities);
|
||||
cities.push(param);
|
||||
}
|
||||
return cities
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 诸侯混战 获取城池状态
|
||||
* @param guildCode
|
||||
* @param cityId
|
||||
* @param preCity
|
||||
* @param dic
|
||||
* @param dbCities
|
||||
*/
|
||||
export function getCityStatus(guildCode: string, cityId: number, preCity: number[], dbCities: GuildActivityCityType[]) {
|
||||
export function getCityStatus(guildCode: string, cityId: number, dic: DicCityActivity, dbCities: GuildActivityCityType[]) {
|
||||
let status = CITY_STATUS.NOT_OPEN;
|
||||
if(preCity && preCity.length) {
|
||||
let hasGuardCity = dbCities.find(cur => {
|
||||
return preCity.includes(cur.cityId) && cur.guardGuildCode == guildCode;
|
||||
});
|
||||
if(!!hasGuardCity) {
|
||||
status = CITY_STATUS.CAN_DECLARE;
|
||||
}
|
||||
} else {
|
||||
status = CITY_STATUS.CAN_DECLARE;
|
||||
let d = getCurDay(true);
|
||||
let { week, preCity } = dic;
|
||||
let activityStatus = getGuildActivityStatus(GUILD_ACTIVITY_TYPE.CITY_ACTIVITY);
|
||||
if(!activityStatus) {
|
||||
return CITY_STATUS.NOT_OPEN
|
||||
}
|
||||
|
||||
let dicGuildActivity = gameData.guildActivity.get(GUILD_ACTIVITY_TYPE.CITY_ACTIVITY);
|
||||
let { openDay } = dicGuildActivity;
|
||||
let curIndex = openDay.indexOf(week[0]);
|
||||
let startDay = openDay[curIndex - 1]||0;
|
||||
let endDay = openDay[openDay.length - 1]||0;
|
||||
if(d >= startDay && d <= endDay) status = CITY_STATUS.CAN_DECLARE;
|
||||
|
||||
let curCity = dbCities.find(cur => cur.cityId == cityId);
|
||||
if(curCity) {
|
||||
if(curCity.guardGuildCode == guildCode) {
|
||||
@@ -546,6 +555,18 @@ export function getCityStatus(guildCode: string, cityId: number, preCity: number
|
||||
status = CITY_STATUS.DECLARED;
|
||||
}
|
||||
}
|
||||
let hasGuard = false, hasDeclared = false;
|
||||
for(let { cityId: _cityId, guardGuildCode, declareGuilds } of dbCities) {
|
||||
let dicCity = gameData.cityActivity.get(_cityId);
|
||||
if(dicCity.type == dic.type) {
|
||||
if(guardGuildCode == guildCode) hasGuard = true;
|
||||
if(declareGuilds.includes(guildCode)) hasDeclared = true;
|
||||
}
|
||||
}
|
||||
if(status == CITY_STATUS.CAN_DECLARE && !hasDeclared && preCity.length > 0) {
|
||||
status = CITY_STATUS.NOT_OPEN;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,13 @@ export async function pushHeroWakeUp(roleId: string, roleName: string, serverId:
|
||||
await pushNormalHeroInfoBySource(roleId, roleName, serverId, MSG_SOURCE.HERO_WAKEUP, heroInfo);
|
||||
}
|
||||
|
||||
|
||||
export async function pushPresent(roleId: string, roleName: string, serverId: number | string, toRoleName: string, id: number) {
|
||||
const content = JSON.stringify({ roleId, roleName, toRoleName, id });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.GROUP_SEND_GIFT, content, null, null);
|
||||
await pushGroupMsgToRoom(msgData);
|
||||
}
|
||||
|
||||
export async function pushComBtlTeamMsg(teamCode: string, roleId: string, roleName: string, type: number, source: number, content: string, targetRoleId: string, targetMsgCode: string) {
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.TEAM, teamCode, type, source, content, targetRoleId, targetMsgCode);
|
||||
if (!msgData) return null;
|
||||
|
||||
@@ -410,7 +410,8 @@ export enum POPULATE_TYPE {
|
||||
NOT = 0,
|
||||
FRIEND = 1,
|
||||
BLACKLIST = 2,
|
||||
FRIENDSHIP = 3
|
||||
FRIENDSHIP = 3,
|
||||
FRIEND_NAME_ONLY = 4
|
||||
}
|
||||
|
||||
export enum BLOCK_OPEATE {
|
||||
|
||||
@@ -54,6 +54,9 @@ export default class FriendRelation extends BaseModel {
|
||||
.populate('blacklist.role', ROLE_SELECT.SHOW_SIMPLE, 'Role')
|
||||
} else if (populateType == POPULATE_TYPE.FRIENDSHIP) {
|
||||
document.populate('friends.friendShip', null, 'FriendShip');
|
||||
} else if (populateType == POPULATE_TYPE.FRIEND_NAME_ONLY) {
|
||||
document
|
||||
.populate('friends.role', 'roleName', 'Role')
|
||||
}
|
||||
|
||||
let result: FriendRelationType = await document.lean({ getters: true, virtuals: true });;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
|
||||
import { ItemReward } from '../domain/dbGeneral';
|
||||
import { getTodayZeroDate } from '../pubUtils/timeUtil';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { Member, WoodenHorse } from '../domain/battleField/guildActivity'
|
||||
import { Member, WoodenHorse, Event } from '../domain/battleField/guildActivity'
|
||||
|
||||
|
||||
@index({ code: 1 })
|
||||
@@ -56,13 +56,18 @@ export default class GuildActivityRecord extends BaseModel {
|
||||
|
||||
@prop({ required: true, _id: false })
|
||||
woodenHorse: WoodenHorse; // 粮草先行木马
|
||||
|
||||
@prop({ required: true, type: () => Event, _id: false })
|
||||
events: Event[]; // 粮草先行木马
|
||||
|
||||
|
||||
// 每天一条记录
|
||||
public static async getRecord(guildCode: string, serverId: number, aid: number) {
|
||||
public static async getRecord(guildCode: string, serverId: number, aid: number, events?: Event[]) {
|
||||
let today = getTodayZeroDate();
|
||||
let docs = new GuildActivityRecordModel();
|
||||
let code = genCode(10);
|
||||
let update = Object.assign(docs, { code, guildCode, serverId, aid, createdAt: new Date() })
|
||||
let update = Object.assign(docs, { code, guildCode, serverId, aid, createdAt: new Date() });
|
||||
if(events) update = Object.assign(update, { events });
|
||||
let rec: GuildActivityRecordType = await GuildActivityRecordModel.findOneAndUpdate(
|
||||
{ guildCode, createdAt: { $gte: today }},
|
||||
{ $setOnInsert: update },
|
||||
@@ -79,6 +84,16 @@ export default class GuildActivityRecord extends BaseModel {
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
||||
public static async pushEvent(guildCode: string, event: Event) {
|
||||
let today = getTodayZeroDate();
|
||||
|
||||
let rec: GuildActivityRecordType = await GuildActivityRecordModel.findOneAndUpdate(
|
||||
{ guildCode, createdAt: { $gte: today } },
|
||||
{ $push: { events: event } }, { new: true }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async findBySourceCode(guildCode: string, sourceType: number, sourceCode: string) {
|
||||
const rec = await GuildActivityRecordModel.findOne({ guildCode, auctionType: sourceType, code: sourceCode }).select('members').lean();
|
||||
return rec;
|
||||
|
||||
@@ -278,7 +278,7 @@ export class RaceActivityObject {
|
||||
|
||||
public async useItem(fromRoleId: string, sid: string, fromGuild: string, toGuild: string, id: number, count: number) {
|
||||
let rec = this.handleItem(fromRoleId, sid, id, count);
|
||||
if(!rec) return rec;
|
||||
if(!rec) return false;
|
||||
let event = new Event(id, fromGuild, toGuild, count);
|
||||
if(!this.events.has(toGuild)) {
|
||||
this.events.set(toGuild, [event]);
|
||||
@@ -287,6 +287,8 @@ export class RaceActivityObject {
|
||||
}
|
||||
let chatSid = await getGuildChannelSid(toGuild);
|
||||
pinus.app.rpc.chat.guildRemote.sendRaceEvent.toServer(chatSid, toGuild, [event]);
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
// 定时任务到,开始比赛,设置开始赛道,发放初始道具
|
||||
@@ -546,13 +548,21 @@ export class WoodenHorse {
|
||||
}
|
||||
|
||||
export class Event {
|
||||
@prop({required: true})
|
||||
id: number;
|
||||
@prop({required: true})
|
||||
fromGuild: string;
|
||||
@prop({required: true})
|
||||
toGuild: string;
|
||||
@prop({required: true})
|
||||
startTime?: number;
|
||||
@prop({required: true})
|
||||
startDistance?: number;
|
||||
@prop({required: true})
|
||||
endTime?: number;
|
||||
@prop({required: true})
|
||||
endDistance?: number;
|
||||
@prop({required: true})
|
||||
count: number = 1;
|
||||
|
||||
constructor(id: number, fromGuild: string, toGuild: string, distance?: number, count?: number) {
|
||||
|
||||
@@ -61,7 +61,7 @@ import { Attribute } from "../domain/roleField/attribute";
|
||||
import { dicGuildActivity, DicGuildActivity } from './dictionary/DicGuildActivity';
|
||||
import { dicGateActivityPoint } from './dictionary/DicGateActivityPoint';
|
||||
import { dicGuildAuction } from './dictionary/DicGuildAuction';
|
||||
import { getCutDay } from "./timeUtil";
|
||||
import { getCurDay } from "./timeUtil";
|
||||
import { dicCityActivity } from "./dictionary/DicCityActivity";
|
||||
import { dicChatAccuse } from "./dictionary/DicChatAccuse";
|
||||
import { dicCityActivityReward } from "./dictionary/DicCityActivityReward";
|
||||
@@ -463,7 +463,7 @@ export function getDicFriendByLv(lv: number) {
|
||||
* @description 获取今天开启的活动的配置
|
||||
*/
|
||||
export function getTodayGuildActivity() {
|
||||
let today = getCutDay();
|
||||
let today = getCurDay();
|
||||
let dic: DicGuildActivity;
|
||||
for(let [_id, dicGuildActivity] of gameData.guildActivity) {
|
||||
if(dicGuildActivity.openDay.includes(today)) {
|
||||
|
||||
@@ -18,6 +18,8 @@ export interface DicCityActivity {
|
||||
readonly warid: number;
|
||||
// 城门血条
|
||||
readonly hp: number;
|
||||
// 可开启星期
|
||||
readonly week: number[];
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_CITY_ACTIVITY);
|
||||
@@ -27,6 +29,7 @@ export const dicCityActivity = new Map<number, DicCityActivity>();
|
||||
|
||||
arr.forEach(o => {
|
||||
o.preCity = parseNumberList(o.preCity);
|
||||
o.week = parseNumberList(o.week);
|
||||
dicCityActivity.set( o.id, o );
|
||||
});
|
||||
arr = undefined;
|
||||
@@ -11,9 +11,9 @@ export interface DicGuildActivity {
|
||||
// 持续时间 秒
|
||||
readonly duringTime: number;
|
||||
// 开启时间 几点
|
||||
readonly startTime: number;
|
||||
startTime: number;
|
||||
// 开启时间 几点
|
||||
readonly startMinute: number;
|
||||
startMinute: number;
|
||||
// 开始倒计时 几点
|
||||
readonly countDown: number;
|
||||
// 对应关卡id
|
||||
|
||||
@@ -180,9 +180,22 @@ export function getNextTime(date: Date, h: number, m = 0, s = 0, ms = 0): Date {
|
||||
* @param needHandle 是否处理周日
|
||||
* @param {Date} time
|
||||
*/
|
||||
export function getCutDay( needHandle = false, time?: Date) {
|
||||
|
||||
let week = undefined;
|
||||
|
||||
export function getCurDay( needHandle = false, time?: Date) {
|
||||
if(!time) time = new Date();
|
||||
let d = time.getDay();
|
||||
if(needHandle && d == 0) d = 7;
|
||||
|
||||
if(week != undefined) {
|
||||
d = week;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
export function setWeek(d?: number) {
|
||||
week = d;
|
||||
if(d == 7) week = 0;
|
||||
}
|
||||
@@ -7,7 +7,8 @@
|
||||
"preCity": 0,
|
||||
"difficult": 90,
|
||||
"warid": 7002,
|
||||
"hp": 20000
|
||||
"hp": 20000,
|
||||
"week": "2&4&6"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -17,7 +18,8 @@
|
||||
"preCity": 0,
|
||||
"difficult": 90,
|
||||
"warid": 7002,
|
||||
"hp": 20000
|
||||
"hp": 20000,
|
||||
"week": "2&4&6"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -27,7 +29,8 @@
|
||||
"preCity": 0,
|
||||
"difficult": 90,
|
||||
"warid": 7002,
|
||||
"hp": 20000
|
||||
"hp": 20000,
|
||||
"week": "2&4&6"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
@@ -37,7 +40,8 @@
|
||||
"preCity": 0,
|
||||
"difficult": 90,
|
||||
"warid": 7002,
|
||||
"hp": 20000
|
||||
"hp": 20000,
|
||||
"week": "2&4&6"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
@@ -47,7 +51,8 @@
|
||||
"preCity": 0,
|
||||
"difficult": 90,
|
||||
"warid": 7002,
|
||||
"hp": 20000
|
||||
"hp": 20000,
|
||||
"week": "2&4&6"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
@@ -57,7 +62,8 @@
|
||||
"preCity": 0,
|
||||
"difficult": 90,
|
||||
"warid": 7002,
|
||||
"hp": 20000
|
||||
"hp": 20000,
|
||||
"week": "2&4&6"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
@@ -67,7 +73,8 @@
|
||||
"preCity": "1&2",
|
||||
"difficult": 100,
|
||||
"warid": 7003,
|
||||
"hp": 30000
|
||||
"hp": 30000,
|
||||
"week": "4&6"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
@@ -77,7 +84,8 @@
|
||||
"preCity": "3&4",
|
||||
"difficult": 100,
|
||||
"warid": 7003,
|
||||
"hp": 30000
|
||||
"hp": 30000,
|
||||
"week": "4&6"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
@@ -87,7 +95,8 @@
|
||||
"preCity": "5&6",
|
||||
"difficult": 100,
|
||||
"warid": 7003,
|
||||
"hp": 50000
|
||||
"hp": 50000,
|
||||
"week": "4&6"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
@@ -97,6 +106,7 @@
|
||||
"preCity": "7&8&9",
|
||||
"difficult": 110,
|
||||
"warid": 7004,
|
||||
"hp": 50000
|
||||
"hp": 50000,
|
||||
"week": "6&"
|
||||
}
|
||||
]
|
||||
@@ -4,8 +4,8 @@
|
||||
"name": "蛮夷入侵",
|
||||
"openDay": "3&0",
|
||||
"duringTime": 900,
|
||||
"startTime": 20,
|
||||
"startMinute": 0,
|
||||
"startTime": 14,
|
||||
"startMinute": 48,
|
||||
"countDown": 5,
|
||||
"warid": 7001,
|
||||
"honour": 500
|
||||
|
||||
Reference in New Issue
Block a user