| | |
| | | import PlayerEquipDecompose
|
| | | import PlayerGreatMaster
|
| | | import PlayerGatherSoul
|
| | | import PlayerFairyDomain
|
| | | import PlayerCrossRealmPK
|
| | | import GameFuncComm
|
| | | import PlayerMagicWeapon
|
| | |
| | | import PlayerNewFairyCeremony
|
| | | import PlayerFeastRedPacket
|
| | | import PlayerLuckyTreasure
|
| | | import Item_ResetAttrPoint
|
| | | import CrossRealmPlayer
|
| | | import ChNetSendPack
|
| | | import FamilyRobBoss
|
| | |
| | | import PlayerDogz
|
| | | import PlayerCoat
|
| | | import PlayerQuDaoDoubleBill
|
| | | import PlayerFB
|
| | | import SkillShell
|
| | | import PlayerYinji
|
| | |
|
| | | import datetime
|
| | | import time
|
| | |
| | |
|
| | | return
|
| | |
|
| | | #// A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
|
| | | #
|
| | | #struct tagCMClientStartCustomScene
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnClientStartCustomScene(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | DoEnterCustomScene(curPlayer)
|
| | | return
|
| | |
|
| | | def DoEnterCustomScene(curPlayer):
|
| | | ## 进入自定义场景状态
|
| | | curPlayer.SetCanAttack(False)
|
| | | curPlayer.SetVisible(False)
|
| | | curPlayer.SetSight(0)
|
| | | curPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | if curPet:
|
| | | curPet.SetVisible(False)
|
| | | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1)
|
| | | GameWorld.Log("玩家开始自定义场景!", curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | def DoExitCustomScene(curPlayer):
|
| | | ## 退出自定义场景状态
|
| | | curPlayer.SetCanAttack(True)
|
| | | curPlayer.SetVisible(True)
|
| | | curPlayer.SetSight(1)
|
| | | curPlayer.RefreshView()
|
| | | curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
|
| | | curPlayer.RefreshView()
|
| | | curPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | if curPet:
|
| | | curPet.SetVisible(True)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
|
| | | GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | #// A1 08 刷新主服角色信息 #tagCMRefreshMainServerRole
|
| | | #
|
| | | #struct tagCMRefreshMainServerRole
|
| | |
| | | CrossRealmPlayer.DoExitCrossRealm(curPlayer)
|
| | |
|
| | | if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | DoExitCustomScene(curPlayer)
|
| | | PlayerFB.DoExitCustomScene(curPlayer)
|
| | |
|
| | | PetControl.DoLogic_PetLoadMapOK(curPlayer)
|
| | | |
| | | msgInfo = ""
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "RefreshMainServerRole", msgInfo, len(msgInfo))
|
| | | return
|
| | |
| | | # 离线过久恢复为非跨服状态
|
| | | if PlayerControl.GetCrossMapID(curPlayer):
|
| | | PlayerControl.SetCrossMapID(curPlayer, 0)
|
| | | |
| | | |
| | | SyncGuideState(curPlayer)
|
| | |
|
| | | #上线检查一次装备属性
|
| | | ItemControler.PlayerItemControler(curPlayer).CheckRolePackEquipAttr()
|
| | | #上线检查加点属性点
|
| | | PlayerControl.FixOldAddPoint(curPlayer)
|
| | | |
| | | ItemControler.PlayerItemControler(curPlayer).CheckRolePackEquipAttr() |
| | | #更新服务器组ID
|
| | | PlayerControl.UpdPlayerServerGroupID(curPlayer)
|
| | |
|
| | |
| | |
|
| | | #通知玩家技能信息
|
| | | __Sync_ClientSkill(curPlayer)
|
| | | #清除生产采集Buff
|
| | | #PlayerControl.DelProduceBuff(curPlayer, tick)
|
| | | #清除国家答题Buff
|
| | | #PlayerExam.DoLogic_ExitExam(curPlayer, tick, needRefresh = False)
|
| | | #清除VIPbuff
|
| | | #BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_VIPExp_SkillTypeID, tick)
|
| | | #PlayerReincarnation.ReincarOnLogin(curPlayer)
|
| | |
|
| | | #通知玩家的buff
|
| | | __Sync_ClientBuff(curPlayer)
|
| | |
| | | #PKģʽ
|
| | | SyncPKModel(curPlayer)
|
| | |
|
| | | #通用强化星级信息
|
| | | ChEquip.NotifyEquipPartPlusLV(curPlayer)
|
| | | ChEquip.NotifyEquipPartStar(curPlayer)
|
| | | Operate_EquipWash.OnEquipWashLogin(curPlayer)
|
| | | #通知套装信息
|
| | | #ChEquip.SyncAllEquipAttrActiveInfo(curPlayer)
|
| | | #装备位宝石镶嵌通知
|
| | | Operate_EquipStone.OnLogin(curPlayer)
|
| | | #装备相关信息
|
| | | ChEquip.OnPlayerEquipLoginLogic(curPlayer)
|
| | |
|
| | | #大师
|
| | | PlayerGreatMaster.MasterOnLogin(curPlayer)
|
| | |
| | | # 首充/天天首充/充值豪礼
|
| | | PlayerGoldGift.OnLogin(curPlayer)
|
| | |
|
| | | #玩家回归通知
|
| | | #PlayerRecall.PlayerBack(curPlayer)
|
| | | |
| | | #通知购买功能中各购买类型的已购买和可购买次数
|
| | | Operate_PlayerBuyZhenQi.DoPlayerLogin(curPlayer)
|
| | | #
|
| | |
| | | #通知运行成功
|
| | | curPlayer.BalanceServer_PlayerLoginInitOK()
|
| | |
|
| | | # 新手指导员上线处理
|
| | | # #PlayerFreshmanGuide.FreshmanGuiderOnLogin(curPlayer)
|
| | | # |
| | | # 坐骑相关通知
|
| | | PlayerHorse.PlayerHorseLogin(curPlayer)
|
| | |
|
| | | PlayerTreasure.OnTreasureLogin(curPlayer)
|
| | |
|
| | | # # 通知累计登陆礼
|
| | | # 通知累计登陆礼
|
| | | PlayerLoginDayAward.OnLoginNotifyLoginDayAward(curPlayer)
|
| | | # |
| | | |
| | | # 开服活动奖励信息
|
| | | OpenServerCampaign.OnOpenServerCampaignLogin(curPlayer)
|
| | | # |
| | | # # 节日登陆奖励
|
| | | # PlayerFestivalLogin.OnLoginFestivalLogin(curPlayer)
|
| | |
|
| | | # 试炼之塔
|
| | | GameLogic_TrialTower.OnFBPlayerLogin(curPlayer)
|
| | | # 古神禁地
|
| | | GameLogic_GodArea.GodAreaOnLogin(curPlayer)
|
| | | # # 采集NPC次数通知
|
| | | # 采集NPC次数通知
|
| | | NPCCommon.SyncCollNPCTime(curPlayer)
|
| | | # |
| | | # # 特惠活动
|
| | | # PlayerTeHui.PlayerLogin_TeHui(curPlayer)
|
| | | # |
| | | # # 自定义商店
|
| | | # ShopItemManage.DoOnLogin(curPlayer)
|
| | | # |
| | | # # 每日活跃度
|
| | | |
| | | # 每日活跃度
|
| | | PlayerActivity.OnLogin(curPlayer)
|
| | | # |
| | | # # 副本进入时间
|
| | | |
| | | # 副本进入时间
|
| | | FBCommon.FBOnLogin(curPlayer)
|
| | | # |
| | | # #天梯竞技场
|
| | | # HighLadderTube.OnLogin(curPlayer)
|
| | | # |
| | | # #世界等级
|
| | | |
| | | #世界等级
|
| | | PlayerWorldAverageLv.OnLogin(curPlayer)
|
| | | # |
| | | |
| | | # 投资理财
|
| | | PlayerGoldInvest.OnLogin(curPlayer)
|
| | | # |
| | | # #节日活动
|
| | | # PlayerAction.ActionOnLogin(curPlayer)
|
| | | # |
| | | # #属性果实使用情况
|
| | | |
| | | #属性果实使用情况
|
| | | PlayerAttrFruit.AttrFruitOnLogin(curPlayer)
|
| | | # |
| | | # #成就
|
| | | |
| | | #成就
|
| | | PlayerSuccess.SuccOnLogin(curPlayer)
|
| | | # |
| | | # #同步自动战斗配置记录
|
| | | |
| | | #同步自动战斗配置记录
|
| | | # Sync_AutoFightSetting(curPlayer)
|
| | | # |
| | | |
| | | PlayerFamily.FamilyPlayerOnLogin(curPlayer, tick)
|
| | | #改到 GameServerRefresh GameSever_PlayerInitOK后处理才能保证玩家已经在Gameserver注册
|
| | | #PlayerDienstgrad.RefreshBillBoardDienstgrad(curPlayer)
|
| | | # 称号
|
| | | PlayerDienstgrad.Sync_AllDienstgradOnLogin(curPlayer)
|
| | | # # 资源找回OnLogin
|
| | | # 资源找回OnLogin
|
| | | PlayerRecover.RecoverOnLogin(curPlayer)
|
| | | #
|
| | | # # ʱװ
|
| | | |
| | | # ʱװ
|
| | | PlayerCoat.OnLogin_Coat(curPlayer)
|
| | |
|
| | | # 跨服PK
|
| | |
| | | PlayerFlashGiftbag.OnPlayerLogin(curPlayer)
|
| | | #限时抢购
|
| | | PlayerFlashSale.OnPlayerLogin(curPlayer)
|
| | | # # 消费VIP
|
| | | # PlayerCostVIP.CostVIPOnLogin(curPlayer, tick)
|
| | | # |
| | | # # QQ相关奖励OnLogin
|
| | | # #PlayerQQ.Sync_QQAllAwardRecord(curPlayer)
|
| | | # |
| | | # # 世界boss
|
| | | # 世界boss
|
| | | BossHurtMng.OnLogin(curPlayer)
|
| | | ChItem.Sync_ItemDayUseCnt(curPlayer)
|
| | | # # 悬赏登录通知
|
| | | # PlayerArrestTask.OnLogin(curPlayer)
|
| | | # 悬赏登录通知
|
| | | #PlayerArrestTask.OnLogin(curPlayer)
|
| | | # 符印登录通知
|
| | | PlayerRune.PlayerRuneLogin(curPlayer)
|
| | | # 仙盟红包登录通知
|
| | |
| | | FBHelpBattle.DoPlayerLogin(curPlayer)
|
| | | # 聚魂
|
| | | PlayerGatherSoul.PlayerLogin(curPlayer)
|
| | | #缥缈仙域
|
| | | PlayerFairyDomain.OnLogin(curPlayer)
|
| | | PlayerFB.OnLogin(curPlayer)
|
| | | #技能专精信息
|
| | | SkillShell.NotifyElementSkillInfo(curPlayer)
|
| | | |
| | | curPlayer.SetState(0) # 脱机挂恢复为正常上线
|
| | | curPlayer.SetFacePic(0) # 通知数据库是否保存还是下线,做一次恢复,1为保存 0为正常下线
|
| | | tjgTime = PlayerTJG.GetTJGTime(curPlayer)
|
| | |
| | | mixServerWorldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV) # 合服时的世界等级
|
| | | GameWorld.Log("玩家合服首登处理! lastMixServerDay=%s,mixServerWorldLV=%s" % (lastMixServerDay, mixServerWorldLV), playerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MixLoginDay, lastMixServerDay)
|
| | | |
| | | if curPlayer.GetLV() <= 1:
|
| | | GameWorld.Log(" 新号不给合服奖励!", playerID)
|
| | | return
|
| | |
|
| | | # 重置首充双倍
|
| | | PlayerCoin.DoResetCTGCount(curPlayer, "MixServer")
|
| | |
| | | PlayerGameEvent.TakeoffFishermanEquipment(curPlayer)
|
| | | #切地图要清除的buff
|
| | | __CheckClearBuffOnMapChange(curPlayer, tick)
|
| | | |
| | | #上线和切地图加有限无敌Buff
|
| | | SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick)
|
| | | if curPlayer.GetLV() > 50:
|
| | | SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick)
|
| | |
|
| | | #刷新玩家的视野
|
| | | if not GameWorld.IsCrossServer() and PlayerControl.GetCrossMapID(curPlayer):
|
| | | GameWorld.DebugLog("===登录本服地图时,处于跨服状态,不刷新视野!", curPlayer.GetPlayerID())
|
| | | curPlayer.SetSight(0)
|
| | | else:
|
| | | PlayerState.ChangePlayerSigh(curPlayer, tick)
|
| | | if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or PlayerControl.GetCustomMapID(curPlayer)):
|
| | | GameWorld.DebugLog("===登录本服地图时,处于跨服或自定义场景状态,不刷新视野!", curPlayer.GetPlayerID())
|
| | | PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | | PlayerState.ChangePlayerSigh(curPlayer, tick)
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | curPlayer.SetForbiddenSyncClientState(False)
|
| | |
| | | #if not __CheckGMCanLoadMapOK(curPlayer):
|
| | | # return
|
| | |
|
| | | |
| | | #检测账号是否锁定
|
| | | if not __CheckForbidLogin(curPlayer):
|
| | | return
|
| | |
| | | firstMission = QuestCommon.GetCommonMission(curPlayer)
|
| | | if not (firstMission and firstMission.GetProperty(QuestCommon.Def_NewGuyNoSight) == 1):
|
| | | #刷新自己的视野
|
| | | if not GameWorld.IsCrossServer() and PlayerControl.GetCrossMapID(curPlayer):
|
| | | GameWorld.DebugLog("===本服LoadMapOK时玩家处于跨服状态,不设置可见!", curPlayer.GetPlayerID())
|
| | | else:
|
| | | curPlayer.RefreshView()
|
| | | curPlayer.SetVisible(True)
|
| | | |
| | | if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene)):
|
| | | GameWorld.DebugLog("===本服LoadMapOK时玩家处于跨服或自定义场景状态,不设置可见!", curPlayer.GetPlayerID())
|
| | | PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | | curPlayer.RefreshView()
|
| | | curPlayer.SetVisible(True)
|
| | | |
| | | #如果玩家hp为0,设置玩家为死亡状态
|
| | | if curPlayer.GetHP() <= 0:
|
| | | curPlayer.SetPlayerAction(IPY_GameWorld.paDie)
|
| | |
| | | #把玩家设置为初始化成功状态
|
| | | curPlayer.SetInitOK(True)
|
| | |
|
| | | #bug:GM号反隐形在玩家切换地图之后,脚本未设置玩家属性之前,C++通知合并封包导致客户端死B
|
| | | #将反隐形开启转移到脚本
|
| | | if curPlayer.GetGMLevel():
|
| | | curPlayer.SetIsDefVisible(True)
|
| | | #===========================================================================
|
| | | # #bug:GM号反隐形在玩家切换地图之后,脚本未设置玩家属性之前,C++通知合并封包导致客户端死B
|
| | | # #将反隐形开启转移到脚本
|
| | | # if curPlayer.GetGMLevel():
|
| | | # curPlayer.SetIsDefVisible(True)
|
| | | #===========================================================================
|
| | |
|
| | | #有限无敌Buff
|
| | | if not __CheckLimitSuperBuff(curPlayer):
|
| | |
| | |
|
| | | PlayerTeam.PlayerLoginSetTeam(curPlayer, tick)
|
| | |
|
| | | #要求数据库得到邮件状态
|
| | | #curPlayer.DataServer_GetPlayerMailState()
|
| | | |
| | | #curPlayer.EndLoadMap()
|
| | |
|
| | | #激活玩家(保证持续性Buff处理间隔)
|
| | | PlayerControl.SetIsNeedProcess(curPlayer, True)
|
| | |
|
| | |
| | | GameWorld.Log('玩家登录重置位置失败, 设置附近点 nearPosX = %s nearPosY = %s' % (nearPosX, nearPosY) , curPlayer.GetPlayerID())
|
| | |
|
| | | #申请得到奖励物品
|
| | | curPlayer.DataServer_CheckPrizeItem()
|
| | | #curPlayer.DataServer_CheckPrizeItem()
|
| | |
|
| | | #===========================================================================
|
| | | # #if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Frist_Lock) == 1 \
|
| | |
| | |
|
| | | #防止玩家读取地图时未触发OnDay,读取地图后再次验证(2009.9.11)
|
| | | PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
|
| | | |
| | | #特惠活动事件
|
| | | #PlayerTeHui.PlayerLoadMapOK(curPlayer)
|
| | |
|
| | | #设置阵营
|
| | | if curPlayer.GetFaction() != ChConfig.CampType_Neutral \
|
| | |
| | | GameWorld.DebugLog("进入地图强制切换PK模式: %s" % initAttackModel)
|
| | |
|
| | | PassiveBuffEffMng.OnLoadMapGFPassive(curPlayer)
|
| | | PlayerYinji.OnLoadMap(curPlayer)
|
| | | ItemControler.PlayerItemControler(curPlayer).RefreshStartEquipCount() # 刷新装备珍品星级
|
| | |
|
| | | #EndLoadMap需放在最后
|
| | | curPlayer.EndLoadMap()
|
| | | # 渠道返利 |
| | | PlayerQuDaoDoubleBill.OnMapQDDoubleBill(curPlayer)
|
| | | return True
|
| | |
|
| | | ## 切换地图同步一次PK模式
|
| | |
| | | #@return 返回值无意义
|
| | | #@remarks //03 01 加属性点#tagCAddPoint
|
| | | def AddPoint(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_AddPoint)(index, tick)
|
| | | return
|
| | |
|
| | | ##//03 01 加属性点#tagCAddPoint
|
| | | #@param index 玩家索引
|
| | | #@param tick 时间戳
|
| | | #@return 返回值无意义
|
| | | #@remarks //03 01 加属性点#tagCAddPoint
|
| | | def __Func_AddPoint(index, tick):
|
| | | #// B2 06 玩家加点 #tagCMAddPoint
|
| | | #
|
| | | #struct tagCMAddPoint
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE PointAttrIDCount; // 加点属性ID个数
|
| | | # BYTE PointAttrIDList[PointAttrIDCount]; // 加点属性ID列表
|
| | | # WORD PointValueList[PointAttrIDCount]; // 加点属性ID对应的点数列表
|
| | | #};
|
| | | def OnAddPoint(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | #JobQuotiety = PlayerControl.JobQuotiety
|
| | | pointAttrIDList = clientData.PointAttrIDList
|
| | | pointValueList = clientData.PointValueList
|
| | | if not pointAttrIDList or not pointValueList or len(pointAttrIDList) != len(pointValueList):
|
| | | return
|
| | | |
| | | needTotalPoint = 0
|
| | | for i, attrID in enumerate(pointAttrIDList):
|
| | | if not IpyGameDataPY.GetIpyGameData("RolePoint", attrID):
|
| | | return
|
| | | needTotalPoint += pointValueList[i]
|
| | | |
| | | curFreePoint = curPlayer.GetFreePoint()
|
| | | #job = curPlayer.GetJob()
|
| | | recvAddPoint = IPY_GameWorld.IPY_CAddPoint()
|
| | | addValue = recvAddPoint.GetPoint()
|
| | | |
| | | #检验是否能够加点
|
| | | if addValue < 1 or addValue > curFreePoint:
|
| | | #检验不通过, 返回
|
| | | #GameWorld.ErrLog("(%s,%s)检验是否能够加点,检验不通过, 返回"%(addValue,curFreePoint) , curPlayer.GetPlayerID())
|
| | | if needTotalPoint > curFreePoint:
|
| | | GameWorld.DebugLog("剩余点数不足! curFreePoint(%s) < needTotalPoint(%s)" % (curFreePoint, needTotalPoint))
|
| | | return
|
| | |
|
| | | #封包加点类型
|
| | | addPointType = recvAddPoint.GetType()
|
| | | |
| | | #加点 |
| | | if addPointType == ShareDefine.Def_Effect_STR:
|
| | | curPlayer.SetBaseSTR(addValue + curPlayer.GetBaseSTR())
|
| | | curPlayer.SetFreePoint(curFreePoint - needTotalPoint)
|
| | | for i, attrID in enumerate(pointAttrIDList):
|
| | | addPoint = pointValueList[i]
|
| | | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
|
| | | updPoint = curPoint + addPoint
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AddPointValue % attrID, updPoint)
|
| | | GameWorld.DebugLog("玩家加点: attrID=%s,curPoint=%s,addPoint=%s,updPoint=%s" % (attrID, curPoint, addPoint, updPoint))
|
| | |
|
| | | elif addPointType == ShareDefine.Def_Effect_PNE:
|
| | | curPlayer.SetBasePNE(addValue + curPlayer.GetBasePNE())
|
| | | |
| | | elif addPointType == ShareDefine.Def_Effect_PHY:
|
| | | curPlayer.SetBasePHY(addValue + curPlayer.GetBasePHY())
|
| | | |
| | | elif addPointType == ShareDefine.Def_Effect_CON:
|
| | | curPlayer.SetBaseCON(addValue + curPlayer.GetBaseCON())
|
| | | |
| | | else:
|
| | | #异常超出边界
|
| | | GameWorld.ErrLog("AddPoint GetTypeErr = %s" % (addPointType) , curPlayer.GetID())
|
| | | return
|
| | | |
| | | curPlayer.SetFreePoint(curFreePoint - addValue)
|
| | | |
| | | DataRecordPack.DR_Freepoint(curPlayer, "AddPoint", curFreePoint, {"AddPointType":addPointType})
|
| | | playerControl.RefreshPlayerAttrState() |
| | | |
| | | NotifyPlayerBasePoint(curPlayer, pointAttrIDList)
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.RefreshPlayerAttrState()
|
| | | EventShell.EventRespons_AddPoint(curPlayer)
|
| | | return
|
| | |
|
| | | def NotifyPlayerBasePoint(curPlayer):
|
| | | #上线通知基础属性点
|
| | | notifyList = []
|
| | | notifyBasePointDict = {
|
| | | IPY_GameWorld.CDBPlayerRefresh_BaseSTR:'BaseSTR',
|
| | | IPY_GameWorld.CDBPlayerRefresh_BasePHY:'BasePHY',
|
| | | IPY_GameWorld.CDBPlayerRefresh_BaseCON:'BaseCON',
|
| | | IPY_GameWorld.CDBPlayerRefresh_BasePNE:'BasePNE',
|
| | | }
|
| | | for refreshType, keyStr in notifyBasePointDict.items():
|
| | | notifyStruct = ChPyNetSendPack.tagRefreshType()
|
| | | notifyStruct.RefreshType = refreshType
|
| | | notifyStruct.Value = getattr(curPlayer, 'Get%s'%keyStr)()
|
| | | notifyList.append(notifyStruct)
|
| | | #// B2 07 重置加点 #tagCMResetAttrPoint
|
| | | #struct tagCMResetAttrPoint
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnResetAttrPoint(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | canResetIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
|
| | | canReset = False
|
| | | for attrID in canResetIDList:
|
| | | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
|
| | | if curPoint:
|
| | | canReset = True
|
| | | break
|
| | | if not canReset:
|
| | | GameWorld.DebugLog('重置加点 没有点数需要重置')
|
| | | return
|
| | | isFree = curPlayer.GetLV() < IpyGameDataPY.GetFuncCfg('LVUPAddPoint', 4)
|
| | | if not isFree:
|
| | | #优先使用剩余时间最短的时效物品
|
| | | needItemIDList = IpyGameDataPY.GetFuncEvalCfg('LVUPAddPoint', 5)
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | delIndex = -1
|
| | | expireTime = 0
|
| | | for itemID in needItemIDList:
|
| | | hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(itemID, itemPack, 1)
|
| | | if not hasEnough:
|
| | | #GameWorld.DebugLog("重置加点 item(%s) isn't enough" % (needItemID))
|
| | | continue
|
| | | |
| | | for itemIndex in itemIndexList:
|
| | | curItem = itemPack.GetAt(itemIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | continue
|
| | | isExpireItem, remainingTime = ItemCommon.GetItemRemainingTime(curItem)
|
| | | if isExpireItem:
|
| | | if remainingTime <= 0:
|
| | | #过期
|
| | | continue
|
| | | if remainingTime < expireTime:
|
| | | expireTime = remainingTime
|
| | | delIndex = itemIndex
|
| | | else:
|
| | | delIndex = itemIndex
|
| | | break
|
| | | if delIndex != -1:
|
| | | break
|
| | | if delIndex is -1:
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, [delIndex], 1, False, ChConfig.ItemDel_ResetAttrPoint)
|
| | | |
| | | Item_ResetAttrPoint.DoResetAttrPoint(curPlayer, 0, 0, 0)
|
| | | |
| | | EventShell.EventRespons_LingGenReset(curPlayer)
|
| | | return
|
| | |
|
| | | def NotifyPlayerBasePoint(curPlayer, syncAttrIDList=[]):
|
| | | # 通知基础属性点,已分配的自由点数
|
| | | |
| | | if not syncAttrIDList:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | syncAttrIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
|
| | |
|
| | | #属性组合包 通知自己
|
| | | sendPack = ChPyNetSendPack.tagObjInfoListRefresh()
|
| | | sendPack.Clear()
|
| | | sendPack.ObjID = curPlayer.GetID()
|
| | | sendPack.ObjType = curPlayer.GetGameObjType()
|
| | | sendPack.Count = len(notifyList)
|
| | | sendPack.RefreshType = notifyList
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | pointAttrIDList = []
|
| | | pointValueList = []
|
| | | for attrID in syncAttrIDList:
|
| | | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
|
| | | pointAttrIDList.append(attrID)
|
| | | pointValueList.append(curPoint)
|
| | | |
| | | pointInfo = ChPyNetSendPack.tagMCRolePointInfo()
|
| | | pointInfo.PointAttrIDList = pointAttrIDList
|
| | | pointInfo.PointValueList = pointValueList
|
| | | pointInfo.PointAttrIDCount = len(pointAttrIDList)
|
| | | NetPackCommon.SendFakePack(curPlayer, pointInfo)
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | |
| | | GameWorld.DebugLog("当前无跨服地图!")
|
| | | return
|
| | |
|
| | | if not __CheckCanReborn(curPlayer, rebornType):
|
| | | if not __CheckCanReborn(curPlayer, rebornType, checkHPState=False):
|
| | | return
|
| | |
|
| | | msgDict = {"PlayerID":curPlayer.GetPlayerID(), "RebornType":rebornType}
|
| | |
| | | #@return 返回值无意义
|
| | | #@remarks 客户端封包响应//04 02 获取鼠标左键点击之后对象的详细信息#tagCClickObjGetInfo
|
| | | def __Func_PlayerClickOtherPlayerGetInfo(index, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | sendPack = IPY_GameWorld.IPY_CClickObjGetInfo()
|
| | | sendPack_ID = sendPack.GetObjID()
|
| | | sendPack_Type = sendPack.GetObjType()
|
| | | |
| | | tagObj = GameWorld.GetObj(sendPack_ID, sendPack_Type)
|
| | | |
| | | if tagObj == None:
|
| | | #GameWorld.Log("玩家请求其他玩家的相貌信息失败, 对象不存在", curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), tagObj.GetPosX(), tagObj.GetPosY())
|
| | | #是否可以目标详细信息
|
| | | canGetDetail = (dist <= curPlayer.GetSight())
|
| | | #目标类型
|
| | | tagObjType = tagObj.GetGameObjType()
|
| | | |
| | | #仅处理Player和NPC
|
| | | if tagObjType not in [IPY_GameWorld.gotPlayer, IPY_GameWorld.gotNPC]:
|
| | | return
|
| | | |
| | | #---玩家处理---
|
| | | if tagObjType == IPY_GameWorld.gotPlayer:
|
| | | #获取玩家详细信息成功
|
| | | if canGetDetail:
|
| | | extendDataDict = {}
|
| | | extendDataDict['maxHP'] = tagObj.GetMaxHP()
|
| | | extendDataDict['maxMP'] = tagObj.GetMaxMP()
|
| | | extendDataDict['hit'] = tagObj.GetHit()
|
| | | extendDataDict['miss'] = tagObj.GetMiss()
|
| | | extendDataDict['atkSpeed'] = PlayerControl.GetAtkSpeed(tagObj)
|
| | | extendDataDict['superHitRate'] = tagObj.GetSuperHitRate()
|
| | | extendDataDict['superHit'] = tagObj.GetSuperHit()
|
| | | extendDataDict['luckyHitRate'] = tagObj.GetLuckyHitRate()
|
| | | extendDataDict['greatHitRate'] = tagObj.GetGreatHitRate()
|
| | | extendDataDict['ignoreDefRate'] = tagObj.GetIgnoreDefRate()
|
| | | extendDataDict['damageReduceRate'] = tagObj.GetDamageReduceRate()
|
| | | extendDataDict['damageBackRate'] = tagObj.GetDamageBackRate()
|
| | | |
| | | extendData = str(extendDataDict)
|
| | | extendDataLen = len(extendData)
|
| | | curPlayer.PlayerClickOtherPlayerDetail(tagObj, extendDataLen, extendData)
|
| | | return
|
| | | |
| | | #获取玩家详细信息失败
|
| | | curPlayer.Sync_GetPlayerInfoFail(sendPack_ID)
|
| | | return
|
| | | |
| | | #---NPC处理---
|
| | | |
| | | #获取NPC详细信息成功
|
| | | if canGetDetail:
|
| | | curPlayer.PlayerClickOtherNPCDetail(tagObj)
|
| | | return
|
| | | |
| | | #===========================================================================
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # |
| | | # sendPack = IPY_GameWorld.IPY_CClickObjGetInfo()
|
| | | # sendPack_ID = sendPack.GetObjID()
|
| | | # sendPack_Type = sendPack.GetObjType()
|
| | | # |
| | | # tagObj = GameWorld.GetObj(sendPack_ID, sendPack_Type)
|
| | | # |
| | | # if tagObj == None:
|
| | | # #GameWorld.Log("玩家请求其他玩家的相貌信息失败, 对象不存在", curPlayer.GetPlayerID())
|
| | | # return
|
| | | # |
| | | # dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), tagObj.GetPosX(), tagObj.GetPosY())
|
| | | # #是否可以目标详细信息
|
| | | # canGetDetail = (dist <= curPlayer.GetSight())
|
| | | # #目标类型
|
| | | # tagObjType = tagObj.GetGameObjType()
|
| | | # |
| | | # #仅处理Player和NPC
|
| | | # if tagObjType not in [IPY_GameWorld.gotPlayer, IPY_GameWorld.gotNPC]:
|
| | | # return
|
| | | # |
| | | # #---玩家处理---
|
| | | # if tagObjType == IPY_GameWorld.gotPlayer:
|
| | | # #获取玩家详细信息成功
|
| | | # if canGetDetail:
|
| | | # extendDataDict = {}
|
| | | # extendDataDict['maxHP'] = tagObj.GetMaxHP()
|
| | | # extendDataDict['maxMP'] = tagObj.GetMaxMP()
|
| | | # extendDataDict['hit'] = tagObj.GetHit()
|
| | | # extendDataDict['miss'] = tagObj.GetMiss()
|
| | | # extendDataDict['atkSpeed'] = PlayerControl.GetAtkSpeed(tagObj)
|
| | | # extendDataDict['superHitRate'] = tagObj.GetSuperHitRate()
|
| | | # extendDataDict['superHit'] = tagObj.GetSuperHit()
|
| | | # extendDataDict['luckyHitRate'] = tagObj.GetLuckyHitRate()
|
| | | # extendDataDict['greatHitRate'] = tagObj.GetGreatHitRate()
|
| | | # extendDataDict['ignoreDefRate'] = tagObj.GetIgnoreDefRate()
|
| | | # extendDataDict['damageReduceRate'] = tagObj.GetDamageReduceRate()
|
| | | # extendDataDict['damageBackRate'] = tagObj.GetDamageBackRate()
|
| | | # |
| | | # extendData = str(extendDataDict)
|
| | | # extendDataLen = len(extendData)
|
| | | # curPlayer.PlayerClickOtherPlayerDetail(tagObj, extendDataLen, extendData)
|
| | | # return
|
| | | # |
| | | # #获取玩家详细信息失败
|
| | | # curPlayer.Sync_GetPlayerInfoFail(sendPack_ID)
|
| | | # return
|
| | | # |
| | | # #---NPC处理---
|
| | | # |
| | | # #获取NPC详细信息成功
|
| | | # if canGetDetail:
|
| | | # curPlayer.PlayerClickOtherNPCDetail(tagObj)
|
| | | # return
|
| | | # |
| | | #===========================================================================
|
| | | #获取NPC详细信息失败
|
| | | #暂不处理
|
| | | return
|
| | |
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | def __CheckCanReborn(curPlayer, rebornType, gameMap=None):
|
| | | def __CheckCanReborn(curPlayer, rebornType, gameMap=None, checkHPState=True):
|
| | | ''' 检查可否复活,为了逻辑统一,这里不适用玩家所在的地图,支持跨服状态下判断跨服地图
|
| | | 本函数不验证玩家死亡状态等,因为有可能前后端复活状态不一致,如果这里拦住可能导致前端躺尸复活不了
|
| | | '''
|
| | | |
| | | if checkHPState and curPlayer.GetHP() > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
|
| | | # 当血量大于0收到复活请求时,一般是前后端复活状态不一致的情况下导致的
|
| | | # 由于前端需要根据复活状态判断复活界面相关逻辑,所以这里需要做一些特殊处理,防止某些情况下前后端复活状态不一致导致的一些异常问题
|
| | | # 后端非死亡状态的情况,补同步一次复活包给前端
|
| | | SyncPlayerReborn(curPlayer, rebornType)
|
| | | return
|
| | |
|
| | | if rebornType not in ChConfig.Def_RebornTypeList:
|
| | | return
|
| | |
| | |
|
| | | def __DoPlayerReborn(curPlayer, rebornType, tick, mapBornPlace=0, isAddSuperBuff=True):
|
| | | ## 执行玩家复活逻辑,该函数没有执行验证是否可复活等,不可直接调用
|
| | | |
| | | if curPlayer.GetHP() > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
|
| | | # 当血量大于0收到复活请求时,一般是前后端复活状态不一致的情况下导致的
|
| | | # 由于前端需要根据复活状态判断复活界面相关逻辑,所以这里需要做一些特殊处理,防止某些情况下前后端复活状态不一致导致的一些异常问题
|
| | | # 后端非死亡状态的情况,补同步一次复活包给前端
|
| | | SyncPlayerReborn(curPlayer, rebornType)
|
| | | return
|
| | |
|
| | | resetHpPercent = ChConfig.Def_MaxRateValue
|
| | | isFBReborn = False
|
| | |
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD DataMapID;
|
| | | # WORD LineID;
|
| | | #};
|
| | | def OnEnterCrossServer(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | PlayerControl.PlayerEnterCrossServer(curPlayer, clientData.DataMapID)
|
| | | PlayerControl.PlayerEnterCrossServer(curPlayer, clientData.DataMapID, clientData.LineID)
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | |
| | | # 领取节日巡礼积分奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_FeastWeekPartyPoint:
|
| | | PlayerFeastWeekParty.GetFeastWeekPartyPointAward(curPlayer, dataEx, dataExStr)
|
| | | #缥缈奇遇领取
|
| | | elif rewardType == ChConfig.Def_RewardType_FairyAdventuresAward:
|
| | | PlayerFairyDomain.GetFairyAdventuresAward(curPlayer, dataEx, dataExStr)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | |
| | | sendPack.NPCID = npcID
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | | #// B4 0E 玩家掉血 #tagCMRoleLostHP
|
| | | #
|
| | | #struct tagCMRoleLostHP
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD LostHP;
|
| | | #};
|
| | | def OnRoleLostHP(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | lostHP = clientData.LostHP
|
| | | curHP = curPlayer.GetHP()
|
| | | updHP = curHP - lostHP
|
| | | if updHP <= 0:
|
| | | #玩家已经死亡
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.SetDead()
|
| | | else:
|
| | | curPlayer.SetHP(updHP)
|
| | | |
| | | return
|