商店:基础数据及购买

This commit is contained in:
luying
2022-07-25 17:41:04 +08:00
parent 4bf75fcda5
commit 4cf4511ee7
13 changed files with 952 additions and 565 deletions

View File

@@ -59,8 +59,8 @@ import { GUILDACTIVITY, RECRUIT } from "./dicParam";
import * as param from "./dicParam";
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandEelm, readTsFile, getRandEelmWithWeight } from "./util";
import { RACE_EVENT_TYPE } from "../consts";
import { dicShop, dicShopItem, loadShop } from "./dictionary/DicShop";
import { dicShopList, loadShopList } from "./dictionary/DicShopList";
import { dicShopByType, dicShopItem, loadShop } from "./dictionary/DicShop";
import { dicShopType, loadShopType } from "./dictionary/DicShopType";
import { dicRank, loadRank } from "./dictionary/DicRank";
import { dicRankReward, loadRankReward } from "./dictionary/DicRankReward";
import { dicTaskType, taskMap, dicMainTask, dicDailyTask, dicAchievement, loadTask, dicPvpDailyTask } from "./dictionary/DicTask";
@@ -198,9 +198,9 @@ export const gameData = {
raceActivityEncounter: { events: new Map<number, number>(), eventNum: 0 },
raceNormalItems: new Array<{id: number, total: number, max: number}>(),
raceEventItems: new Array<{id: number, count: number}>(),
shop: dicShop,
shopItemByType: dicShopByType,
shopItem: dicShopItem,
shopList: dicShopList,
shopType: dicShopType,
rank: dicRank,
generalRankReward: dicRankReward,
taskType: dicTaskType,
@@ -1010,6 +1010,15 @@ export function getLadderRankReward(myRank: number) {
return null
}
export function hasShopType(shop: number, type: number) {
return gameData.shopType.has(`${shop}_${type}`);
}
export function getShopType(shop: number, type: number) {
let key = `${shop}_${type}`;
return gameData.shopType.get(key)||null;
}
// 初始加载
function initDatas() {
parseDicParam();
@@ -1138,7 +1147,7 @@ function loadDatas() {
loadCityActivityReward();
loadRaceActivity();
loadShop();
loadShopList();
loadShopType();
loadRank();
loadRankReward();
loadTask();