diff --git a/game-server/app/servers/connector/handler/entryHandler.ts b/game-server/app/servers/connector/handler/entryHandler.ts index ea217940e..cd6870863 100644 --- a/game-server/app/servers/connector/handler/entryHandler.ts +++ b/game-server/app/servers/connector/handler/entryHandler.ts @@ -103,7 +103,7 @@ export class EntryHandler { let items = await ItemModel.findbyRole(role.roleId); let mails = await getMails(role.roleId, serverId) await chackFunOpenWhenLogin(role, session); - await loginRefresh(role.roleId); + if(role.hasInit) await loginRefresh(role.roleId); reportOneOnline(role.roleId, user.userCode, self.app.get('serverId'), user.pkgName); let r = new Rank(REDIS_KEY.HERO_NUM_RANK, { serverId }); diff --git a/game-server/app/servers/role/handler/roleHandler.ts b/game-server/app/servers/role/handler/roleHandler.ts index dd5f65950..d41576ca4 100644 --- a/game-server/app/servers/role/handler/roleHandler.ts +++ b/game-server/app/servers/role/handler/roleHandler.ts @@ -20,6 +20,7 @@ import { checkTaskWithHero, checkTask, checkTaskWithArgs } from '../../../servic import { accomplishTask } from '../../../pubUtils/taskUtil'; import { getGoldObject, getCoinObject } from '../../../pubUtils/itemUtils'; import { RScriptRecordModel } from '../../../db/RScriptRecord'; +import { checkPvp } from '../../../services/pvpService'; export default function (app: Application) { return new RoleHandler(app); @@ -37,7 +38,7 @@ export class RoleHandler { let funcs: number[] = session.get('funcs'); let { roleName } = msg; - let role = await RoleModel.findByRoleId(roleId, 'roleName hasInit'); + let role = await RoleModel.findByRoleId(roleId, 'roleName hasInit', true); if(role.hasInit) return resResult(STATUS.ROLE_HAS_INIT); let checkName = await RoleModel.checkName(roleName, serverId); @@ -56,12 +57,13 @@ export class RoleHandler { let items = [].concat(DEFAULT_ITEMS, DEFAULT_EQUIPS, [getGoldObject(DEFAULT_GOLD)], [getCoinObject(DEFAULT_COIN)]); await addItems(roleId, roleName, sid, items); - role = await RoleModel.updateRoleInfo(roleId, { hasInit: true, roleName }) + role = await RoleModel.updateRoleInfo(roleId, { hasInit: true, roleName }, true) let battleId = SCRIPT.SCRIPT_BATTLE_ID; let warInfo = gameData.war.get(battleId); await RScriptRecordModel.setScript(roleId, battleId, warInfo.warType, 2, SCRIPT.SCRIPT_NAME); + await checkPvp(role); return resResult(STATUS.SUCCESS, { roleId, roleName, heroes }) diff --git a/game-server/app/services/pvpService.ts b/game-server/app/services/pvpService.ts index a356de73e..42e3712ae 100644 --- a/game-server/app/services/pvpService.ts +++ b/game-server/app/services/pvpService.ts @@ -50,11 +50,13 @@ export async function initPvpInfo(role: RoleType) { } export async function checkPvp(role: RoleType) { - let result = await PvpDefenseModel.findByRoleId(role.roleId, true); - if (!!result) + if(role.hasInit) { + let result = await PvpDefenseModel.findByRoleId(role.roleId, true); + if (!!result) + return result; + result = await initPvpInfo(role); return result; - result = await initPvpInfo(role); - return result; + } } /** diff --git a/shared/consts/constModules/selectConst.ts b/shared/consts/constModules/selectConst.ts index 6a39f7af1..71e670ded 100644 --- a/shared/consts/constModules/selectConst.ts +++ b/shared/consts/constModules/selectConst.ts @@ -1,7 +1,7 @@ export enum ROLE_SELECT { // 初始登录数据 - ENTRY = 'serverId userInfo.uid userInfo.tel userInfo.serverType ce topLineup topLineupCe teraphs roleId roleName tili lv exp gold coin vLv title hasGuild funcs eventStatus heads head frames frame spines spine guildCode frdCnt showLineup updatedAt heroNum heroNumUpdatedAt loginTime', + ENTRY = 'serverId userInfo.uid userInfo.tel userInfo.serverType ce topLineup topLineupCe teraphs roleId roleName tili lv exp gold coin vLv title hasGuild funcs eventStatus heads head frames frame spines spine guildCode frdCnt showLineup updatedAt heroNum heroNumUpdatedAt loginTime hasInit', // 玩家列表显示基础数据 SHOW_SIMPLE = 'roleId roleName ce head frame spine lv title job quitTime loginTime vLv guildName serverId userInfo.serverType', // 显示申请需要的信息 diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index 8ed9c860e..9dcd72929 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -35,60 +35,60 @@ export const COUNTER = { export const DEFAULT_HEROES = [19, 53, 46, 40, 22, 56, 32, 28, 18]; export const DEFAULT_ITEMS = [ - { "id": 11004, "count": 99999999 }, - { "id": 11013, "count": 999999 }, - { "id": 11014, "count": 999999 }, - { "id": 11015, "count": 999999 }, - { "id": 11016, "count": 999999 }, - { "id": 17001, "count": 99999999 }, - { "id": 17002, "count": 99999999 }, - { "id": 17003, "count": 99999999 }, - { "id": 17004, "count": 99999999 }, - { "id": 17005, "count": 99999999 }, - { "id": 17006, "count": 99999999 }, - { "id": 17007, "count": 99999999 }, - { "id": 17008, "count": 99999999 }, - { "id": 17009, "count": 99999999 }, - { "id": 17010, "count": 99999999 }, - { "id": 17011, "count": 99999999 }, - { "id": 17012, "count": 99999999 }, - { "id": 17013, "count": 99999999 }, - { "id": 17014, "count": 99999999 }, - { "id": 17015, "count": 99999999 }, - { "id": 17016, "count": 99999999 }, - { "id": 17017, "count": 99999999 }, - { "id": 17018, "count": 99999999 }, - { "id": 17019, "count": 99999999 }, - { "id": 17020, "count": 99999999 }, - { "id": 17021, "count": 99999999 }, - { "id": 17022, "count": 99999999 }, - { "id": 17023, "count": 99999999 }, - { "id": 17024, "count": 99999999 }, - { "id": 17025, "count": 99999999 }, - { "id": 17026, "count": 99999999 }, - { "id": 17027, "count": 99999999 }, - { "id": 17028, "count": 99999999 }, - { "id": 17029, "count": 99999999 }, - { "id": 17030, "count": 99999999 }, - { "id": 17031, "count": 99999999 }, - { "id": 17032, "count": 99999999 }, - { "id": 17033, "count": 99999999 }, - { "id": 17037, "count": 99999999 }, - { "id": 17038, "count": 99999999 }, - { "id": 17039, "count": 99999999 }, - { "id": 17040, "count": 99999999 }, - { "id": 17041, "count": 99999999 }, - { "id": 17042, "count": 99999999 }, - { "id": 17043, "count": 99999999 }, - { "id": 17044, "count": 99999999 }, - { "id": 17045, "count": 99999999 }, - { "id": 17046, "count": 99999999 }, - { "id": 17047, "count": 99999999 }, - { "id": 17048, "count": 99999999 }, - { "id": 17049, "count": 99999999 }, - { "id": 17050, "count": 99999999 }, - { "id": 17051, "count": 99999999 }, - { "id": 17052, "count": 99999999 }, + { "id": 11004, "count": 5000 }, + { "id": 11013, "count": 99 }, + { "id": 11014, "count": 99 }, + { "id": 11015, "count": 99 }, + { "id": 11003, "count": 2000 }, + { "id": 17001, "count": 500 }, + { "id": 17002, "count": 99 }, + { "id": 17003, "count": 500 }, + { "id": 17004, "count": 500 }, + { "id": 17005, "count": 500 }, + { "id": 17006, "count": 500 }, + { "id": 17007, "count": 500 }, + { "id": 17008, "count": 500 }, + { "id": 17009, "count": 500 }, + { "id": 17010, "count": 500 }, + { "id": 17011, "count": 500 }, + { "id": 17012, "count": 500 }, + { "id": 17013, "count": 500 }, + { "id": 17014, "count": 500 }, + { "id": 17015, "count": 500 }, + { "id": 17016, "count": 500 }, + { "id": 17017, "count": 500 }, + { "id": 17018, "count": 500 }, + { "id": 17019, "count": 500 }, + { "id": 17020, "count": 500 }, + { "id": 17021, "count": 500 }, + { "id": 17022, "count": 500 }, + { "id": 17023, "count": 500 }, + { "id": 17024, "count": 500 }, + { "id": 17025, "count": 500 }, + { "id": 17026, "count": 500 }, + { "id": 17027, "count": 500 }, + { "id": 17028, "count": 500 }, + { "id": 17029, "count": 500 }, + { "id": 17030, "count": 500 }, + { "id": 17031, "count": 500 }, + { "id": 17032, "count": 500 }, + { "id": 17033, "count": 500 }, + { "id": 17037, "count": 500 }, + { "id": 17038, "count": 500 }, + { "id": 17039, "count": 500 }, + { "id": 17040, "count": 500 }, + { "id": 17041, "count": 500 }, + { "id": 17042, "count": 500 }, + { "id": 17043, "count": 500 }, + { "id": 17044, "count": 500 }, + { "id": 17045, "count": 500 }, + { "id": 17046, "count": 500 }, + { "id": 17047, "count": 500 }, + { "id": 17048, "count": 500 }, + { "id": 17049, "count": 500 }, + { "id": 17050, "count": 500 }, + { "id": 17051, "count": 500 }, + { "id": 17052, "count": 500 }, { "id": 21018, "count": 3000 }, { "id": 21019, "count": 3000 }, @@ -100,17 +100,9 @@ export const DEFAULT_ITEMS = [ { "id": 21032, "count": 3000 }, { "id": 21046, "count": 3000 }, - { "id": 42083, "count": 9999 }, - { "id": 42084, "count": 9999 }, - { "id": 42085, "count": 9999 }, - { "id": 42086, "count": 9999 }, - { "id": 42087, "count": 9999 }, - { "id": 42088, "count": 9999 }, - { "id": 42176, "count": 9999 }, - { "id": 42177, "count": 9999 }, - { "id": 42178, "count": 9999 }, - { "id": 42179, "count": 9999 }, - { "id": 42180, "count": 9999 }, + { "id": 42176, "count": 200 }, + { "id": 42175, "count": 200 }, + { "id": 42126, "count": 200 }, { "id": 50059, "count": 1 }, { "id": 50060, "count": 1 }, { "id": 50061, "count": 1 }, @@ -122,95 +114,55 @@ export const DEFAULT_ITEMS = [ { "id": 50108, "count": 1 }, { "id": 50109, "count": 1 }, - { "id": 60001, "count": 8888888 }, - { "id": 60002, "count": 8888888 }, - { "id": 60003, "count": 8888888 }, - { "id": 60004, "count": 8888888 }, - { "id": 60005, "count": 8888888 }, - { "id": 60006, "count": 8888888 }, - { "id": 60007, "count": 8888888 }, - { "id": 60008, "count": 8888888 }, - { "id": 60009, "count": 8888888 }, - { "id": 60011, "count": 8888888 }, - { "id": 60012, "count": 8888888 }, - { "id": 60013, "count": 8888888 }, - { "id": 60014, "count": 8888888 }, - { "id": 60015, "count": 8888888 }, - { "id": 60016, "count": 8888888 }, - { "id": 60017, "count": 8888888 }, - { "id": 60018, "count": 8888888 }, - { "id": 60019, "count": 8888888 }, - { "id": 60021, "count": 8888888 }, - { "id": 60022, "count": 8888888 }, - { "id": 60023, "count": 8888888 }, - { "id": 60024, "count": 8888888 }, - { "id": 60025, "count": 8888888 }, - { "id": 60026, "count": 8888888 }, - { "id": 60027, "count": 8888888 }, - { "id": 60028, "count": 8888888 }, - { "id": 60029, "count": 8888888 }, - { "id": 60031, "count": 8888888 }, - { "id": 60032, "count": 8888888 }, - { "id": 60033, "count": 8888888 }, - { "id": 60034, "count": 8888888 }, - { "id": 60035, "count": 8888888 }, - { "id": 60036, "count": 8888888 }, - { "id": 60037, "count": 8888888 }, - { "id": 60038, "count": 8888888 }, - { "id": 60039, "count": 8888888 }, - { "id": 60041, "count": 8888888 }, - { "id": 60042, "count": 8888888 }, - { "id": 60043, "count": 8888888 }, - { "id": 60044, "count": 8888888 }, - { "id": 60045, "count": 8888888 }, - { "id": 60046, "count": 8888888 }, - { "id": 60047, "count": 8888888 }, - { "id": 60048, "count": 8888888 }, - { "id": 60049, "count": 8888888 }, - { "id": 60051, "count": 8888888 }, - { "id": 60052, "count": 8888888 }, - { "id": 60053, "count": 8888888 }, - { "id": 60054, "count": 8888888 }, - { "id": 60055, "count": 8888888 }, - { "id": 60056, "count": 8888888 }, - { "id": 60057, "count": 8888888 }, - { "id": 60058, "count": 8888888 }, - { "id": 60059, "count": 8888888 }, - { "id": 60060, "count": 8888888 }, + { "id": 60001, "count": 500 }, + { "id": 60002, "count": 100 }, + { "id": 60004, "count": 100 }, + { "id": 60005, "count": 100 }, + { "id": 60006, "count": 100 }, + { "id": 60007, "count": 100 }, + { "id": 60008, "count": 88 }, + { "id": 60009, "count": 88 }, + { "id": 60011, "count": 88 }, + { "id": 60012, "count": 88 }, + { "id": 60013, "count": 88 }, + { "id": 60014, "count": 88 }, + { "id": 60015, "count": 88 }, + { "id": 60016, "count": 88 }, + { "id": 60017, "count": 88 }, + { "id": 60018, "count": 888 }, + { "id": 60019, "count": 888 }, + { "id": 60021, "count": 888 }, + { "id": 60033, "count": 888 }, + { "id": 60034, "count": 888 }, + { "id": 60037, "count": 88 }, + { "id": 60038, "count": 88 }, + { "id": 60039, "count": 100 }, + { "id": 60041, "count": 100 }, + { "id": 60042, "count": 88 }, + { "id": 60043, "count": 88 }, + { "id": 60044, "count": 88 }, + { "id": 60051, "count": 100 }, + { "id": 60054, "count": 100 }, + { "id": 60055, "count": 88 }, + { "id": 60056, "count": 88 }, + { "id": 60059, "count": 88 }, + { "id": 60060, "count": 88 }, ]; export const DEFAULT_EQUIPS = [ { "id": 8, "count": 1 }, - { "id": 108, "count": 1 }, - { "id": 208, "count": 1 }, + { "id": 25, "count": 1 }, { "id": 308, "count": 1 }, { "id": 408, "count": 1 }, - { "id": 508, "count": 1 }, - { "id": 608, "count": 1 }, - { "id": 708, "count": 1 }, + { "id": 505, "count": 1 }, + { "id": 607, "count": 1 }, + { "id": 707, "count": 1 }, { "id": 2008, "count": 1 }, - { "id": 2108, "count": 1 }, { "id": 2208, "count": 1 }, { "id": 3008, "count": 1 }, - { "id": 3108, "count": 1 }, + { "id": 3201, "count": 1 }, { "id": 3208, "count": 1 }, { "id": 4008, "count": 1 }, - { "id": 4108, "count": 1 }, - { "id": 4208, "count": 1 }, - { "id": 5008, "count": 1 }, - { "id": 5108, "count": 1 }, - { "id": 5208, "count": 1 }, - { "id": 6008, "count": 1 }, - { "id": 6108, "count": 1 }, - { "id": 6208, "count": 1 }, - { "id": 26, "count": 1 }, - { "id": 126, "count": 1 }, - { "id": 226, "count": 1 }, - { "id": 326, "count": 1 }, - { "id": 426, "count": 1 }, - { "id": 526, "count": 1 }, - { "id": 626, "count": 1 }, - { "id": 726, "count": 1 }, { "id": 2026, "count": 1 }, { "id": 2126, "count": 1 }, { "id": 2226, "count": 1 }, @@ -219,13 +171,9 @@ export const DEFAULT_EQUIPS = [ { "id": 3226, "count": 1 }, { "id": 4026, "count": 1 }, { "id": 4126, "count": 1 }, - { "id": 4226, "count": 1 }, - { "id": 5026, "count": 1 }, + { "id": 5025, "count": 1 }, { "id": 5126, "count": 1 }, - { "id": 5226, "count": 1 }, { "id": 6026, "count": 1 }, - { "id": 6126, "count": 1 }, - { "id": 6226, "count": 1 }, ]; export const DEFAULT_GOLD = 9999999999; export const DEFAULT_COIN = 9999999999;