fix:离线挂时间没有正常运作或者维护期间程序未运行,则在上线时不是在离线死亡的情况下,弥补以当前经验倍率错过的离线收益,扣除对应离线时间,不扣除经验BUFF时间
| | |
| | | try:
|
| | | gmCmd = IPY_GameServer.IPY_GGMCmd()
|
| | | inputStr = gmCmd.GetMsg()
|
| | | list = inputStr.split()
|
| | | if len(list) == 0:
|
| | | alist = inputStr.split()
|
| | | if len(alist) == 0:
|
| | | return
|
| | |
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | |
|
| | | callFunName = list[0]
|
| | | callFunName = alist[0]
|
| | | # 特殊的命令不验证GM等级,在MapServer已验证账号
|
| | | if callFunName.startswith("@"):
|
| | | callFunName = "GMS_%s" % (callFunName[1:].capitalize())
|
| | |
| | | callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnGetMergeParam"))
|
| | | if callFunc != None:
|
| | | extendParamList = callFunc(curPlayer)
|
| | | list.extend(extendParamList)
|
| | | MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_SendGMCMD, list)
|
| | | alist.extend(extendParamList)
|
| | | MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_SendGMCMD, alist)
|
| | | return
|
| | |
|
| | | callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnExec"))
|
| | |
| | | return
|
| | |
|
| | | #删除命令,只将参数传入
|
| | | del list[0]
|
| | | del alist[0]
|
| | | #把剩余参数转换为整型
|
| | | for i in range(0, len(list)):
|
| | | if i == 0 and callFunName in ["testMail", "SetPlayerDBGSEvent"]:
|
| | | for i in range(0, len(alist)):
|
| | | if not alist[i].isdigit():
|
| | | continue
|
| | | value = GameWorld.ToIntDef(list[i], None)
|
| | | value = GameWorld.ToIntDef(alist[i], None)
|
| | | if value == None:
|
| | | GameWorld.DebugAnswer(curPlayer, "参数错误, 参数%s必须为纯数字!" % (i + 1))
|
| | | return
|
| | | list[i] = value
|
| | | alist[i] = value
|
| | |
|
| | | callFunc(curPlayer,list)
|
| | | callFunc(curPlayer,alist)
|
| | |
|
| | | except BaseException:
|
| | | GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看GameServer日志!")
|
| | | errorMsg = str(traceback.format_exc())
|
| | | GameWorld.ErrLog('GM命令错误 - > %s'%(errorMsg) , curPlayer.GetPlayerID())
|
| | | if GameWorld.GetGameWorld().GetDebugLevel():
|
| | | raise BaseException(errorMsg)
|
| | | #=======================================================================
|
| | | # if GameWorld.GetGameWorld().GetDebugLevel():
|
| | | # raise BaseException(errorMsg)
|
| | | #=======================================================================
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | |
| | | del inputList[0]
|
| | | #把剩余参数转换为整型
|
| | | for i in range(0, len(inputList)):
|
| | | if i == 0 and callFunName in ["GetPlayerDict", "SetPlayerDict", "CTG"]:
|
| | | if not inputList[i].isdigit():
|
| | | continue
|
| | | if i == 1 and callFunName in ["SetMissionDict"]:
|
| | | continue
|
| | | |
| | | value = GameWorld.ToIntDef(inputList[i], None)
|
| | | if value == None:
|
| | | GameWorld.DebugAnswer(curPlayer, "参数错误, 必须为纯数字!")
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看所在地图日志!")
|
| | | errorMsg = str(traceback.format_exc())
|
| | | GameWorld.ErrLog('GM命令错误 - > %s' % errorMsg, curPlayer.GetPlayerID())
|
| | | if GameWorld.GetGameWorld().GetDebugLevel():
|
| | | raise Exception(errorMsg)
|
| | | #if GameWorld.GetGameWorld().GetDebugLevel():
|
| | | # raise Exception(errorMsg)
|
| | | return
|
| | |
|
| | | ## 使用GM命令流向
|
| | |
| | | ("DWORD", "NeedPoint", 0),
|
| | | ("dict", "Award", 0),
|
| | | ),
|
| | |
|
| | | "MapEventPoint":(
|
| | | ("DWORD", "MapID", 1),
|
| | | ("DWORD", "NPCID", 1),
|
| | | ("WORD", "LowLV", 0),
|
| | | ("WORD", "HighestLV", 0),
|
| | | ("DWORD", "Defense", 0),
|
| | | ),
|
| | | }
|
| | |
|
| | | |
| | |
| | | def GetNeedPoint(self): return self.NeedPoint # 需要点数
|
| | | def GetAward(self): return self.Award # 奖励 {"职业":[[物品ID,个数,是否绑定],...], ...} |
| | |
|
| | | # 地图NPC配置表-挂机点 |
| | | class IPY_MapEventPoint(): |
| | | |
| | | def __init__(self): |
| | | self.MapID = 0
|
| | | self.NPCID = 0
|
| | | self.LowLV = 0
|
| | | self.HighestLV = 0
|
| | | self.Defense = 0 |
| | | return |
| | | |
| | | def GetMapID(self): return self.MapID
|
| | | def GetNPCID(self): return self.NPCID
|
| | | def GetLowLV(self): return self.LowLV # 推荐最低等级
|
| | | def GetHighestLV(self): return self.HighestLV # 推荐最高等级
|
| | | def GetDefense(self): return self.Defense # 推荐防御 |
| | |
|
| | |
|
| | | def Log(msg, playerID=0, par=0):
|
| | | LogUI.Msg("%s\t%s\t%s" % (par, playerID, msg))
|
| | |
| | | self.ipyAllPeoplePartyLen = len(self.ipyAllPeoplePartyCache)
|
| | | self.ipyAllPeoplePartyAwardCache = self.__LoadFileData("AllPeoplePartyAward", IPY_AllPeoplePartyAward)
|
| | | self.ipyAllPeoplePartyAwardLen = len(self.ipyAllPeoplePartyAwardCache)
|
| | | self.ipyMapEventPointCache = self.__LoadFileData("MapEventPoint", IPY_MapEventPoint)
|
| | | self.ipyMapEventPointLen = len(self.ipyMapEventPointCache)
|
| | | Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
|
| | | Log("IPY_DataMgr InitOK!")
|
| | | return
|
| | |
| | | def GetAllPeoplePartyByIndex(self, index): return self.ipyAllPeoplePartyCache[index]
|
| | | def GetAllPeoplePartyAwardCount(self): return self.ipyAllPeoplePartyAwardLen
|
| | | def GetAllPeoplePartyAwardByIndex(self, index): return self.ipyAllPeoplePartyAwardCache[index]
|
| | | def GetMapEventPointCount(self): return self.ipyMapEventPointLen
|
| | | def GetMapEventPointByIndex(self, index): return self.ipyMapEventPointCache[index]
|
| | |
|
| | | IPYData = IPY_DataMgr()
|
| | | def IPY_Data(): return IPYData
|
| | |
| | | import PlayerPet
|
| | | import PlayerGeTui
|
| | | import ChEquip
|
| | | import QuestCommon
|
| | |
|
| | |
|
| | | # 可吞噬的装备位
|
| | |
| | | if curPlayer.GetIP() == "127.0.0.1":
|
| | | return
|
| | |
|
| | | # 脱机挂没有运作情况下 弥补收益
|
| | | LoginFixTJG(curPlayer)
|
| | | |
| | | times = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Time, 0, ChConfig.Def_PDictType_TJGNotify)
|
| | | if times == 0:
|
| | | return
|
| | |
| | | ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_City, tick)
|
| | | curPlayer.Kick(IPY_GameWorld.disMapCopyFull) # 随便记录一个死亡
|
| | | return
|
| | |
|
| | |
|
| | | # 上线检查脱机时间是否正常运行, 弥补对应缺失时间,如维护2小时缺失的脱机挂收益
|
| | | # 1. 非脱机死亡,2.存在脱机时间,3.离线时间超过5分钟;则一次补齐 离线时间-5分钟的收益并减少脱机时间
|
| | | # 按当前经验倍率计算,且不会减buff时间
|
| | | # 找到对应的NPC,需读取对应挂机表
|
| | | def LoginFixTJG(curPlayer):
|
| | | # 外层需判断是真实玩家登录
|
| | | tjgTime = GetTJGTime(curPlayer) # 秒
|
| | | if not tjgTime:
|
| | | return
|
| | | |
| | | if curPlayer.GetState() == 2:
|
| | | # 玩家脱机死亡不处理
|
| | | GameWorld.DebugLog("脱机死亡玩家不做时差补偿。")
|
| | | return
|
| | |
|
| | | |
| | | # 超过5分钟部分补偿
|
| | | seconds = PlayerControl.GetPlayerLeaveServerSecond(curPlayer) - 300
|
| | | if seconds <= 0:
|
| | | return
|
| | | times = min(seconds, tjgTime)
|
| | |
|
| | | npcID = FindTJGNPC(curPlayer)
|
| | | if not npcID:
|
| | | return
|
| | | |
| | | GameWorld.DebugLog("弥补脱机----npcid %s-%s"%(npcID, times))
|
| | | |
| | | # 此时由服务端重新找一次挂机NPC
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)
|
| | | |
| | | # 设置脱机登录时的等级, 上线通知清空, 没清空说明多次脱机挂登录 使用旧等级
|
| | | notifyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)
|
| | | if not notifyLV:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_LV, curPlayer.GetLV(), ChConfig.Def_PDictType_TJGNotify)
|
| | | |
| | | |
| | | # 记录秒单位
|
| | | NoteTJGTime(curPlayer, times)
|
| | | SetTJGTime(curPlayer, max(tjgTime - times, 0))
|
| | | |
| | | OnTJGKillNPCByTimes(curPlayer, times)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | | def FindTJGNPC(curPlayer):
|
| | | # 1.找到对应等级点,判断任务是否完成,与策划约定挂机地图ID10000开头
|
| | | # 3.找到可以进入的野外地图后,根据等级防御在此地图挂机
|
| | | |
| | | missionMapStep = GetMissionMapStep(curPlayer)
|
| | | |
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | |
|
| | | maxMapID = 0
|
| | | # ---找到可以挂机的最高级地图---
|
| | | for i in xrange(ipyDataMgr.GetMapEventPointCount()):
|
| | | mapInfo = ipyDataMgr.GetMapEventPointByIndex(i)
|
| | | mapID = mapInfo.GetMapID()
|
| | | if mapID/10000 != 1:
|
| | | # 非野外地图
|
| | | continue
|
| | | |
| | | # ---判断地图表的任务和等级限制---
|
| | | mapData = GameWorld.GetGameData().GetChinMap().GetMapByID(mapID)
|
| | | if not mapData:
|
| | | continue |
| | | enterLV = mapData.GetLV()
|
| | | |
| | | if curPlayer.GetLV() < enterLV:
|
| | | continue
|
| | | openMapStep = mapData.GetTreasureID() #需要完成的主线任务ID
|
| | | if missionMapStep < openMapStep:
|
| | | continue
|
| | |
|
| | | if mapID < maxMapID:
|
| | | continue
|
| | | maxMapID = mapID
|
| | | |
| | | if not maxMapID:
|
| | | return 0
|
| | | |
| | | # ---找到挂机等级点---
|
| | | lv = curPlayer.GetLV()
|
| | | myPoint = None
|
| | | mapList = IpyGameDataPY.GetIpyGameDataByCondition("MapEventPoint", {"MapID":maxMapID}, True)
|
| | |
|
| | | mapEffList = [] # 有效挂机点,同地图中存在不需要挂机的NPC点
|
| | | for mapInfo in mapList:
|
| | | if mapInfo.GetLowLV() == 0:
|
| | | continue
|
| | | |
| | | mapEffList.append(mapInfo)
|
| | | |
| | | if lv >= mapInfo.GetLowLV():
|
| | | if myPoint and myPoint.GetLowLV() >= mapInfo.GetLowLV():
|
| | | continue
|
| | | myPoint = mapInfo
|
| | |
|
| | | if not mapEffList:
|
| | | return 0
|
| | | |
| | | # ---根据防御上下调整
|
| | | if not myPoint:
|
| | | # 寻找异常取最低点
|
| | | return mapEffList[0].GetNPCID()
|
| | | |
| | | pointLen = len(mapEffList)
|
| | | defense = curPlayer.GetDef()
|
| | | pIndex = mapEffList.index(myPoint)
|
| | | if defense >= mapEffList[min(pointLen-1, pIndex+1)].GetDefense():
|
| | | # 高一级
|
| | | return mapEffList[min(pointLen-1, pIndex+1)].GetNPCID()
|
| | |
|
| | | if defense < myPoint.GetDefense():
|
| | | # 低一级
|
| | | return mapEffList[max(0, pIndex-1)].GetNPCID()
|
| | | |
| | | return myPoint.GetNPCID()
|
| | |
|
| | |
|
| | | |
| | | |
| | | def GetMissionMapStep(curPlayer):
|
| | | # 主线任务完成时会设置标志可进地图标志
|
| | | mission_1 = QuestCommon.GetCommonMission(curPlayer)
|
| | | if not mission_1:
|
| | | return 0
|
| | | return mission_1.GetProperty("OpenMap")
|
| | |
|
| | |
|