| | |
| | | import PlayerFB
|
| | | import SkillShell
|
| | | import PlayerYinji
|
| | | import GameObj
|
| | |
|
| | | import datetime
|
| | | import time
|
| | |
| | | Sync_DBPlayer(curPlayer)
|
| | |
|
| | | # 死亡复活
|
| | | if curPlayer.GetHP() <=0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
| | | if GameObj.GetHP(curPlayer) <=0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
| | | PlayerRebornByType(curPlayer, ChConfig.rebornType_System, tick)
|
| | |
|
| | | # 强刷一次属性,刷之前重置还没同步过所有属性
|
| | |
| | | dbPlayer.RebornPosY = curPlayer.GetRebornPosY()
|
| | | dbPlayer.State = curPlayer.GetState()
|
| | | dbPlayer.HP = curPlayer.GetHP()
|
| | | dbPlayer.HPEx = curPlayer.GetHPEx()
|
| | | dbPlayer.XP = curPlayer.GetXP()
|
| | | dbPlayer.HPRestoreSetting = curPlayer.GetHPRestoreSetting()
|
| | | dbPlayer.MPRestoreSetting = curPlayer.GetMPRestoreSetting()
|
| | |
| | | curPlayer.SetFacePic(0) # 通知数据库是否保存还是下线,做一次恢复,1为保存 0为正常下线
|
| | | tjgTime = PlayerTJG.GetTJGTime(curPlayer)
|
| | | if tjgTime:
|
| | | curPlayer.SendGameServerRefreshState(IPY_GameWorld.CDBPlayerRefresh_HappyPoint, tjgTime)
|
| | | PlayerControl.SendGameServerRefreshState(curPlayer, IPY_GameWorld.CDBPlayerRefresh_HappyPoint, tjgTime)
|
| | |
|
| | | PlayerControl.DoGMForbidenTalkOnLogin(curPlayer)
|
| | |
|
| | |
| | | # #刷新NPC状态/buff
|
| | | # summonControl.RefreshNPCState()
|
| | | # #因当前血量先刷,最大血量后刷,有可能当前血量大于最大血量
|
| | | # curSummon.SetHP(min(curSummon.GetHP() , curSummon.GetMaxHP()))
|
| | | # GameObj.SetHPFull(curSummon)
|
| | | #===========================================================================
|
| | |
|
| | | #初始化宠物 通知客户端
|
| | |
| | | curPlayer.SetVisible(True)
|
| | |
|
| | | #如果玩家hp为0,设置玩家为死亡状态
|
| | | if curPlayer.GetHP() <= 0:
|
| | | if GameObj.GetHP(curPlayer) <= 0:
|
| | | curPlayer.SetPlayerAction(IPY_GameWorld.paDie)
|
| | | #curPlayer.SetDead()
|
| | |
|
| | |
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 0)
|
| | |
|
| | | if curPlayer.GetHP() <= 0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
| | | if GameObj.GetHP(curPlayer) <= 0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
| | | #如果玩家上线后死亡,回程复活
|
| | | isLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LoadMapIsLogin)
|
| | | rebornType = ChConfig.rebornType_City if isLogin else ChConfig.rebornType_System
|
| | |
| | | #无法验证目标
|
| | | #===========================================================================
|
| | | # curTag = GameWorld.GetObj(clientData.ObjID, IPY_GameWorld.gotNPC)
|
| | | # if not curTag or curTag.GetHP() ==0:
|
| | | # if not curTag or GameObj.GetHP(curTag) ==0:
|
| | | # return
|
| | | #
|
| | | # #与目标相差太远
|
| | |
| | | return False
|
| | |
|
| | | #玩家已经死亡
|
| | | if curPlayer.GetHP() <= 0:
|
| | | if GameObj.GetHP(curPlayer) <= 0:
|
| | | return False
|
| | |
|
| | | # #眩晕时,不可移动 zhengyang 2010-6-2
|
| | |
| | | # curObj = mapObj.GetObjByIndex(i)
|
| | | # #只有一种情况特殊:死亡的NPC可以让玩家走过去
|
| | | # if curObj.GetGameObjType() == IPY_GameWorld.gotNPC and \
|
| | | # curObj.GetHP() <= 0 :
|
| | | # GameObj.GetHP(curObj) <= 0 :
|
| | | # continue
|
| | | # curPlayer.MoveFail()
|
| | | # GameWorld.Log("移动失败,目标点有玩家或者NPC")
|
| | |
| | | # #获取玩家详细信息成功
|
| | | # if canGetDetail:
|
| | | # extendDataDict = {}
|
| | | # extendDataDict['maxHP'] = tagObj.GetMaxHP()
|
| | | # extendDataDict['maxHP'] = GameObj.GetMaxHP(tagObj)
|
| | | # extendDataDict['maxMP'] = tagObj.GetMaxMP()
|
| | | # extendDataDict['hit'] = tagObj.GetHit()
|
| | | # extendDataDict['miss'] = tagObj.GetMiss()
|
| | |
| | | #功能开启判断换成
|
| | | #GameFuncComm.GetFuncCanUse(curPlayer, funcID)
|
| | |
|
| | | if curPlayer.GetHP() <= 0:
|
| | | if GameObj.GetHP(curPlayer) <= 0:
|
| | | return
|
| | | sendPack = IPY_GameWorld.IPY_CSit()
|
| | | setType = sendPack.GetType()
|
| | |
| | | return
|
| | | curPlayer.SetHPRestoreSetting(curValue)
|
| | | #玩家活着的时候调用
|
| | | if curPlayer.GetHP() > 0 :
|
| | | if GameObj.GetHP(curPlayer) > 0 :
|
| | | #调用自动回血
|
| | | PlayerControl.PlayerAutoRestoreHP(curPlayer, tick)
|
| | | return
|
| | |
| | | curPlayer.SetMPRestoreSetting(curValue)
|
| | |
|
| | | #玩家活着的时候调用
|
| | | if curPlayer.GetHP() > 0 :
|
| | | if GameObj.GetHP(curPlayer) > 0 :
|
| | | #调用自动回魔
|
| | | PlayerControl.PlayerAutoRestoreMP(curPlayer, tick)
|
| | |
|
| | |
| | | #游戏事件 Type = TGameEvent
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | |
|
| | | if curPlayer.GetHP() == 0:
|
| | | if GameObj.GetHP(curPlayer) == 0:
|
| | | #GameWorld.Log("玩家死亡,没有事件")
|
| | | return
|
| | |
|
| | |
| | | if tick - curPlayer.GetShowFaceTick() < ChConfig.Def_ShowEventTime:
|
| | | return
|
| | |
|
| | | if curPlayer.GetHP() <= 0:
|
| | | if GameObj.GetHP(curPlayer) <= 0:
|
| | | return
|
| | |
|
| | | #表情行为, 客户端限制
|
| | |
| | | #GameWorld.Log("玩家地图读取没有成功")
|
| | | return
|
| | |
|
| | | if curPlayer.GetHP() == 0:
|
| | | if GameObj.GetHP(curPlayer) == 0:
|
| | | #玩家已经死亡
|
| | | #GameWorld.Log("玩家停止移动,玩家已经死亡")
|
| | | return
|
| | |
| | | # #找到这个召唤兽
|
| | | # summonNPC = curPlayer.FindSummonByID(summonID)
|
| | | # #无法查找到这个召唤兽
|
| | | # if summonNPC == None or summonNPC.GetHP() <= 0:
|
| | | # if summonNPC == None or GameObj.GetHP(summonNPC) <= 0:
|
| | | # GameWorld.Log('无法查找到这个召唤兽 summonID=%d'%summonID)
|
| | | # return
|
| | | #
|
| | |
| | | # #找到这个召唤兽
|
| | | # summonNPC = curPlayer.FindSummonByID(summonID)
|
| | | # #无法查找到这个召唤兽
|
| | | # if summonNPC == None or summonNPC.GetHP() <= 0:
|
| | | # if summonNPC == None or GameObj.GetHP(summonNPC) <= 0:
|
| | | # GameWorld.Log('找不到召唤兽')
|
| | | # return
|
| | | #
|
| | |
| | | # summonNPC = curPlayer.FindSummonByID(summonID)
|
| | | #
|
| | | # #无法查找到这个召唤兽
|
| | | # if summonNPC == None or summonNPC.GetHP() <= 0:
|
| | | # if summonNPC == None or GameObj.GetHP(summonNPC) <= 0:
|
| | | # return
|
| | | #
|
| | | # if ChConfig.Def_ClientControlSummonNPCID.count(summonNPC.GetFunctionType()) == 0:
|
| | |
| | | '''
|
| | |
|
| | | # 非死亡状态下,也就是哪个服务器角色死亡由哪个服务器判断
|
| | | if curPlayer.GetHP() > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
|
| | | if GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
|
| | | return 0
|
| | |
|
| | | # 回城复活的才需要CD
|
| | |
| | | 本函数不验证玩家死亡状态等,因为有可能前后端复活状态不一致,如果这里拦住可能导致前端躺尸复活不了
|
| | | '''
|
| | |
|
| | | if checkHPState and curPlayer.GetHP() > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
|
| | | if checkHPState and GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
|
| | | # 当血量大于0收到复活请求时,一般是前后端复活状态不一致的情况下导致的
|
| | | # 由于前端需要根据复活状态判断复活界面相关逻辑,所以这里需要做一些特殊处理,防止某些情况下前后端复活状态不一致导致的一些异常问题
|
| | | # 后端非死亡状态的情况,补同步一次复活包给前端
|
| | |
| | | playerControl.RefreshAllState()
|
| | |
|
| | | #设置血量
|
| | | curPlayer.SetHP(curPlayer.GetMaxHP() * resetHpPercent / ChConfig.Def_MaxRateValue)
|
| | | GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer) * resetHpPercent / ChConfig.Def_MaxRateValue)
|
| | | #curPlayer.SetMP(curPlayer.GetMaxMP() * resetMpPercent / ChConfig.Def_MaxRateValue)
|
| | | #护盾
|
| | | PlayerControl.SetProDef(curPlayer, PlayerControl.GetMaxProDef(curPlayer))
|
| | |
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD LostHP;
|
| | | # DWORD LostHPEx;
|
| | | #};
|
| | | def OnRoleLostHP(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | lostHP = clientData.LostHP
|
| | | curHP = curPlayer.GetHP()
|
| | | lostHP = clientData.LostHP + clientData.LostHPEx * ShareDefine.Def_PerPointValue
|
| | | curHP = GameObj.GetHP(curPlayer)
|
| | | updHP = curHP - lostHP
|
| | | if updHP <= 0:
|
| | | #玩家已经死亡
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.SetDead()
|
| | | else:
|
| | | curPlayer.SetHP(updHP)
|
| | | GameObj.SetHP(curPlayer, updHP)
|
| | |
|
| | | return
|