军团优化:拍卖行基础奖励
This commit is contained in:
@@ -4,11 +4,11 @@ import { GuildModel } from '../../../db/Guild';
|
||||
import { WishPoolReportModel } from '../../../db/WishPoolReport';
|
||||
import { resResult, genCode } from '../../../pubUtils/util';
|
||||
import { ITEM_CHANGE_REASON, PUSH_ROUTE, STATUS } from '../../../consts';
|
||||
import { getArmyWishPoolBaseByLv, getGoodById, getWishPoolReward } from '../../../pubUtils/data';
|
||||
import { gameData, getGoodById, getWishPoolReward } from '../../../pubUtils/data';
|
||||
import { addItems, checkGoods, checkHeroEquips, checkHeroes, getHonourObject, handleCost } from '../../../services/role/rewardService';
|
||||
import { ITID, CONSUME_TYPE } from '../../../consts/constModules/itemConst';
|
||||
import { GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
|
||||
import { refreshUserGuild, getWishPool, getUserGuildWithRefActive } from '../../../services/guildService';
|
||||
import { GUILD_POINT_WAYS, GUILD_STRUCTURE, WISH_POOL_TYPE } from '../../../consts/constModules/guildConst';
|
||||
import { refreshUserGuild, getWishPool, getUserGuildWithRefActive, addActive } from '../../../services/guildService';
|
||||
import { findIndex, findWhere } from 'underscore';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { getRoleOnlineInfo } from '../../../services/redisService';
|
||||
@@ -41,30 +41,17 @@ export class WishPoolHandler {
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
let dicGoods = getGoodById(goodId)
|
||||
if (!dicGoods) return resResult(STATUS.WRONG_PARMS);
|
||||
if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
let dicItid = ITID.get(dicGoods.itid);
|
||||
if (!(dicItid.type == CONSUME_TYPE.SOUL && type == 2 ) && !(dicItid.type == CONSUME_TYPE.DRAWING && type == 1 ))
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (dicItid.type != CONSUME_TYPE.SOUL && type != WISH_POOL_TYPE.SOUL)
|
||||
return resResult(STATUS.GUILD_WISH_POOL_CAN_NOT_WISH);
|
||||
|
||||
let userGuild = await refreshUserGuild(myUserGuild, roleId);
|
||||
if (!userGuild) return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
let result = await checkGoods(roleId, [goodId]);
|
||||
if (!result) {
|
||||
if (dicItid.type == CONSUME_TYPE.SOUL ) {
|
||||
result = await checkHeroes(roleId, [dicGoods.hid]);
|
||||
if (!result)
|
||||
return resResult(STATUS.GUILD_WISH_POOL_NOT_OWN_HERO);
|
||||
} else if (dicItid.type == CONSUME_TYPE.DRAWING ) {
|
||||
result = await checkHeroEquips(roleId, dicGoods.quality);
|
||||
if (!result)
|
||||
return resResult(STATUS.GUILD_WISH_POOL_NOT_OWN_EQUIP);
|
||||
}
|
||||
}
|
||||
const { guildCode: code, wishGoods, receivedWishPool, createdAt } = userGuild;
|
||||
|
||||
let { structure } = await GuildModel.findGuild(code, serverId, 'structure');
|
||||
let { lv } = findWhere(structure, {id: GUILD_STRUCTURE.WISH_POOL});
|
||||
let { lv } = await GuildModel.findGuild(code, serverId, 'lv');
|
||||
let len = wishGoods.filter(cur => cur.type == type).length;
|
||||
|
||||
if(receivedWishPool.indexOf(type) != -1 && getSeconds(createdAt) > getZeroPoint()) {
|
||||
@@ -73,17 +60,14 @@ export class WishPoolHandler {
|
||||
if (len >= ARMY.ARMY_WISH_TIMES) //今日已经许愿过
|
||||
return resResult(STATUS.HAS_REACH_WISH_COUNT_LIMIT);
|
||||
|
||||
let dicWishPool = getArmyWishPoolBaseByLv(lv);
|
||||
let dicStructure = gameData.centerBase.get(lv);
|
||||
let count = 0;
|
||||
if (type == 1) {
|
||||
let wishGoodsDrawing = dicWishPool.wishgoodsDrawings.find(cur => cur.quality == dicGoods.quality);
|
||||
if (!wishGoodsDrawing) return resResult(STATUS.NOT_WISH_THE_QUALITY_GOODS);
|
||||
count = wishGoodsDrawing.count;
|
||||
} else {
|
||||
let wishGoodsHero = dicWishPool.wishGoodsHeros.find(cur => cur.quality == dicGoods.quality);
|
||||
if (type == WISH_POOL_TYPE.SOUL) {
|
||||
let wishGoodsHero = dicStructure.wishgoodsHero.find(cur => cur.quality == dicGoods.quality);
|
||||
if (!wishGoodsHero) return resResult(STATUS.NOT_WISH_THE_QUALITY_GOODS);
|
||||
count = wishGoodsHero.count;
|
||||
}
|
||||
|
||||
const id = genCode(6);
|
||||
let { wishGoods: resWishGoods } = await UserGuildModel.pushAndUpdate(roleId, {}, { wishGoods: { type, goodId, count, receiveCnt: 0, drawCnt: 0, id, donateNames:[]} }, 'wishGoods');
|
||||
return resResult(STATUS.SUCCESS, { wishGoods: resWishGoods });
|
||||
@@ -94,6 +78,7 @@ export class WishPoolHandler {
|
||||
let { wishRoleId, id, myUserGuild } = msg;
|
||||
const dntRoleId: string = session.get('roleId');
|
||||
const dntRoleName: string = session.get('roleName');
|
||||
const serverId: number = session.get('serverId');
|
||||
const sid: string = session.get('sid');
|
||||
if (wishRoleId == dntRoleId)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
@@ -132,6 +117,8 @@ export class WishPoolHandler {
|
||||
}
|
||||
await WishPoolReportModel.addReport(code, wishRoleId, role.roleName , dntRoleId, dntRoleName, wishGood.goodId, 1);
|
||||
let goods = await addItems(dntRoleId, dntRoleName, sid, [getHonourObject(dicWishReward.honourReward)], ITEM_CHANGE_REASON.WISH_POOL_DONATE);
|
||||
await addActive(dntRoleId, serverId, GUILD_POINT_WAYS.DONATE);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { wishDntCnt, goods, updateWishGoods: resWishGoods.map(({type, goodId, count, receiveCnt, drawCnt, id})=>{
|
||||
return { type, goodId, count, receiveCnt, drawCnt, id, roleId: wishRoleId };
|
||||
})
|
||||
|
||||
@@ -50,12 +50,7 @@ export class ShopHandler {
|
||||
|
||||
if(dicShopItem.guildLvLimit) {
|
||||
let myGuild = await GuildModel.findByCode(guildCode, serverId);
|
||||
if(!myGuild) return resResult(STATUS.GUILD_LV_LIMIT);
|
||||
let { structure } = myGuild;
|
||||
let curStructure = structure.find(cur => cur.id == GUILD_STRUCTURE.STORE);
|
||||
if(!curStructure || curStructure.lv < dicShopItem.guildLvLimit) {
|
||||
return resResult(STATUS.GUILD_LV_LIMIT);
|
||||
}
|
||||
if(!myGuild || myGuild.lv < dicShopItem.guildLvLimit) return resResult(STATUS.GUILD_LV_LIMIT);
|
||||
}
|
||||
if(dicShopItem.lvlimit) {
|
||||
let role = await RoleModel.findByRoleId(roleId, 'lv');
|
||||
|
||||
@@ -200,13 +200,14 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
|
||||
const dividendCode = genCode(DIVIDEND_CODE_LEN);
|
||||
const participantsData = await participants(guildCode, sourceType, sourceCode);
|
||||
const dividends: DividendRec[] = participantsData.map(data => {
|
||||
const { roleId } = data;
|
||||
const { roleId, baseNum } = data;
|
||||
return {
|
||||
roleId,
|
||||
posNum: 0, // 职位分红
|
||||
baseNum,
|
||||
hasJoin: true,
|
||||
weekendNum: 0, // 额外分红,周末
|
||||
total: 0, // 总分红
|
||||
total: baseNum, // 总分红
|
||||
status: 0, // 0:未领取,1:已领取
|
||||
};
|
||||
});
|
||||
@@ -260,15 +261,16 @@ export async function calculateDividend(dividend: DividendType) {
|
||||
const participantsData = await participants(guildCode, sourceType, sourceCode);
|
||||
const totalRatio = totalDividendRatio(participantsData);
|
||||
const dividends: DividendRec[] = participantsData.map(data => {
|
||||
const { roleId } = data;
|
||||
const { roleId, baseNum } = data;
|
||||
const posNum = posDividend(calcuTotalPrice, dividendRate(data), totalRatio);
|
||||
const weekendNum = weekendDividend(posNum, begin);
|
||||
return {
|
||||
roleId,
|
||||
posNum, // 职位分红
|
||||
baseNum,
|
||||
hasJoin: true,
|
||||
weekendNum, // 额外分红,周末
|
||||
total: posNum + weekendNum, // 总分红
|
||||
total: posNum + baseNum + weekendNum, // 总分红
|
||||
status: 0, // 0:未领取,1:已领取
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ServerlistModel, ServerlistType } from "../../db/Serverlist";
|
||||
import { RoleModel } from "../../db/Role";
|
||||
import { GUILDACTIVITY } from "../../pubUtils/dicParam";
|
||||
import { gameData, getGuildAuctionRewards, getCityActivityRewards } from "../../pubUtils/data";
|
||||
import { gameData, getGuildAuctionRewards, getCityActivityRewards, getGuildAuctionBasicNum } from "../../pubUtils/data";
|
||||
import { getCurDay, nowSeconds, getTimeFun, getZeroPoint } from "../../pubUtils/timeUtil";
|
||||
import { GUILD_ACTIVITY_STATUS, GET_POINT_WAYS, GUILD_ACTIVITY_TYPE, REDIS_KEY, AUCTION_SOURCE, MAIL_TYPE, CITY_STATUS, DEBUG_MAGIC_WORD, GUILD_POINT_WAYS, TASK_TYPE, AUCTION_TIME, CITY_ACTIVITY_DOOR, ABI_TYPE, PUSH_ROUTE, RACE_ACTIVITY_STATUS, SHOP_REFRESH_TYPE } from "../../consts";
|
||||
import { Record, UserGuildActivityRecModel } from "../../db/UserGuildActivityRec";
|
||||
@@ -518,22 +518,26 @@ export async function participants(guildCode: string, sourceType: number, source
|
||||
if(sourceCode == DEBUG_MAGIC_WORD) {
|
||||
let userGuilds = await UserGuildModel.getListByGuild(guildCode);
|
||||
return userGuilds.map(cur => {
|
||||
return { roleId: cur.roleId, job: cur.job }
|
||||
return { roleId: cur.roleId, job: cur.job, baseNum: 0 }
|
||||
})
|
||||
}
|
||||
|
||||
if (sourceType == AUCTION_SOURCE.BOSS) {
|
||||
let rec = await BossInstanceModel.findBySourceCode(guildCode, sourceCode);
|
||||
if (!rec) return [];
|
||||
|
||||
let dic = gameData.bossBaseByBossLv.get(rec.bossLv);
|
||||
return rec.ranks.map(cur => {
|
||||
return { roleId: cur.roleId, job: cur.job }
|
||||
return { roleId: cur.roleId, job: cur.job, baseNum: dic.basicDividend }
|
||||
});
|
||||
} else {
|
||||
let rec = await GuildActivityRecordModel.findBySourceCode(guildCode, sourceType, sourceCode);
|
||||
if (!rec) return [];
|
||||
|
||||
return rec.members || [];
|
||||
let baseNum = getGuildAuctionBasicNum(rec.aid, rec.rank, rec.cityId);
|
||||
let members = rec.members || [];
|
||||
return members.map(cur => {
|
||||
return { roleId: cur.roleId, job: cur.job, baseNum }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@ export enum GUILD_POINT_WAYS {
|
||||
TRAIN = 2, // 训练场
|
||||
BOSS_WAR = 3, // 演武台
|
||||
ACTIVITY = 4, // 军团活动
|
||||
WISH_POOL = 5, // 许愿池
|
||||
}
|
||||
|
||||
// 军团活动id
|
||||
@@ -313,4 +314,8 @@ export enum RACE_ACTIVITY_STATUS {
|
||||
BREAK = 3, // 爆破
|
||||
}
|
||||
|
||||
export const CITY_ACTIVITY_DOOR = 1047;
|
||||
export const CITY_ACTIVITY_DOOR = 1047;
|
||||
|
||||
export enum WISH_POOL_TYPE {
|
||||
SOUL = 1, // 将魂
|
||||
}
|
||||
@@ -210,6 +210,7 @@ export const STATUS = {
|
||||
GUILD_DONATE_LV_NOT_ENOUGH: { code: 20934, simStr: '捐献所等级不足' },
|
||||
GUILD_EQUIP_PRODUCE_LV_NOT_ENOUGH: { code: 20935, simStr: '炼器堂等级不足' },
|
||||
GUILD_DONATE_CAN_NOT_SEND: { code: 20936, simStr: '此物品数量不足,不可捐赠' },
|
||||
GUILD_WISH_POOL_CAN_NOT_WISH: { code: 20937, simStr: '不能许愿该类型物品' },
|
||||
|
||||
GUILD_SCRIPT_IS_OPENED_TODAY: { code: 20950, simStr: '今日已开启过演武场' },
|
||||
GUILD_SCRIPT_NOT_OPENED: { code: 20951, simStr: '演武场未开启' },
|
||||
|
||||
@@ -105,7 +105,7 @@ export default class GuildActivityRecord extends BaseModel {
|
||||
}
|
||||
|
||||
public static async findBySourceCode(guildCode: string, sourceType: number, sourceCode: string) {
|
||||
const rec = await GuildActivityRecordModel.findOne({ guildCode, auctionType: sourceType, code: sourceCode }).select('members').lean();
|
||||
const rec = await GuildActivityRecordModel.findOne({ guildCode, auctionType: sourceType, code: sourceCode }).select('members aid rank cityId').lean();
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,6 +286,8 @@ export class DividendRec {
|
||||
@prop({ required: true, default: '' })
|
||||
roleId: string;
|
||||
@prop({ required: true, default: 0 })
|
||||
baseNum: number; // 职位分红
|
||||
@prop({ required: true, default: 0 })
|
||||
posNum: number; // 职位分红
|
||||
@prop({ required: true, default: 0 })
|
||||
weekendNum: number; // 额外分红,周末
|
||||
|
||||
@@ -32,7 +32,7 @@ import { dicHeroRewads, loadPvpHeroReward } from './dictionary/DicPvpHeroReward'
|
||||
import { dicRankRewads, dicRankMax, loadPvpRankReward, DicRankRewads } from './dictionary/DicPvpRankReward';
|
||||
import { DicPvpBox, dicPvpBoxesBySeasonNum, dicPvpBoxs, loadPvpBox } from './dictionary/DicPvpBox';
|
||||
import { dicGuildAuth, loadGuildAuth } from './dictionary/DicGuildAuth';
|
||||
import { dicCenterBase, dicEquipPriduceBase, dicBossBase, dicTrainBase, dicDonateBase, dicWishPoolBase, dicStoreBase, dicStructureConsume, dicBossBaseByBossLv, loadStructure } from "./dictionary/DicStructure";
|
||||
import { dicCenterBase, dicEquipPriduceBase, dicBossBase, dicTrainBase, dicDonateBase, dicStructureConsume, dicBossBaseByBossLv, loadStructure } from "./dictionary/DicStructure";
|
||||
import { dicGuildActiveDayReward, loadGuildActiveDayReward } from './dictionary/DicGuildActiveDayReward';
|
||||
import { dicGuildActiveWeekReward, loadGuildActiveWeekReward } from './dictionary/DicGuildActiveWeekReward';
|
||||
import { dicGuildActiveWays, loadGuildActiveWays } from './dictionary/DicGuildActiveWays';
|
||||
@@ -169,8 +169,6 @@ export const gameData = {
|
||||
bossBaseByBossLv: dicBossBaseByBossLv,
|
||||
trainBase: dicTrainBase,
|
||||
donateBase: dicDonateBase,
|
||||
armyWishPool: dicWishPoolBase,
|
||||
storeBase: dicStoreBase,
|
||||
guildTrainInfo: dicGuildTrainInfo,
|
||||
structureConsume: dicStructureConsume,
|
||||
guildActiveDayReward: dicGuildActiveDayReward,
|
||||
@@ -603,10 +601,6 @@ export function getArmyDonateBaseByLv(lv: number) {
|
||||
export function getArmyDonateBoxBaseById(id: number) {
|
||||
return gameData.armyDonateBox.get(id);
|
||||
}
|
||||
export function getArmyWishPoolBaseByLv(lv: number) {
|
||||
return gameData.armyWishPool.get(lv);
|
||||
}
|
||||
|
||||
export function getFriendLvByExp(exp: number) {
|
||||
let resultLv = 1;
|
||||
for (let [lv, { sum }] of gameData.roleFriendLv.entries()) {
|
||||
@@ -651,11 +645,15 @@ export function getTodayGuildActivity() {
|
||||
* @param aid 活动id
|
||||
* @param rank 排名
|
||||
*/
|
||||
export function getGuildAuctionRewards(aid: number, rank: number, cityId: number = 0) {
|
||||
function getGuildAuction(aid: number, rank: number, cityId: number = 0) {
|
||||
let ranksReward = gameData.guildAuction.get(`${aid}_${cityId}`) || [];
|
||||
let dic = ranksReward.find(cur => {
|
||||
return ranksReward.find(cur => {
|
||||
return rank >= cur.min && (rank <= cur.max || cur.max == 0);
|
||||
});
|
||||
}
|
||||
|
||||
export function getGuildAuctionRewards(aid: number, rank: number, cityId: number = 0) {
|
||||
let dic = getGuildAuction(aid, rank, cityId);
|
||||
if(dic) {
|
||||
return getAuctionRewardByPoolId(dic.rewards);
|
||||
} else {
|
||||
@@ -663,6 +661,12 @@ export function getGuildAuctionRewards(aid: number, rank: number, cityId: number
|
||||
}
|
||||
}
|
||||
|
||||
export function getGuildAuctionBasicNum(aid: number, rank: number, cityId: number = 0) {
|
||||
console.log('###### getGuildAuctionBasicNum', aid, rank, cityId)
|
||||
let dic = getGuildAuction(aid, rank, cityId);
|
||||
return dic?.basicDividend||0;
|
||||
}
|
||||
|
||||
export function getAuctionRewardByPoolId(poolId: number) {
|
||||
let pools = gameData.auctionPool.get(poolId);
|
||||
let rewards: { goods: RewardInter, basePrice: number, maxPrice: number, sort: number }[] = [];
|
||||
|
||||
@@ -14,6 +14,8 @@ export interface DicGuildAuction {
|
||||
readonly rewards: number;
|
||||
// 城池
|
||||
readonly cityId: number;
|
||||
// 基础分红
|
||||
readonly basicDividend: number;
|
||||
}
|
||||
|
||||
export const dicGuildAuction = new Map<string, DicGuildAuction[]>();
|
||||
|
||||
@@ -17,6 +17,8 @@ export interface DicCentreBase {
|
||||
readonly managerNum: number;
|
||||
// 每日最大可获得资金
|
||||
readonly maxFund: number;
|
||||
// 许愿的品质
|
||||
readonly wishgoodsHero: { quality: number, count: number }[]
|
||||
}
|
||||
|
||||
const DicCenterKeys: KeysEnum<DicCentreBase> = {
|
||||
@@ -25,6 +27,7 @@ const DicCenterKeys: KeysEnum<DicCentreBase> = {
|
||||
peopleNum: true,
|
||||
managerNum: true,
|
||||
maxFund: true,
|
||||
wishgoodsHero: true
|
||||
};
|
||||
|
||||
// 炼器堂
|
||||
@@ -69,6 +72,8 @@ export interface DicBossBase {
|
||||
readonly ratio: number;
|
||||
// 鼓舞次数
|
||||
readonly encourageSum: number;
|
||||
// 基础分红
|
||||
readonly basicDividend: number;
|
||||
}
|
||||
|
||||
const DicBossKeys: KeysEnum<DicBossBase> = {
|
||||
@@ -83,7 +88,8 @@ const DicBossKeys: KeysEnum<DicBossBase> = {
|
||||
basicReward: true,
|
||||
damageRewardTotal: true,
|
||||
ratio: true,
|
||||
encourageSum: true
|
||||
encourageSum: true,
|
||||
basicDividend: true,
|
||||
};
|
||||
|
||||
// 练兵场
|
||||
@@ -124,34 +130,6 @@ const DicDonateKeys: KeysEnum<DicDonateBase> = {
|
||||
donateReward: true,
|
||||
};
|
||||
|
||||
// 许愿池
|
||||
export interface DicWishPoolBase {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 等级
|
||||
readonly level: number;
|
||||
readonly wishgoodsDrawings: Array<{quality: number, count: number}>;
|
||||
readonly wishGoodsHeros: Array<{quality: number, count: number}>;
|
||||
readonly consume: number;
|
||||
}
|
||||
|
||||
const DicWishPoolKeys: KeysEnum<DicWishPoolBase> = {
|
||||
id: true,
|
||||
level: true,
|
||||
wishgoodsDrawings: true,
|
||||
wishGoodsHeros: true,
|
||||
consume: true,
|
||||
};
|
||||
// 商店
|
||||
export interface DicStoreBase {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 等级
|
||||
readonly level: number;
|
||||
// 许愿物品
|
||||
readonly storeGoods: {id: number, count: number, num: number}[];
|
||||
}
|
||||
|
||||
|
||||
export const dicStructureConsume = new Map<number, Map<number, number>>(); // 升级消耗 structureId => level => consume
|
||||
export const dicCenterBase = new Map<number, DicCentreBase>(); // 中军大帐
|
||||
@@ -160,8 +138,6 @@ export const dicBossBase = new Map<number, DicBossBase>(); // 演武台
|
||||
export const dicBossBaseByBossLv = new Map<number, DicBossBase>(); // 演武台 boss等级=>dic
|
||||
export const dicTrainBase = new Map<number, DicTrainBase>(); // 练兵场
|
||||
export const dicDonateBase = new Map<number, DicDonateBase>(); // 捐献所
|
||||
export const dicWishPoolBase = new Map<number, DicWishPoolBase>(); // 许愿池
|
||||
export const dicStoreBase = new Map<number, DicWishPoolBase>(); // 许愿池
|
||||
export const maxMemberCnt = { max: 0 }; // 满配最大人数
|
||||
|
||||
export function loadStructure() {
|
||||
@@ -172,21 +148,15 @@ export function loadStructure() {
|
||||
dicBossBaseByBossLv.clear();
|
||||
dicTrainBase.clear();
|
||||
dicDonateBase.clear();
|
||||
dicWishPoolBase.clear();
|
||||
dicStoreBase.clear();
|
||||
maxMemberCnt.max = 0;
|
||||
|
||||
const DicStoreKeys: KeysEnum<DicStoreBase> = {
|
||||
id: true,
|
||||
level: true,
|
||||
storeGoods: true
|
||||
};
|
||||
// 中军大帐
|
||||
let arrCenter = readFileAndParse(FILENAME.DIC_GUILD_STRUCTURE_CENTER);
|
||||
arrCenter.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
if(o.peopleNum > maxMemberCnt.max) maxMemberCnt.max = o.peopleNum;
|
||||
o.maxFund = o.feeLimit;
|
||||
o.wishgoodsHero = parseWishGoods(o.wishgoodsHero)
|
||||
dicCenterBase.set(o.level, _.pick(o, Object.keys(DicCenterKeys)));
|
||||
});
|
||||
arrCenter = undefined;
|
||||
@@ -235,31 +205,6 @@ export function loadStructure() {
|
||||
});
|
||||
arrDonate = undefined;
|
||||
|
||||
// 许愿池
|
||||
let arrWishPool = readFileAndParse(FILENAME.DIC_GUILD_WISH_POOL_BASE);
|
||||
arrWishPool.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.wishgoodsDrawings = o.wishgoodsDrawing.split('|').map(wishgoodsDrawing=>{
|
||||
let wishgoodsDrawings = wishgoodsDrawing.split('&');
|
||||
return {quality: parseInt(wishgoodsDrawings[0]), count: parseInt(wishgoodsDrawings[1])};
|
||||
});
|
||||
o.wishGoodsHeros = o.wishgoodsHero.split('|').map(wishGoodsHero=>{
|
||||
let wishGoodsHeros = wishGoodsHero.split('&');
|
||||
return {quality: parseInt(wishGoodsHeros[0]), count: parseInt(wishGoodsHeros[1])};
|
||||
});
|
||||
dicWishPoolBase.set(o.level, _.pick(o, Object.keys(DicWishPoolKeys)));
|
||||
});
|
||||
arrWishPool = undefined;
|
||||
|
||||
// 商店
|
||||
let arrStore = readFileAndParse(FILENAME.DIC_GUILD_STORE_BASE);
|
||||
arrStore.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.storeGoods = parseStoreGoods(o.storeGoods);
|
||||
dicStoreBase.set(o.level, _.pick(o, Object.keys(DicStoreKeys)));
|
||||
});
|
||||
arrStore = undefined;
|
||||
|
||||
// 升级消耗
|
||||
function setStructureConsume(o) {
|
||||
let map = dicStructureConsume.get(o.structureId);
|
||||
@@ -312,18 +257,4 @@ export function parseWishGoods(str: string) {
|
||||
result.push({ quality: parseInt(quality), count: parseInt(count) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// {"id": number, "count": number, "num": number}
|
||||
export function parseStoreGoods(str: string) {
|
||||
let result = new Array<{ id: number, count: number, num: number }>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [id, count, num] of decodeArr) {
|
||||
if (isNaN(parseInt(id)) || isNaN(parseInt(count))|| isNaN(parseInt(num))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({ id: parseInt(id), count: parseInt(count), num: parseInt(num) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -3,24 +3,40 @@
|
||||
"id": 1,
|
||||
"name": "捐献所",
|
||||
"cout": 10,
|
||||
"activePoint": "1&5|2&10|3&20"
|
||||
"activePoint": "1&5|2&10|3&20",
|
||||
"icon": "juanxiansuo",
|
||||
"structureId": 7
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "练兵场",
|
||||
"cout": 4,
|
||||
"activePoint": "1&10"
|
||||
"activePoint": "1&10",
|
||||
"icon": "lianbingchang",
|
||||
"structureId": 4
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "演武台",
|
||||
"cout": 1,
|
||||
"activePoint": "1&15"
|
||||
"activePoint": "1&15",
|
||||
"icon": "yanwutai",
|
||||
"structureId": 3
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "军团活动",
|
||||
"cout": 2,
|
||||
"activePoint": "1&20"
|
||||
"cout": 1,
|
||||
"activePoint": "1&20",
|
||||
"icon": "juntuanhuodong",
|
||||
"structureId": 9
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "许愿池",
|
||||
"cout": 3,
|
||||
"activePoint": "1&5",
|
||||
"icon": "juanxiansuo",
|
||||
"structureId": 5
|
||||
}
|
||||
]
|
||||
@@ -4,7 +4,8 @@
|
||||
"structureId": 3,
|
||||
"level": 1,
|
||||
"bossLevel": 10,
|
||||
"warIdHP": "8001&10000000&10|8008&10000000&10",
|
||||
"basicDividend": 500,
|
||||
"warIdHP": "8001&10000000&60|8008&10000000&60",
|
||||
"rewards": 1,
|
||||
"consume": 50000,
|
||||
"buildWords": "&",
|
||||
@@ -22,7 +23,8 @@
|
||||
"structureId": 3,
|
||||
"level": 2,
|
||||
"bossLevel": 20,
|
||||
"warIdHP": "8009&20000000&20|8010&20000000&20|8016&20000000&20",
|
||||
"basicDividend": 700,
|
||||
"warIdHP": "8009&20000000&60|8010&20000000&60|8016&20000000&60",
|
||||
"rewards": 1,
|
||||
"consume": 125000,
|
||||
"buildWords": "&",
|
||||
@@ -40,7 +42,8 @@
|
||||
"structureId": 3,
|
||||
"level": 3,
|
||||
"bossLevel": 30,
|
||||
"warIdHP": "8017&30000000&30|8018&30000000&30|8024&30000000&30",
|
||||
"basicDividend": 900,
|
||||
"warIdHP": "8017&30000000&60|8018&30000000&60|8024&30000000&60",
|
||||
"rewards": 2,
|
||||
"consume": 350000,
|
||||
"buildWords": "&",
|
||||
@@ -58,7 +61,8 @@
|
||||
"structureId": 3,
|
||||
"level": 4,
|
||||
"bossLevel": 40,
|
||||
"warIdHP": "8025&40000000&40|8026&40000000&40|8027&40000000&40|8032&40000000&40",
|
||||
"basicDividend": 1000,
|
||||
"warIdHP": "8025&40000000&60|8026&40000000&60|8027&40000000&60|8032&40000000&60",
|
||||
"rewards": 2,
|
||||
"consume": 800000,
|
||||
"buildWords": "&",
|
||||
@@ -76,7 +80,8 @@
|
||||
"structureId": 3,
|
||||
"level": 5,
|
||||
"bossLevel": 50,
|
||||
"warIdHP": "8033&50000000&50|8034&50000000&50|8035&50000000&50|8040&50000000&50",
|
||||
"basicDividend": 1100,
|
||||
"warIdHP": "8033&50000000&60|8034&50000000&60|8035&50000000&60|8040&50000000&60",
|
||||
"rewards": 2,
|
||||
"consume": 1700000,
|
||||
"buildWords": "&",
|
||||
@@ -94,6 +99,7 @@
|
||||
"structureId": 3,
|
||||
"level": 6,
|
||||
"bossLevel": 60,
|
||||
"basicDividend": 1200,
|
||||
"warIdHP": "8041&60000000&60|8042&60000000&60|8043&60000000&60|8044&60000000&60|8048&60000000&60",
|
||||
"rewards": 2,
|
||||
"consume": 3500000,
|
||||
@@ -112,7 +118,8 @@
|
||||
"structureId": 3,
|
||||
"level": 7,
|
||||
"bossLevel": 70,
|
||||
"warIdHP": "8049&70000000&65|8050&70000000&65|8051&70000000&65|8052&70000000&65|8056&70000000&65",
|
||||
"basicDividend": 1300,
|
||||
"warIdHP": "8049&70000000&60|8050&70000000&60|8051&70000000&60|8052&70000000&60|8056&70000000&60",
|
||||
"rewards": 3,
|
||||
"consume": 6125000,
|
||||
"buildWords": "&",
|
||||
@@ -130,7 +137,8 @@
|
||||
"structureId": 3,
|
||||
"level": 8,
|
||||
"bossLevel": 80,
|
||||
"warIdHP": "8057&80000000&70|8058&80000000&70|8059&80000000&70|8060&80000000&70|8061&80000000&70|8064&80000000&70",
|
||||
"basicDividend": 1400,
|
||||
"warIdHP": "8057&80000000&60|8058&80000000&60|8059&80000000&60|8060&80000000&60|8061&80000000&60|8064&80000000&60",
|
||||
"rewards": 3,
|
||||
"consume": 9125000,
|
||||
"buildWords": "&",
|
||||
@@ -148,7 +156,8 @@
|
||||
"structureId": 3,
|
||||
"level": 9,
|
||||
"bossLevel": 90,
|
||||
"warIdHP": "8065&90000000&75|8066&90000000&75|8067&90000000&75|8068&90000000&75|8069&90000000&75|8070&90000000&75|8072&90000000&75",
|
||||
"basicDividend": 1500,
|
||||
"warIdHP": "8065&90000000&60|8066&90000000&60|8067&90000000&60|8068&90000000&60|8069&90000000&60|8070&90000000&60|8072&90000000&60",
|
||||
"rewards": 3,
|
||||
"consume": 13625000,
|
||||
"buildWords": "&",
|
||||
@@ -166,7 +175,8 @@
|
||||
"structureId": 3,
|
||||
"level": 10,
|
||||
"bossLevel": 100,
|
||||
"warIdHP": "8073&100000000&80|8074&100000000&80|8075&100000000&80|8076&100000000&80|8077&100000000&80|8078&100000000&80|8079&100000000&80|8080&100000000&80",
|
||||
"basicDividend": 1600,
|
||||
"warIdHP": "8073&100000000&60|8074&100000000&60|8075&100000000&60|8076&100000000&60|8077&100000000&60|8078&100000000&60|8079&100000000&60|8080&100000000&60",
|
||||
"rewards": 3,
|
||||
"consume": 0,
|
||||
"buildWords": "&",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"level": 1,
|
||||
"peopleNum": 30,
|
||||
"managerNum": 3,
|
||||
"wishgoodsHero": "&",
|
||||
"consume": 100000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -16,6 +17,7 @@
|
||||
"level": 2,
|
||||
"peopleNum": 35,
|
||||
"managerNum": 3,
|
||||
"wishgoodsHero": "&",
|
||||
"consume": 250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -27,6 +29,7 @@
|
||||
"level": 3,
|
||||
"peopleNum": 40,
|
||||
"managerNum": 3,
|
||||
"wishgoodsHero": "&",
|
||||
"consume": 700000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -38,6 +41,7 @@
|
||||
"level": 4,
|
||||
"peopleNum": 45,
|
||||
"managerNum": 4,
|
||||
"wishgoodsHero": "1&2",
|
||||
"consume": 1600000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -49,6 +53,7 @@
|
||||
"level": 5,
|
||||
"peopleNum": 50,
|
||||
"managerNum": 4,
|
||||
"wishgoodsHero": "1&2",
|
||||
"consume": 3400000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -60,6 +65,7 @@
|
||||
"level": 6,
|
||||
"peopleNum": 55,
|
||||
"managerNum": 4,
|
||||
"wishgoodsHero": "1&2|2&1",
|
||||
"consume": 7000000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -71,6 +77,7 @@
|
||||
"level": 7,
|
||||
"peopleNum": 60,
|
||||
"managerNum": 5,
|
||||
"wishgoodsHero": "1&2|2&1",
|
||||
"consume": 12250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -82,6 +89,7 @@
|
||||
"level": 8,
|
||||
"peopleNum": 60,
|
||||
"managerNum": 5,
|
||||
"wishgoodsHero": "1&2|2&1",
|
||||
"consume": 18250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -93,6 +101,7 @@
|
||||
"level": 9,
|
||||
"peopleNum": 60,
|
||||
"managerNum": 5,
|
||||
"wishgoodsHero": "1&3|2&1|3&1",
|
||||
"consume": 27250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
@@ -104,6 +113,7 @@
|
||||
"level": 10,
|
||||
"peopleNum": 60,
|
||||
"managerNum": 5,
|
||||
"wishgoodsHero": "1&3|2&1|3&1",
|
||||
"consume": 0,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1",
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"min": 1,
|
||||
"max": 1,
|
||||
"rewards": 4,
|
||||
"cityId": "0&"
|
||||
"cityId": "0&",
|
||||
"basicDividend": 1000
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
@@ -13,7 +14,8 @@
|
||||
"min": 2,
|
||||
"max": 10,
|
||||
"rewards": 5,
|
||||
"cityId": "0&"
|
||||
"cityId": "0&",
|
||||
"basicDividend": 800
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
@@ -21,7 +23,8 @@
|
||||
"min": 11,
|
||||
"max": 0,
|
||||
"rewards": 6,
|
||||
"cityId": "0&"
|
||||
"cityId": "0&",
|
||||
"basicDividend": 500
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -29,7 +32,8 @@
|
||||
"min": 1,
|
||||
"max": 1,
|
||||
"rewards": 7,
|
||||
"cityId": "10&"
|
||||
"cityId": "10&",
|
||||
"basicDividend": 2000
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -37,7 +41,8 @@
|
||||
"min": 2,
|
||||
"max": 10,
|
||||
"rewards": 7,
|
||||
"cityId": "10&"
|
||||
"cityId": "10&",
|
||||
"basicDividend": 1500
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -45,7 +50,8 @@
|
||||
"min": 11,
|
||||
"max": 0,
|
||||
"rewards": 3,
|
||||
"cityId": "10&"
|
||||
"cityId": "10&",
|
||||
"basicDividend": 1200
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -53,7 +59,8 @@
|
||||
"min": 1,
|
||||
"max": 1,
|
||||
"rewards": 10,
|
||||
"cityId": "0&"
|
||||
"cityId": "0&",
|
||||
"basicDividend": 1000
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -61,7 +68,8 @@
|
||||
"min": 2,
|
||||
"max": 10,
|
||||
"rewards": 11,
|
||||
"cityId": "0&"
|
||||
"cityId": "0&",
|
||||
"basicDividend": 800
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -69,7 +77,8 @@
|
||||
"min": 11,
|
||||
"max": 0,
|
||||
"rewards": 12,
|
||||
"cityId": "0&"
|
||||
"cityId": "0&",
|
||||
"basicDividend": 500
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -77,7 +86,8 @@
|
||||
"min": 1,
|
||||
"max": 1,
|
||||
"rewards": 8,
|
||||
"cityId": "7&8&9"
|
||||
"cityId": "7&8&9",
|
||||
"basicDividend": 1200
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -85,7 +95,8 @@
|
||||
"min": 2,
|
||||
"max": 10,
|
||||
"rewards": 8,
|
||||
"cityId": "7&8&9"
|
||||
"cityId": "7&8&9",
|
||||
"basicDividend": 1000
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -93,7 +104,8 @@
|
||||
"min": 11,
|
||||
"max": 0,
|
||||
"rewards": 8,
|
||||
"cityId": "7&8&9"
|
||||
"cityId": "7&8&9",
|
||||
"basicDividend": 800
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -101,7 +113,8 @@
|
||||
"min": 1,
|
||||
"max": 1,
|
||||
"rewards": 9,
|
||||
"cityId": "1&2&3&4&5&6"
|
||||
"cityId": "1&2&3&4&5&6",
|
||||
"basicDividend": 1000
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -109,7 +122,8 @@
|
||||
"min": 2,
|
||||
"max": 10,
|
||||
"rewards": 9,
|
||||
"cityId": "1&2&3&4&5&6"
|
||||
"cityId": "1&2&3&4&5&6",
|
||||
"basicDividend": 800
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -117,6 +131,7 @@
|
||||
"min": 11,
|
||||
"max": 0,
|
||||
"rewards": 9,
|
||||
"cityId": "1&2&3&4&5&6"
|
||||
"cityId": "1&2&3&4&5&6",
|
||||
"basicDividend": 500
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user