形象:修改字典表
This commit is contained in:
@@ -60,15 +60,18 @@ export const FRIEND = {
|
||||
FRIEND_CLOSEPOINT_ADD: 5, // 每赠送/领取一次增加的亲密度
|
||||
FRIEND_FRIENDPOINT_ADD: 1, // 每领取一次爱心会增加的情谊值
|
||||
FRIEND_RECONMMEND_LEVEL: 5, // 系统推荐玩家等级要求浮动
|
||||
FRIEND_RECONMMEND_ACTIVETIME: 1000, // 系统推荐玩家活跃时间要求(小时)
|
||||
FRIEND_RECONMMEND_ACTIVETIME: 24, // 系统推荐玩家活跃时间要求(小时)
|
||||
FRIEND_BLACKLIST_MAX: 100, // 黑名单人数上限
|
||||
FRIEND_MANAGE_APPLICATION: 50, // 好友显示收到的申请条数上限
|
||||
FRIEND_RECEIVE_SINGLE: 1, // 向单个好友每日最多赠送多少爱心
|
||||
FRIEND_RECONMMEND_NUM: 8, // 同一批推荐好友数量
|
||||
FRIEND_RECONMMEND_SERVICE: 4, // 同一批推荐本服的好友数量
|
||||
};
|
||||
export const FIGURE = {
|
||||
DEFAULT_HEAD: 11201, // 默认头像
|
||||
DEFAULT_FRAME: 11301, // 默认相框
|
||||
DEFAULT_SPINE: 11401, // 默认形象
|
||||
};
|
||||
export const LOGIN = {
|
||||
LOGIN_PUBLIC_LABLE: '1&zi_remen|2&zi_zuixin|3&zi_zhiding', // 公告中对应的标签图片
|
||||
};
|
||||
export const EXTERIOR = {
|
||||
EXTERIOR_FACE: 11219, // 默认头像id
|
||||
EXTERIOR_FACECASE: 11301, // 默认头像框id
|
||||
EXTERIOR_APPEARANCE: 11419, // 默认形象id
|
||||
};
|
||||
|
||||
@@ -5,10 +5,13 @@ import { ItemModel } from '../db/Item';
|
||||
import { EquipModel, RandSe, Holes } from './../db/Equip';
|
||||
import { BagInter, EquipInter } from './interface';
|
||||
import { gameData } from './data';
|
||||
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../consts';
|
||||
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE, ROLE_SELECT, FIGURE_UNLOCK_CONDITION, CONSUME_TYPE } from '../consts';
|
||||
import { getRandValueByMinMax, getRandEelm } from './util';
|
||||
|
||||
import { findWhere } from 'underscore';
|
||||
import { RoleModel, RoleType } from '../db/Role';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import { getBeforeDaySeconds } from './timeUtil';
|
||||
|
||||
export async function addSkins(roleId: string, id: number) {
|
||||
let skinInfo = gameData.fashion.get(id);
|
||||
@@ -74,4 +77,83 @@ export function getGoldObject(count: number) {
|
||||
*/
|
||||
export function getFriendPointObject(count: number) {
|
||||
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.FRIEND_POINT), count};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解锁头像/相框
|
||||
* @param type 解锁类型(获得武将/好感达到)
|
||||
* @param num 参数(武将id/好感等级)
|
||||
*/
|
||||
export async function unlockFigure(roleId: string, conditions: {type: number, num: number}[], role?: RoleType) {
|
||||
if(!role || !role.heads || !role.frames) {
|
||||
role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_HEADS);
|
||||
}
|
||||
let { heads, frames, spines } = role;
|
||||
for(let {type, num} of conditions) {
|
||||
let canUnLockList = gameData.figureCondition.get(type);
|
||||
if(canUnLockList) {
|
||||
for(let {id, param} of canUnLockList) {
|
||||
let flag = false; // 是否达成条件
|
||||
if(type == FIGURE_UNLOCK_CONDITION.GET_HERO) {
|
||||
if(num == param) flag = true;
|
||||
} else if (type == FIGURE_UNLOCK_CONDITION.HERO_FAVOR) {
|
||||
if(num >= param) flag = true;
|
||||
}
|
||||
if(!flag) continue;
|
||||
let dicGood = gameData.goods.get(id);
|
||||
if(!dicGood) continue;
|
||||
let dicItid = ITID.get(dicGood.itid);
|
||||
if(!dicItid) continue;
|
||||
|
||||
if(dicItid.type == CONSUME_TYPE.HEAD) {
|
||||
unlockSingleFigure(heads, id, type);
|
||||
} else if (dicItid.type == CONSUME_TYPE.FRAME) {
|
||||
unlockSingleFigure(frames, id, type);
|
||||
} else if (dicItid.type == CONSUME_TYPE.SPINE) {
|
||||
unlockSingleFigure(spines, id, type);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
role = await RoleModel.updateRoleInfo(roleId, { heads, frames, spines });
|
||||
}
|
||||
|
||||
function unlockSingleFigure(dbFigures: Figure[], id: number, type: number) {
|
||||
let figure = dbFigures.find(cur => cur.id == id);
|
||||
if(!figure) {
|
||||
figure = new Figure(id, false);
|
||||
dbFigures.push(figure);
|
||||
}
|
||||
if(figure.unlocked) return; // 已解锁过
|
||||
if(figure.unlockedType.includes(type)) return;
|
||||
|
||||
figure.unlockedType.push(type);
|
||||
let dicGoods = gameData.goods.get(id);
|
||||
|
||||
let hasUnlockedAll = true;
|
||||
for(let {type} of dicGoods.condition) {
|
||||
if(!figure.unlockedType.includes(type)) {
|
||||
hasUnlockedAll = false; break;
|
||||
}
|
||||
}
|
||||
if(hasUnlockedAll) {
|
||||
figure.unlocked = true;
|
||||
|
||||
if(dicGoods.timeLimit) {
|
||||
figure.time = getBeforeDaySeconds(-1 * dicGoods.timeLimit); // timeLimit天以后
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 直接获得形象/相框
|
||||
export async function addFigure(roleId: string, id: number) {
|
||||
let figure = new Figure(id, true, null, false);
|
||||
let role = await RoleModel.addFigure(roleId, id, figure);
|
||||
return role;
|
||||
}
|
||||
Reference in New Issue
Block a user