| | |
| | | import ItemCommon
|
| | | import OperControlManager
|
| | | import ShareDefine
|
| | | import PlayerProduce
|
| | | import PlayerAutoCheckOnline
|
| | | import PlayerGameWallow
|
| | | import ReadChConfig
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import DataRecordPack
|
| | | import PlayerViewCacheTube
|
| | | import PlayerDienstgrad
|
| | | import PlayerVip
|
| | |
| | | import PlayerTJG
|
| | | import AICommon
|
| | | import PlayerSuccess
|
| | | import CrossPlayerData
|
| | | import PassiveBuffEffMng
|
| | | import PlayerFamilyRedPacket
|
| | | import FunctionNPCCommon
|
| | | import FormulaControl
|
| | | import PlayerGoldGift
|
| | | import PlayerFlashSale
|
| | | import PlayerWing
|
| | | import ChEquip
|
| | | import PlayerYinji
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #---------------------------------------------------------------------
|
| | |
| | | if not __DoClientUseSkillEx(curPlayer, useSkillData, tick):
|
| | | SkillShell.AttackFailNotify(curPlayer, useSkillData)
|
| | | GameWorld.DebugLog("----攻击失败 可能是技能CD %s"%skillTypeID)
|
| | | |
| | | # 根据策划需求 以客户端动作为标准,不可攻击状态也进入CD
|
| | | BaseAttack.Sync_AttackResult(curPlayer, useSkillData)
|
| | | |
| | | if useSkillData and useSkillData.GetSkillID() != ChConfig.Def_SkillID_Somersault:
|
| | | # 跟随玩家同频率攻击
|
| | | PetControl.PetFight(curPlayer, tick)
|
| | |
| | | elif prepareState == IPY_GameWorld.pstMissionCollecting:
|
| | | #任务采集
|
| | | PlayerMissionCollect.EndMissionCollect(curPlayer, tick)
|
| | |
|
| | | elif prepareState == ShareDefine.Def_PstProduce:
|
| | | #生产采集(进入生产采集状态,不再重置玩家状态)
|
| | | PlayerProduce.OnProduceEnd(curPlayer, tick)
|
| | | return
|
| | |
|
| | | elif prepareState == ShareDefine.Def_PstTrans:
|
| | |
|
| | |
| | | return
|
| | | FBLogic.OnCollecting(curPlayer, tick)
|
| | | npcID = curNPC.GetNPCID()
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CollectNPC", npcID)
|
| | | if collectNPCIpyData:
|
| | | DoCollectingLostHP(curPlayer, collectNPCIpyData, tick, False)
|
| | | return
|
| | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_CollectLostHPTick, tick)
|
| | | lostValue = int(GameObj.GetMaxHP(curPlayer) * lostHPPer / 100.0) * lostTime
|
| | | skillTypeID, buffOwner = 0, None
|
| | | SkillCommon.SkillLostHP(curPlayer, skillTypeID, buffOwner, lostValue, tick)
|
| | | SkillCommon.SkillLostHP(curPlayer, skillTypeID, buffOwner, lostValue, tick, skillAffect=False)
|
| | | GameWorld.DebugLog("采集掉血: npcID=%s,lostHPPer=%s,lostTime=%s,lostValue=%s" % (collectNPCIpyData.GetNPCID(), lostHPPer, lostTime, lostValue))
|
| | | return
|
| | |
|
| | |
| | | # @remarks 刷新以单位时间(分钟)消耗耐久的物品
|
| | | def ProcessRefreshTimeItem(curPlayer, tick):
|
| | | reFlash = False
|
| | |
|
| | | |
| | | #2分钟遍历一次,时效道具时间到不消失,
|
| | | if tick - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_EquipTime) \
|
| | | < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_TimeItem] :
|
| | | < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_TimeItem]:
|
| | | return reFlash
|
| | | #耐久减少值/分钟
|
| | | reFlash = ProcessTimeEquip(curPlayer, tick)
|
| | |
|
| | | |
| | | return reFlash
|
| | |
|
| | |
|
| | |
| | | # @return None
|
| | | # @remarks 玩家自动回复XP值
|
| | | def ProcessAddXP(curPlayer, tick):
|
| | | #开放等级增加多少XP值, 最大XP值
|
| | | openLV, addXPValue, maxXPValue = ReadChConfig.GetEvalChConfig('PlayerXP')
|
| | | #还没到开放等级
|
| | | if openLV > curPlayer.GetLV():
|
| | | return
|
| | | lastTick = curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_AddXPTick)
|
| | | if not CommonCheckTick(curPlayer, tick, ChConfig.TYPE_Player_Tick_AddXPTick):
|
| | | #首次登陆,将当前的XP值记录到字典中
|
| | | if lastTick <= 0:
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, curPlayer.GetXP())
|
| | | return
|
| | | |
| | | #从字典中获取当前的XP值
|
| | | curXPValue = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue)
|
| | | #当前XP值已经是最大值了,不做处理
|
| | | if curXPValue == maxXPValue:
|
| | | return
|
| | | xpRestorePer = PlayerControl.GetXPRestorePer(curPlayer)
|
| | | addXPValue = int(addXPValue * xpRestorePer/float(ChConfig.Def_MaxRateValue))
|
| | | nextXPValue = min(curXPValue + addXPValue, maxXPValue)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, nextXPValue)
|
| | | #已经达到最大的XP值了,通知客户端
|
| | | if nextXPValue == maxXPValue:
|
| | | #这里进行设置的时候,将会通知客户端
|
| | | curPlayer.SetXP(nextXPValue)
|
| | | return
|
| | | #===========================================================================
|
| | | # #开放等级增加多少XP值, 最大XP值
|
| | | # openLV, addXPValue, maxXPValue = ReadChConfig.GetEvalChConfig('PlayerXP')
|
| | | # #还没到开放等级
|
| | | # if openLV > curPlayer.GetLV():
|
| | | # return
|
| | | # lastTick = curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_AddXPTick)
|
| | | # if not CommonCheckTick(curPlayer, tick, ChConfig.TYPE_Player_Tick_AddXPTick):
|
| | | # #首次登陆,将当前的XP值记录到字典中
|
| | | # if lastTick <= 0:
|
| | | # curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, curPlayer.GetXP())
|
| | | # return
|
| | | # |
| | | # #从字典中获取当前的XP值
|
| | | # curXPValue = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue)
|
| | | # #当前XP值已经是最大值了,不做处理
|
| | | # if curXPValue == maxXPValue:
|
| | | # return
|
| | | # xpRestorePer = PlayerControl.GetXPRestorePer(curPlayer)
|
| | | # addXPValue = int(addXPValue * xpRestorePer/float(ChConfig.Def_MaxRateValue))
|
| | | # nextXPValue = min(curXPValue + addXPValue, maxXPValue)
|
| | | # curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, nextXPValue)
|
| | | # #已经达到最大的XP值了,通知客户端
|
| | | # if nextXPValue == maxXPValue:
|
| | | # #这里进行设置的时候,将会通知客户端
|
| | | # curPlayer.SetXP(nextXPValue)
|
| | | #===========================================================================
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | def ProcessTimeEquip(curPlayer, tick):
|
| | | itemManager = curPlayer.GetItemManager()
|
| | | hasItemClear = False
|
| | |
|
| | | |
| | | classLV = 0 # 只处理非境界装备的时效物品
|
| | | curPack = itemManager.GetPack(IPY_GameWorld.rptEquip)
|
| | | for i in range(0, curPack.GetCount()):
|
| | | curItem = curPack.GetAt(i)
|
| | | for equipPlace in ChConfig.EquipPlace_LingQi:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
|
| | | if not ipyData:
|
| | | continue
|
| | | index = ipyData.GetGridIndex()
|
| | | curItem = curPack.GetAt(index)
|
| | |
|
| | | #异常物品
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | continue
|
| | |
|
| | | |
| | | if curItem.GetEndureReduceType() not in [ChConfig.Def_EquipReduceType_RTimeItem,
|
| | | ChConfig.Def_EquipReduceType_Time]:
|
| | | ChConfig.Def_EquipReduceType_Time]:
|
| | | continue
|
| | |
|
| | | |
| | | #处理现实时间物品逻辑
|
| | | if __DoLogic_ProcessTimeEquip(curPlayer, curItem, i):
|
| | | if __DoLogic_ProcessTimeEquip(curPlayer, curItem, index):
|
| | | hasItemClear = True
|
| | |
|
| | | |
| | | if hasItemClear:
|
| | | #装备重刷属性
|
| | | PlayerWing.CalcWingAttr(curPlayer)
|
| | | ChEquip.RefreshPlayerEquipAttribute(curPlayer)
|
| | | |
| | | |
| | | ChEquip.RefreshPlayerLingQiEquipAttr(curPlayer)
|
| | | |
| | | # 进行更新时效道具刷新时间
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_EquipTime, tick)
|
| | | |
| | | return hasItemClear
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 装备有效时间到了需要脱下,有效时间物品改成不消失,但是无使用效果 可出售和续费
|
| | | def __DoLogic_ProcessTimeEquip(curPlayer, curItem, equipIndex):
|
| | |
| | | # 没有空位,玩家主动取下,计算属性时无效化
|
| | | # 过期属性时效需刷属性
|
| | | return True
|
| | |
|
| | | |
| | | result = ItemControler.PlayerItemControler(curPlayer).UnEquipItem(equipIndex, spaceIndex)
|
| | | if not result:
|
| | | # 过期属性时效需刷属性
|
| | | return True
|
| | | equipID = result[0]
|
| | | equipPlace = result[1]
|
| | | if equipPlace == ShareDefine.retGuard:
|
| | | if equipPlace in [ShareDefine.retGuard1, ShareDefine.retGuard2]:
|
| | | PlayerControl.NotifyCode(curPlayer, 'Guardian_Timeout', [equipID, spaceIndex])
|
| | | elif equipPlace == ShareDefine.retWing:
|
| | | PlayerControl.NotifyCode(curPlayer, 'WingTiyan_Timeout')
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')
|
| | | PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)
|
| | |
|
| | | # 广播卸装
|
| | | if equipIndex in ChConfig.Def_SyncEquipStateByIndex:
|
| | | curPlayer.Sync_UnEquipItem(equipID, equipPlace)
|
| | | return True
|
| | | #---------------------------------------------------------------------
|
| | | ##全局定时器调用, 刷新玩家状态
|
| | |
| | | #回血回魔状态处理
|
| | | ProcessHPMPState(curPlayer, tick)
|
| | |
|
| | | PlayerYinji.ProcessPlayerYinji(curPlayer, tick)
|
| | | |
| | | #刷新组队状态
|
| | | #ProcessTeamState(curPlayer, tick)
|
| | |
|
| | |
| | | #成就
|
| | | PlayerSuccess.FinishDelayAddSuccessProgress(curPlayer, tick, False)
|
| | | #开服红包处理
|
| | | PlayerFamilyRedPacket.ProcessOSRedPacket(curPlayer, tick)
|
| | | #PlayerFamilyRedPacket.ProcessOSRedPacket(curPlayer, tick)
|
| | | #限时抢购
|
| | | PlayerFlashSale.ProcessFlashSaleMail(curPlayer, tick)
|
| | | #地图经验
|
| | | ProcessAreaExp(curPlayer, tick)
|
| | | #神秘商店刷新
|
| | | FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)
|
| | | #跨服数据同步,放最后
|
| | | CrossPlayerData.ProcessCrossPlayer(curPlayer, tick)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | ProcessProDef(curPlayer, tick)
|
| | | return
|
| | |
|
| | | def Sync_PKBossState(curPlayer):
|
| | | psState = 1 if curPlayer.GetDictByKey(ChConfig.Def_PDict_PKStateTick) else 0
|
| | | curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_PKState, psState, False)
|
| | | |
| | | bossState = 1 if curPlayer.GetDictByKey(ChConfig.Def_PDict_BossStateTick) else 0
|
| | | curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_BossState, bossState, False)
|
| | | return
|
| | |
|
| | | # 脱离PK战斗 X秒后按比例恢复
|
| | | def ProcessProDef(curPlayer, tick):
|
| | | if PlayerControl.GetProDefHPPer(curPlayer) == 0:
|
| | |
| | | ##给场景经验
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | return
|
| | | crossMapID = PlayerControl.GetCrossMapID(curPlayer)
|
| | | mapID = crossMapID if crossMapID else GameWorld.GetMap().GetMapID()
|
| | | neutralMapExpAwardDict = IpyGameDataPY.GetFuncEvalCfg('NeutralMapExpAward', 1, {})
|