From d8e5fed26a9e170f8a7f145428b2dd607f74e4fe Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期五, 11 一月 2019 16:42:18 +0800 Subject: [PATCH] 2857 【BUG】【1.5】采集被打断问题 - 屏蔽无用代码 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py | 895 ++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 523 insertions(+), 372 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py index 69dbdd4..d7dd489 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py @@ -18,7 +18,6 @@ import GameMap import ChConfig import EventShell -import SkillShell import BuffSkill import PlayerEventCounter import PlayerTeam @@ -57,10 +56,8 @@ import PlayerLoginDayAward import PlayerGodWeapon import PlayerWorldAverageLv -import GameLogic_ManorWar import PlayerGoldInvest import PlayerActivity -import PlayerTeHui import FBCommon import PlayerBindJadeWheel import BossHurtMng @@ -70,23 +67,20 @@ import PlayerDienstgrad import PlayerMixLoginDayAward import PlayerFreeGoods -import ShopItemManage import PlayerRecover -import Operate_EquipSuitCompose +import GameLogic_IceLode import PlayerEquipDecompose -import PlayerCoat import PlayerGreatMaster -import PlayerCostVIP -import PlayerMergeKing -import PlayerMergePK +import PlayerGatherSoul +import PlayerCrossRealmPK import GameFuncComm import PlayerMagicWeapon import GameLogic_TrialTower import GameLogic_FamilyWar import PlayerBossReborn +import PlayerWeekParty import Operate_EquipWash import PlayerTreasure -import PlayerMergeEvent import GameLogic_GodArea import PlayerRune import PlayerFamilyRedPacket @@ -101,18 +95,21 @@ import QuestCommon import PlayerTJG import GameLogic_XMZZ -import GameLogic_SealDemon import PlayerFlashSale import PlayerFlashGiftbag import PlayerCostRebate +import PlayerActTotalRecharge import PlayerSpringSale import PlayerFairyCeremony +import CrossRealmPlayer import ChNetSendPack import FamilyRobBoss +import FBHelpBattle import PyGameData import PlayerCoin import PlayerGeTui import PlayerDogz +import PlayerCoat import datetime import time @@ -183,7 +180,8 @@ #先发送所有任务, 再刷新日期, 否则会有2个相同的任务在玩家身上 #把玩家当前的所有任务发送给客户端 #GameWorld.Log('EventShell.NotifyAllQuestDetail') - EventShell.NotifyAllQuestDetail(curPlayer, True) + if not GameWorld.IsCrossServer(): + EventShell.NotifyAllQuestDetail(curPlayer, True) #刷新人物日期状态 #GameWorld.Log('PlayerEventCounter.UpdatePlayerLoginTime') @@ -226,6 +224,128 @@ return +#// A1 08 刷新主服角色信息 #tagCMRefreshMainServerRole +# +#struct tagCMRefreshMainServerRole +#{ +# tagHead Head; +#}; +def OnRefreshMainServerRole(index, clientData, tick): + curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) + + Sync_DBPlayer(curPlayer) + + # 强刷一次属性,刷之前重置还没同步过所有属性 + curPlayer.SetDict(ChConfig.Def_PlayerKey_NotifyAllAttrState, 0) + playerControl = PlayerControl.PlayerControl(curPlayer) + playerControl.ReCalcAllState() + + if PlayerControl.GetCrossMapID(curPlayer): + CrossRealmPlayer.DoExitCrossRealm(curPlayer) + + return + +def Sync_DBPlayer(curPlayer): + ## 同步DBPlayer信息,同0102封包 + dbPlayer = ChPyNetSendPack.tagMCDBPlayer() + dbPlayer.AccID = curPlayer.GetAccID() + dbPlayer.PlayerID = curPlayer.GetPlayerID() + dbPlayer.PlayerName = curPlayer.GetPlayerName() + dbPlayer.AccState = curPlayer.GetAccState() + dbPlayer.GMLevel = curPlayer.GetGMLevel() + dbPlayer.Sex = curPlayer.GetSex() + dbPlayer.Job = curPlayer.GetJob() + dbPlayer.ReincarnationLv = curPlayer.GetReincarnationLv() + dbPlayer.LV = curPlayer.GetLV() + dbPlayer.LVEx = curPlayer.GetLVEx() + dbPlayer.LV2 = curPlayer.GetLV2() + dbPlayer.ExpPoint = curPlayer.GetExpPoint() + dbPlayer.TotalExp = curPlayer.GetTotalExp() + dbPlayer.Family = curPlayer.GetFamilyID() + dbPlayer.FamilyName = curPlayer.GetFamilyName() + dbPlayer.TeamHornor = curPlayer.GetTeamHornor() + dbPlayer.FamilyHornor = curPlayer.GetFamilyHornor() + dbPlayer.FamilyActiveValue = curPlayer.GetFamilyActiveValue() + dbPlayer.LastWeekFamilyActiveValue = curPlayer.GetLastWeekFamilyActiveValue() + dbPlayer.CountryHornor = curPlayer.GetCountryHornor() + dbPlayer.CountryLastWeekHornor = curPlayer.GetCountryLastWeekHornor() + dbPlayer.Mate = curPlayer.GetMate() + dbPlayer.Gold = curPlayer.GetGold() + dbPlayer.GoldPaper = curPlayer.GetGoldPaper() + dbPlayer.Silver = curPlayer.GetSilver() + dbPlayer.SilverPaper = curPlayer.GetSilverPaper() + dbPlayer.FightPoint = curPlayer.GetFightPoint() + dbPlayer.HappyPoint = curPlayer.GetHappyPoint() + dbPlayer.LineID = curPlayer.GetLineID() + dbPlayer.MapID = curPlayer.GetMapID() # 玩家身上的 GetMapID 返回的就是 GetDataMapID + dbPlayer.PosX = curPlayer.GetPosX() + dbPlayer.PosY = curPlayer.GetPosY() + dbPlayer.RebornMapID = curPlayer.GetRebornMapID() + dbPlayer.RebornPosX = curPlayer.GetRebornPosX() + dbPlayer.RebornPosY = curPlayer.GetRebornPosY() + dbPlayer.State = curPlayer.GetState() + dbPlayer.HP = curPlayer.GetHP() + dbPlayer.XP = curPlayer.GetXP() + dbPlayer.HPRestoreSetting = curPlayer.GetHPRestoreSetting() + dbPlayer.MPRestoreSetting = curPlayer.GetMPRestoreSetting() + dbPlayer.FreePoint = curPlayer.GetFreePoint() + dbPlayer.FreeSkillPoint = curPlayer.GetFreeSkillPoint() + dbPlayer.BaseSTR = curPlayer.GetBaseSTR() + dbPlayer.BasePNE = curPlayer.GetBasePNE() + dbPlayer.BasePHY = curPlayer.GetBasePHY() + dbPlayer.BaseCON = curPlayer.GetBaseCON() + dbPlayer.STR = curPlayer.GetSTR() + dbPlayer.PNE = curPlayer.GetPNE() + dbPlayer.PHY = curPlayer.GetPHY() + dbPlayer.CON = curPlayer.GetCON() + #dbPlayer.Setting = curPlayer.GetSetting() # 没有 + dbPlayer.PKValue = curPlayer.GetPKValue() + #dbPlayer.ActiveValue = curPlayer.GetActiveValue() # 没有 + dbPlayer.BackpackLV = curPlayer.GetBackpackLV() + dbPlayer.WarehouseLV = curPlayer.GetWarehouseLV() + dbPlayer.TeamID = curPlayer.GetTeamID() + dbPlayer.UseGoldType = curPlayer.GetUseGoldType() + dbPlayer.UseSilverType = curPlayer.GetUseSilverType() + dbPlayer.AttackMode = curPlayer.GetAttackMode() + dbPlayer.LastWeekOnlineTime = curPlayer.GetLastWeekOnlineTime() + dbPlayer.FBID = curPlayer.GetClientLineID() + dbPlayer.FamilyLV = curPlayer.GetFamilyLV() + dbPlayer.FriendFavor = curPlayer.GetFriendFavor() + dbPlayer.Energy = curPlayer.GetEnergy() + dbPlayer.EquipShowSwitch = curPlayer.GetEquipShowSwitch() + dbPlayer.LuckValue = curPlayer.GetLuckValue() + dbPlayer.ExAttr1 = curPlayer.GetExAttr1() + dbPlayer.ExAttr2 = curPlayer.GetExAttr2() + dbPlayer.ExAttr3 = curPlayer.GetExAttr3() + dbPlayer.ExAttr4 = curPlayer.GetExAttr4() + dbPlayer.ExAttr5 = curPlayer.GetExAttr5() + dbPlayer.Faction = curPlayer.GetFaction() + dbPlayer.InfamyValue = curPlayer.GetInfamyValue() + dbPlayer.OfficialRank = curPlayer.GetOfficialRank() + dbPlayer.ChangeCoinPointTotal = curPlayer.GetChangeCoinPointTotal() + dbPlayer.VIPLv = curPlayer.GetVIPLv() + dbPlayer.VIPLvForPhone = curPlayer.GetVIPLvForPhone() + dbPlayer.ExAttr6 = curPlayer.GetExAttr6() + dbPlayer.ExAttr7 = curPlayer.GetExAttr7() + dbPlayer.ExAttr8 = curPlayer.GetExAttr8() + dbPlayer.ExAttr9 = curPlayer.GetExAttr9() + dbPlayer.ExAttr10 = curPlayer.GetExAttr10() + dbPlayer.ModelMark = curPlayer.GetModelMark() + dbPlayer.ExAttr11 = curPlayer.GetExAttr11() + dbPlayer.ExAttr12 = curPlayer.GetExAttr12() + dbPlayer.ExAttr13 = curPlayer.GetExAttr13() + dbPlayer.ExAttr14 = curPlayer.GetExAttr14() + dbPlayer.OperateInfo = curPlayer.GetOperateInfo() + dbPlayer.Operate = curPlayer.GetOperate() + dbPlayer.ServerID = curPlayer.GetServerID() + dbPlayer.ExAttr15 = curPlayer.GetExAttr15() + dbPlayer.ExAttr16 = curPlayer.GetExAttr16() + dbPlayer.ExAttr17 = curPlayer.GetExAttr17() + dbPlayer.ExAttr18 = curPlayer.GetExAttr18() + dbPlayer.ExAttr19 = curPlayer.GetExAttr19() + dbPlayer.ExAttr20 = curPlayer.GetExAttr20() + NetPackCommon.SendFakePack(curPlayer, dbPlayer) + return #--------------------------------------------------------------------- ##玩家登陆游戏逻辑处理 @@ -245,21 +365,59 @@ #同步GameServer自己的地图ID curPlayer.Sync_GameServer_MapID() - SyncGuideState(curPlayer) + # 屏蔽跨服下关闭和子服重复的数据的发送 pushsend接口, notifyall正常发送 + # !!!必要发送的数据要注意位置 + if GameWorld.IsCrossServer(): + curPlayer.SetForbiddenSyncClientState(True) + __DoPlayerLoginServer(curPlayer, tick) + + # 屏蔽跨服下关闭和子服重复的数据的发送 pushsend接口, notifyall正常发送 + # !!!必要发送的数据要注意位置 + if GameWorld.IsCrossServer(): + curPlayer.SetForbiddenSyncClientState(False) + PlayerControl.SetCrossMapID(curPlayer, curPlayer.GetMapID()) # 因为主服上传数据之前该值为0,所以登录跨服后在跨服服务器要设置为对应地图 + + return + +def __DoPlayerLoginServer(curPlayer, tick): + ''' 玩家登录需要处理的内容,本服及跨服服务器分开 + ''' + + #设置上线时间 + curPlayer.SetLoginTime(GameWorld.GetCurrentDataTimeStr()) #初始化玩家背包 InitPlayerPack(curPlayer) - #通知玩家物品信息 __Sync_PackDetel(curPlayer) - #更新主服ID信息 - #UpdatePlayerServerGroupID(curPlayer) + if GameWorld.IsCrossServer(): + SkillCommon.PlayerLoginMergeServerSkillLogic(curPlayer, tick) + # 重置所有技能CD + + DoPlayerLoginInMap(curPlayer, tick) + + DataRecordPack.DR_PlayerLogin(curPlayer) + EventReport.WriteEvent_login(curPlayer) + #---玩家上线, 宠物逻辑处理--- + PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick) + + #通知运行成功 + curPlayer.BalanceServer_PlayerLoginInitOK() + return + + SyncGuideState(curPlayer) + + #上线检查一次装备属性 + ItemControler.PlayerItemControler(curPlayer).CheckRolePackEquipAttr() + #上线检查加点属性点 + PlayerControl.FixOldAddPoint(curPlayer) + + #更新服务器组ID + PlayerControl.UpdPlayerServerGroupID(curPlayer) #上线学习技能 SkillCommon.PlayerLoginCheckLearnSkill(curPlayer) - - SkillCommon.PlayerLoginMergeServerSkillLogic(curPlayer, tick) #刷新技能CD SkillCommon.PlayerLoginUpdateSkillCD(curPlayer, tick) @@ -280,12 +438,10 @@ #初始化现实时间物品 InitRealityTimeItem(curPlayer, tick) - + #---刷新了玩家属性, 登陆只刷新一次,其他地方不用刷 DoPlayerLoginInMap(curPlayer, tick) - #设置上线时间 - curPlayer.SetLoginTime(GameWorld.GetCurrentDataTimeStr()) #PlayerControl.SyncOnLineTimeTotal(curPlayer) #PlayerControl.SyncOnLineTimeLastOpenPack(curPlayer, IPY_GameWorld.rptItem) PlayerGodWeapon.OnLogin(curPlayer) @@ -301,7 +457,10 @@ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FuncChangeLineID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HighChangeLineID, 0) #GameWorld.DebugLog("离线超过10秒重置切线临时保存的相关记录值!leaveServerSecond=%s" % leaveServerSecond, curPlayer.GetPlayerID()) - + # 离线过久恢复为非跨服状态 + if PlayerControl.GetCrossMapID(curPlayer): + PlayerControl.SetCrossMapID(curPlayer, 0) + # 合服首登处理 __DoMixServerFirstLogin(curPlayer) PlayerBillboard.BillboardOnLogin(curPlayer) @@ -474,11 +633,10 @@ PlayerRecover.RecoverOnLogin(curPlayer) # # # 时装 -# PlayerCoat.OnLogin_Coat(curPlayer) -# -# # 跨服匹配 -# PlayerMergePK.MergePKOnLogin(curPlayer) -# PlayerMergeKing.MergePKOnLogin(curPlayer) + PlayerCoat.OnLogin_Coat(curPlayer) + + # 跨服PK + PlayerCrossRealmPK.DoPlayerLogin(curPlayer) # 自定义货币值同步 PlayerControl.NotifyPlayerAllCurrency(curPlayer) @@ -487,6 +645,8 @@ #消费返利 PlayerCostRebate.OnPlayerLogin(curPlayer) + #累计充值 + PlayerActTotalRecharge.OnPlayerLogin(curPlayer) #限时特惠 PlayerSpringSale.OnPlayerLogin(curPlayer) #限时礼包 @@ -521,7 +681,6 @@ #仙魔之争 GameLogic_XMZZ.OnXMZZLogin(curPlayer) PlayerOnlinePrize.OnPlayerLogin(curPlayer) - GameLogic_SealDemon.NotifyFMTDouble(curPlayer) #装备分解 PlayerEquipDecompose.PlayerLogin(curPlayer) #防沉迷 @@ -534,6 +693,8 @@ PlayerFreeGoods.OnLogin(curPlayer) # BOSS复活活动 PlayerBossReborn.OnLogin(curPlayer) + # 周狂欢活动 + PlayerWeekParty.OnLogin(curPlayer) # 仙界盛典活动 PlayerFairyCeremony.OnLogin(curPlayer) # 分支下载奖励记录通知 @@ -552,7 +713,12 @@ curPlayer.SendDBQueryRecharge() # 小助手 SyncLittleHelper(curPlayer) - + # 聊天气泡框 + SyncChatBubbleBoxState(curPlayer) + # 副本助战 + FBHelpBattle.DoPlayerLogin(curPlayer) + # 聚魂 + PlayerGatherSoul.PlayerLogin(curPlayer) curPlayer.SetState(0) # 脱机挂恢复为正常上线 curPlayer.SetFacePic(0) # 通知数据库是否保存还是下线,做一次恢复,1为保存 0为正常下线 tjgTime = PlayerTJG.GetTJGTime(curPlayer) @@ -682,8 +848,21 @@ itemManager = curPlayer.GetItemManager() for packIndex in ChConfig.Def_PlayerLoginInitPackIndexList: - itemManager.GetPack(packIndex).Sync_Refresh() - + rolePack = itemManager.GetPack(packIndex) + rolePack.Sync_Refresh() + + # 刷下装备评分,仓库可以暂不处理,取出装备后登录触发刷新 + for i in xrange(rolePack.GetCount()): + curItem = rolePack.GetAt(i) + if curItem.IsEmpty(): + continue + newScore = ItemCommon.CalcEquipGS(curItem) + hisScore = ItemCommon.GetEquipGearScore(curItem) + if hisScore != newScore: + ItemCommon.SetEquipGearScore(curItem, newScore) + GameWorld.Log("登录更新装备评分: packType=%s,i=%s,hisScore=%s,newScore=%s,itemID=%s,guid=%s" + % (packIndex, i, hisScore, newScore, curItem.GetItemTypeID(), curItem.GetGUID()), curPlayer.GetPlayerID()) + for packIndex in ChConfig.Def_VPackCnt_Dict.keys(): ItemControler.Sync_VPackItem_Refresh(curPlayer, packIndex) @@ -760,7 +939,7 @@ # @remarks 上线时通知离线时间(离线挂机功能) def __Sync_PlayerOffline(curPlayer, tick): #---等级限制--- - if GameWorld.IsMergeServer(): + if GameWorld.IsCrossServer(): return PlayerTJG.TJGDeadOffline(curPlayer) @@ -770,7 +949,7 @@ # if curPlayer.GetLV() < lvLimit: # return # -# if GameWorld.IsMergeServer(): +# if GameWorld.IsCrossServer(): # return # # #当前离线时间(分) @@ -801,20 +980,6 @@ #=============================================================================== return -def UpdatePlayerServerGroupID(curPlayer): - # 更新自己的服务器组ID, 跨服服务器不处理 - if GameWorld.IsMergeServer(): - return - serverGroupID = GameWorld.GetServerGroupID() - if not serverGroupID: - return - playerServerGroupID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ServerGroupID) - if playerServerGroupID != serverGroupID: - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ServerGroupID, serverGroupID) - GameWorld.DebugLog("更新玩家所属服务器组ID: serverGroupID=%s" % serverGroupID) - - return - #--------------------------------------------------------------------- ##玩家在地图服务器中登录ok,初始化自己 #@param curPlayer 玩家实例 @@ -843,11 +1008,20 @@ SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick) #刷新玩家的视野 - PlayerState.ChangePlayerSigh(curPlayer, tick) + if not GameWorld.IsCrossServer() and PlayerControl.GetCrossMapID(curPlayer): + GameWorld.DebugLog("===登录本服地图时,处于跨服状态,不刷新视野!", curPlayer.GetPlayerID()) + else: + PlayerState.ChangePlayerSigh(curPlayer, tick) + if GameWorld.IsCrossServer(): + curPlayer.SetForbiddenSyncClientState(False) + playerControl = PlayerControl.PlayerControl(curPlayer) #刷新所有状态 playerControl.ReCalcAllState() + + if GameWorld.IsCrossServer(): + curPlayer.SetForbiddenSyncClientState(True) #刷新已分钟单位消耗的物品(不让玩家一上线就掉耐久) curPlayer.SetProcessEquipDurgTick(tick) @@ -1188,8 +1362,11 @@ firstMission = QuestCommon.GetCommonMission(curPlayer) if not (firstMission and firstMission.GetProperty(QuestCommon.Def_NewGuyNoSight) == 1): #刷新自己的视野 - curPlayer.RefreshView() - curPlayer.SetVisible(True) + if not GameWorld.IsCrossServer() and PlayerControl.GetCrossMapID(curPlayer): + GameWorld.DebugLog("===本服LoadMapOK时玩家处于跨服状态,不设置可见!", curPlayer.GetPlayerID()) + else: + curPlayer.RefreshView() + curPlayer.SetVisible(True) #如果玩家hp为0,设置玩家为死亡状态 if curPlayer.GetHP() <= 0: @@ -1286,6 +1463,8 @@ #如果玩家上线后死亡,回程复活 isLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LoadMapIsLogin) rebornType = ChConfig.rebornType_City if isLogin else ChConfig.rebornType_System + if GameWorld.IsCrossServer(): + rebornType = ChConfig.rebornType_System PlayerRebornByType(curPlayer, rebornType, tick) elif curMap.CanMove(posX, posY) != True: @@ -1319,8 +1498,7 @@ #设置阵营 if curPlayer.GetFaction() != ChConfig.CampType_Neutral \ - and GameWorld.GetMap().GetMapID() not in ChConfig.Def_MapID_NeedCamp \ - and GameWorld.GetMap().GetMapID() not in ReadChConfig.GetEvalChConfig("MapID_NeedCamp"): + and FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) not in ChConfig.Def_MapID_NeedCamp: #重置阵营 curPlayer.SetFaction(ChConfig.CampType_Neutral) BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_Justice, tick) @@ -1341,6 +1519,7 @@ PassiveBuffEffMng.OnLoadMapGFPassive(curPlayer) ItemControler.PlayerItemControler(curPlayer).RefreshStartEquipCount() # 刷新装备珍品星级 + #EndLoadMap需放在最后 curPlayer.EndLoadMap() return True @@ -2144,31 +2323,76 @@ #根据玩家选择重生选项重生 sendPack = IPY_GameWorld.IPY_CCliectReborn() #复活类型 - playerRebornType = sendPack.GetType() + rebornType = sendPack.GetType() + GameWorld.DebugLog("玩家点击复活: rebornType=%s" % rebornType, curPlayer.GetPlayerID()) - if curPlayer.GetHP() > 0: - # 当血量大于0收到复活请求包时,一般是前后端复活状态不一致的情况下导致的 - # 由于前端需要根据复活状态判断复活界面相关逻辑,所以这里需要做一些特殊处理,防止某些情况下前后端复活状态不一致导致的一些异常问题 - - # 后端非死亡状态的情况,补同步一次复活包给前端 - if curPlayer.GetPlayerAction() != IPY_GameWorld.paDie: - SyncPlayerReborn(curPlayer, playerRebornType) - # 后端也是死亡状态的情况,直接重新触发一次复活 - else: - PlayerRebornByType(curPlayer, playerRebornType, tick) - #生命值不为0 , 不能重生 -# GameWorld.Log("玩家点击: 重生失败,生命值不为0 , 不能重生" , curPlayer.GetPlayerID()) + if GameWorld.IsCrossServer(): + GameWorld.DebugLog("跨服服务器不接受复活请求!") + return + + if PlayerControl.GetCrossMapID(curPlayer): + OnReqCrossServerReborn(curPlayer, rebornType) return #FB中禁止复活 - if FBLogic.DoFBForbidReborn(curPlayer, playerRebornType): + if FBLogic.DoFBForbidReborn(curPlayer, rebornType): PlayerControl.NotifyCode(curPlayer, "Reborn_lhs_31379") return #玩家复活 - if PlayerRebornByType(curPlayer, playerRebornType, tick): + if PlayerRebornByType(curPlayer, rebornType, tick): #玩家复活成功,判断是否在副本中复活 - PlayerReborn_InFB(curPlayer, playerRebornType, tick) + PlayerReborn_InFB(curPlayer, rebornType, tick) + + return + +def OnReqCrossServerReborn(curPlayer, rebornType): + ## 请求跨服服务器复活玩家 + + crossMapID = PlayerControl.GetCrossMapID(curPlayer) + if not crossMapID: + GameWorld.DebugLog("当前无跨服地图!") + return + + if not __CheckCanReborn(curPlayer, rebornType): + return + + msgDict = {"PlayerID":curPlayer.GetPlayerID(), "RebornType":rebornType} + GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_Reborn, msgDict) + GameWorld.DebugLog("跨服中请求复活, crossMapID=%s,msgDict=%s" % (crossMapID, msgDict), curPlayer.GetPlayerID()) + return + +def ClientServerMsg_Reborn(curPlayer, msgData, serverGroupID, tick): + ## 收到子服请求复活信息 + + rebornType = msgData["RebornType"] + gameMap = GameWorld.GetMap() + if not __CheckCanReborn(curPlayer, rebornType, gameMap): + return + + isAddReviveTired = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired) + # 跨服服务器不执行消耗,复活后同步消息回主服扣除消耗 + __DoPlayerReborn(curPlayer, rebornType, tick) + + # 发送回本服复活结果 + msgInfo = {"Result":1, "ReviveTired":isAddReviveTired} + msgInfo.update(msgData) + GameWorld.SendMsgToClientServer(ShareDefine.CrossServerMsg_RebornRet, msgInfo, [serverGroupID]) + return + +def CrossServerMsg_RebornRet(curPlayer, msgData, tick): + ## 收到跨服服务器复活结果 + + result = msgData["Result"] + if result != 1: + return + + rebornType = msgData["RebornType"] + isAddReviveTired = msgData["ReviveTired"] + __RebornCost(curPlayer, rebornType, True) + + if isAddReviveTired: + __AddReviveTired(curPlayer, tick) return @@ -2443,7 +2667,6 @@ GameWorld.Log("PlayerDisconnect!" , curPlayer.GetPlayerID()) - PlayerMergeEvent.BroadcastMergePlayerEvent() #下线了,将存储在字典中的真实XP值,设置给玩家,完成通知和存储 #curPlayer.SetXP(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue)) ####################################################################### @@ -2484,10 +2707,11 @@ #取消自动运镖状态 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_AutoTruck, 0) - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RoomID, 0) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_CrossRegisterMap, 0) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_IsCrossPKMatching, 0) #下线召回宠物 - #PetControl.ReCallFightPet(curPlayer) + PetControl.ReCallFightPet(curPlayer) PlayerTJG.CalcPlayerTJG(curPlayer, tick) @@ -2527,6 +2751,59 @@ return curPlayer.SetSetting(setting) + return + +#// A2 30 设置聊天气泡框 #tagCMSetChatBubbleBox +# +#struct tagCMSetChatBubbleBox +#{ +# tagHead Head; +# BYTE BubbleBoxType; //气泡框类型 +#}; +def OnSetChatBubbleBox(index, clientData, tick): + curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) + useBoxID = clientData.BubbleBoxType + GameWorld.DebugLog("设置使用的聊天气泡框ID: useBoxID=%s" % useBoxID, curPlayer.GetPlayerID()) + + ipyData = IpyGameDataPY.GetIpyGameData("ChatBubbleBox", useBoxID) + if not ipyData: + return + + curBoxState = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, useBoxID) + if not curBoxState: + needLV = ipyData.GetNeedLV() + if needLV and curPlayer.GetLV() < needLV: + GameWorld.DebugLog(" 等级不足,无法使用该气泡框!needLV=%s" % needLV, curPlayer.GetPlayerID()) + return + + needVIPLVGift = ipyData.GetNeedVIPLVGift() # 兼容已购买VIP礼包的老号用 + if needVIPLVGift: + record = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_VipAwardRecord) + hasBuy = record & pow(2, needVIPLVGift) + if not hasBuy: + GameWorld.DebugLog(" 未购买VIP礼包,无法使用该气泡框!needVIPLVGift=%s" % needVIPLVGift, curPlayer.GetPlayerID()) + return + + PlayerControl.SetChatBubbleBox(curPlayer, useBoxID) + return + +def DoActivateChatBubbleBox(curPlayer, boxID): + ## 激活聊天气泡框 + ipyData = IpyGameDataPY.GetIpyGameData("ChatBubbleBox", boxID) + if not ipyData: + return + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, boxID, 1) + SyncChatBubbleBoxState(curPlayer) + return True + +def SyncChatBubbleBoxState(curPlayer): + ## 同步聊天气泡框状态 + boxState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChatBubbleBoxState % 0) + if not boxState: + return + boxStatePack = ChPyNetSendPack.tagMCChatBubbleBoxState() + boxStatePack.BoxState = boxState + NetPackCommon.SendFakePack(curPlayer, boxStatePack) return #// A2 29 设置小助手 #tagCMSetLittleHelper @@ -3166,6 +3443,8 @@ sendPack.Clear() NetPackCommon.SendFakePack(curPlayer, sendPack) + + GameWorld.Log("地图切换失败", curPlayer.GetID()) return #--------------------------------------------------------------------- #=============================================================================== @@ -3511,7 +3790,7 @@ #@return 返回值无意义 #@remarks 客户端封包响应 //03 10 退出副本#tagCExitFB def __Func_ExitFB(curPlayer, tick): - if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull: + if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull and curPlayer.GetMapID() not in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4): return GameWorld.Log('玩家 = %s , 主动离开副本' % (curPlayer.GetName()) , curPlayer.GetID()) @@ -3551,6 +3830,10 @@ if changLineID < 0: GameWorld.ErrLog("ChangeLine -> 封包错误, 无此线路 = %s" % (changLineID), curPlayer.GetID()) + return + + if GameWorld.IsCrossServer(): + # 跨服服务器无法切线 return mapID = curPlayer.GetMapID() @@ -3658,54 +3941,36 @@ # curPlayer.GameServer_LineState() return - - -##获取死亡冷却时间 -#@param curPlayer 玩家实例 -#@param playerRebornType 复活类型 -#@return 死亡冷却时间 -def GetRebronTime(curPlayer, playerRebornType): - mapType = GameWorld.GetMap().GetMapFBType() +def GetRebronTime(curPlayer, rebornType): + ''' 死亡状态才验证时间,本服跨服通用 + 跨服服务器死亡的复活也是先发到本服,正常情况下本服是活着的,无法验证 + 所以可否复活由跨服服务器死亡状态下的玩家实例判断,简单讲就是哪个服务器死亡的哪个服务器判断 + 所以该函数可以直接使用玩家所在的地图判断 + ''' + + # 非死亡状态下,也就是哪个服务器角色死亡由哪个服务器判断 + if curPlayer.GetHP() > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie: + return 0 + + # 回城复活的才需要CD + if rebornType not in [ChConfig.rebornType_City, ChConfig.rebornType_MainCity]: + return 0 + # 副本地图CD + mapType = GameWorld.GetMap().GetMapFBType() if mapType != IPY_GameWorld.fbtNull: fbRebornTimeDict = IpyGameDataPY.GetFuncEvalCfg('DuplicatesRebornTime', 1) curMapID = GameWorld.GetMap().GetMapID() if curMapID in fbRebornTimeDict: return fbRebornTimeDict[curMapID] return fbRebornTimeDict.get(0, 0) - if playerRebornType in [ChConfig.rebornType_Health, ChConfig.rebornType_UseItem]: - #原地复活、道具复活不用CD - return 0 + if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired): findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0] if findBuff: if findBuff.GetSkill().GetSkillLV() == findBuff.GetSkill().GetSkillMaxLV(): return IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1)[1] return 0 - -# playerRebornTimeDict = ReadChConfig.GetEvalChConfig('PlayerRebornTime') -# -# curMapID = GameWorld.GetMap().GetMapID() -# -# #不在配表的地图ID中取默认的 -# if curMapID not in playerRebornTimeDict.keys(): -# curMapID = 0 -# -# rebronTimeByTypeDict = playerRebornTimeDict.get(curMapID, {}) -# -# if not rebronTimeByTypeDict: -# GameWorld.ErrLog("GetRebronTime rebronTimeByTypeDict=%s,,curMapID=%s" % -# (rebronTimeByTypeDict, curMapID)) -# return 0 -# -# #公式参数 -# playerLV = curPlayer.GetLV() -# playerDeadCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayerDeadCnt) -# -# rebornTime = int(eval(rebronTimeByTypeDict.get(playerRebornType, "0"))) -# -# return rebornTime - ## 死亡冷却时间是否完了 #@param curPlayer 玩家实例 @@ -3721,155 +3986,130 @@ #--------------------------------------------------------------------- -##自定义函数, 玩家复活 -#@param curPlayer 玩家实例 -#@param playerRebornType 复活类型 -#@param tick 时间戳 -#@param mapBornPlace 复活位置,默认0为原地 -#@return 返回值无意义 -#@remarks 自定义函数, 玩家复活 -def PlayerRebornByType(curPlayer, playerRebornType, tick, mapBornPlace=0): - curPlayerID = curPlayer.GetID() - curVipLv = curPlayer.GetVIPLv() + +def __CheckCanReborn(curPlayer, rebornType, gameMap=None): + ''' 检查可否复活,为了逻辑统一,这里不适用玩家所在的地图,支持跨服状态下判断跨服地图 + 本函数不验证玩家死亡状态等,因为有可能前后端复活状态不一致,如果这里拦住可能导致前端躺尸复活不了 + ''' - gameMap = GameWorld.GetMap() + if rebornType not in ChConfig.Def_RebornTypeList: + return - #需要支付的银子数量 - moneyPrice = 0 - #复活恢复血量、魔的万分比 - resetHpPercent = ChConfig.Def_MaxRateValue - resetMpPercent = ChConfig.Def_MaxRateValue + ## 由于本服及跨服地图数据不互通,所以这里根据是否有地图数据进行判断处理 + if gameMap: + playerID = curPlayer.GetPlayerID() + if rebornType in [ChConfig.rebornType_Health, ChConfig.rebornType_UseItem] and not gameMap.GetLocalReborn(): + GameWorld.ErrLog("该地图不可原地复活! mapID=%s,rebornType=%s" % (gameMap.GetMapID(), rebornType), curPlayer.GetPlayerID()) + return - #复活冷却时间(秒) - rebornTime = GetRebronTime(curPlayer, playerRebornType) - #冷却时间到了 - if not CanRebornByTimeOver(curPlayer, rebornTime): - PlayerControl.NotifyCode(curPlayer, 'RebornCD') - return False + # 验证复活CD + rebornCD = GetRebronTime(curPlayer, rebornType) + if rebornCD: + curTime = int(time.time()) + deadTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime) + if curTime - deadTime < rebornCD: + PlayerControl.NotifyCode(curPlayer, "RebornCD") + GameWorld.Log("复活冷却时间中,无法复活! curTime(%s) - deadTime(%s) < rebornCD(%s)" % (curTime, deadTime, rebornCD), playerID) + return + + # 验证复活消耗,在本服验证,跨服服务器只验证状态 + if not GameWorld.IsCrossServer(): + if not __RebornCost(curPlayer, rebornType, False): + return + + return True + +def __RebornCost(curPlayer, rebornType, isDoCost): + ## 扣除复活消耗 + # @param isDoCost: 是否执行消耗 + playerID = curPlayer.GetPlayerID() + if rebornType == ChConfig.rebornType_Health: + rebornCfg = IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1) + moneyPrice = rebornCfg[2] + costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, moneyPrice) + if not costMoneyList: + GameWorld.ErrLog("货币不足,无法原地复活! moneyPrice=%s" % (moneyPrice), playerID) + return + + if isDoCost: + for moneyType, moneyCnt in costMoneyList: + if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_Revive): + return + + elif rebornType == ChConfig.rebornType_UseItem: + rebornItem = ItemCommon.FindItemInPackByEffectEx(curPlayer, ChConfig.Def_Effect_Reborn) + if not rebornItem: + GameWorld.ErrLog("复活道具不足,无法原地复活! ", playerID) + return + + if isDoCost: + ItemCommon.DelItem(curPlayer, rebornItem, 1, True, "Reborn") + + return True + +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 - #-----------------------------------------回城复活(切换地图)----------------------------------- - if playerRebornType == ChConfig.rebornType_City: + if rebornType == ChConfig.rebornType_City: if FBLogic.OnPlayerReborn(): isFBReborn = True else: PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 1) - -#=============================================================================== -# #不在特殊的地图中,玩家副本中复活相关 -# if not FBLogic.OnPlayerReborn(): -# #输出系统提示 -# __NotifyReBornToPlace( curPlayer ) -#=============================================================================== - - - #----------------------------------------------其他复活(不切换地图)------------------------------------ - #技能复活 - elif playerRebornType == ChConfig.rebornType_Skill: - - if not gameMap.GetSkillReborn(): - return False - - reBornSkill = GameWorld.GetGameData().GetSkillBySkillID(ChConfig.Def_SkillID_SkillReBorn) - #恢复血量万分比 - resetHpPercent = reBornSkill.GetEffect(1).GetEffectValue(0) - #恢复魔万分比 - resetMpPercent = reBornSkill.GetEffect(2).GetEffectValue(0) - - BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_SkillReBorn, tick) - - #原地健康复活 - elif playerRebornType == ChConfig.rebornType_Health: - #if not PlayerVip.GetVipCanOriginalReborn(curVipLv): - # #vip等级限制 - # return - if not gameMap.GetLocalReborn(): - GameWorld.DebugLog(' 地图配置不能原地复活') - return False - - if not __HealthRebornPayMoney(curPlayer): - return False - - #使用道具(还阳咒)复活 - elif playerRebornType == ChConfig.rebornType_UseItem: - - if not gameMap.GetLocalReborn(): - return False - - if not __RebornDelItem(curPlayer): - return False - - # 副本复活 - elif playerRebornType in [ChConfig.rebornType_FBGold, ChConfig.rebornType_FBUseItem]: - isFBReborn = True - freeBorn = FBLogic.DecFreeRebornCount(curPlayer) - if not freeBorn: - if not gameMap.GetLocalReborn(): - return False - if playerRebornType == ChConfig.rebornType_FBGold: - #if not PlayerVip.GetVipCanOriginalReborn(curVipLv): - # #vip等级限制 - # return False - - if not __HealthRebornPayMoney(curPlayer): - return False - - elif playerRebornType == ChConfig.rebornType_FBUseItem: - if not __RebornDelItem(curPlayer): - return False - elif playerRebornType == ChConfig.rebornType_MainCity: + elif rebornType == ChConfig.rebornType_MainCity: PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 2) - - elif playerRebornType == ChConfig.rebornType_System: - pass - - else: - #封包错误 -# GameWorld.Log("重生封包类型 = %s错误"%(playerRebornType), curPlayerID ) - return False - + #通知客户端玩家复活成功 - curPlayer.Reborn(playerRebornType) + curPlayer.Reborn(rebornType) #执行玩家副本复活 if isFBReborn: FBLogic.OnResetFBRebornPlacePos(curPlayer, mapBornPlace, tick) #复活加无敌Buff - SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_LimitSuperBuff, tick) + if isAddSuperBuff: + SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_LimitSuperBuff, tick) #复活疲劳BUff if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired): - findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0] - if findBuff: - buffSkillLV = findBuff.GetSkill().GetSkillLV() - if findBuff.GetSkill().GetSkillMaxLV() != buffSkillLV: - buffSkillLV = buffSkillLV + 1 - else: - buffSkillLV = 1 - SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_ReviveTired, tick, buffSkillLV) - GameWorld.DebugLog(' 复活疲劳BUff buffSkillLV=%s'%(buffSkillLV)) - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsAddReviveTired,0) + __AddReviveTired(curPlayer, tick) + + #复活后清除角色身上的打BOSS和PK状态 + validTime = IpyGameDataPY.GetFuncCfg("PKConfig", 4) * 1000 + if PlayerState.IsInPKState(curPlayer): + PlayerState.SetPKStateTick(curPlayer, tick - validTime) + if PlayerState.IsInBossState(curPlayer): + PlayerState.SetBossStateTick(curPlayer, tick- validTime) - #重算属性 playerControl = PlayerControl.PlayerControl(curPlayer) playerControl.RefreshAllState() #设置血量 curPlayer.SetHP(curPlayer.GetMaxHP() * resetHpPercent / ChConfig.Def_MaxRateValue) - curPlayer.SetMP(curPlayer.GetMaxMP() * resetMpPercent / ChConfig.Def_MaxRateValue) + #curPlayer.SetMP(curPlayer.GetMaxMP() * resetMpPercent / ChConfig.Def_MaxRateValue) + #护盾 + PlayerControl.SetProDef(curPlayer, PlayerControl.GetMaxProDef(curPlayer)) #玩家复活后副本处理 - FBLogic.OnPlayerRebornOver(curPlayer, playerRebornType) - + FBLogic.OnPlayerRebornOver(curPlayer, rebornType) + + gameMap = GameWorld.GetMap() #障碍点中原地复活, 打回重生点 - if (playerRebornType == ChConfig.rebornType_City and not isFBReborn)\ - or not GameWorld.GetMap().CanMove(curPlayer.GetPosX(), curPlayer.GetPosY()) \ - or (playerRebornType == ChConfig.rebornType_MainCity and gameMap.GetRebornMapID() == curPlayer.GetMapID()): + if (rebornType == ChConfig.rebornType_City and not isFBReborn) \ + or not GameWorld.GetMap().CanMove(curPlayer.GetPosX(), curPlayer.GetPosY()) \ + or (rebornType == ChConfig.rebornType_MainCity and gameMap.GetRebornMapID() == curPlayer.GetMapID()): #玩家切换到重生点 playerControl.SetToBornPlace() - elif playerRebornType == ChConfig.rebornType_MainCity: + elif rebornType == ChConfig.rebornType_MainCity: #直接取db中配置的复活点 PlayerControl.PlayerResetWorldPos(curPlayer, gameMap.GetRebornMapID(), gameMap.GetRebornMapX(), gameMap.GetRebornMapY(), False) #重新召唤宠物 @@ -3877,57 +4117,38 @@ #复活成功,重置状态 PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull) - return True + return -##复活扣除元宝 -#@param curPlayer 玩家实例 -#@return 是否扣除成功 -def __HealthRebornPayMoney(curPlayer): - rebornCfg = IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1) - moneyPrice = rebornCfg[2] - #异常 - if not moneyPrice: - return True - costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, moneyPrice) - if not costMoneyList: - return False - infoDict = {} - for moneyType, moneyCnt in costMoneyList: - if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_Revive, infoDict): - return False +def __AddReviveTired(curPlayer, tick): + ## 增加复活疲劳 + findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0] + if findBuff: + buffSkillLV = findBuff.GetSkill().GetSkillLV() + if findBuff.GetSkill().GetSkillMaxLV() != buffSkillLV: + buffSkillLV = buffSkillLV + 1 + else: + buffSkillLV = 1 + SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_ReviveTired, tick, buffSkillLV) + GameWorld.DebugLog(' 复活疲劳BUff buffSkillLV=%s'%(buffSkillLV)) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsAddReviveTired,0) + return + +def PlayerRebornByType(curPlayer, rebornType, tick, mapBornPlace=0, isAddSuperBuff=True): + ''' 玩家复活 + ''' + gameMap = GameWorld.GetMap() + if not __CheckCanReborn(curPlayer, rebornType, gameMap): + return - GameWorld.Login_Interface_GoldRec(curPlayer , 0 , 0 , 'HealthReborn' , moneyType , moneyPrice) + if not GameWorld.IsCrossServer(): + if not __RebornCost(curPlayer, rebornType, True): + return + + __DoPlayerReborn(curPlayer, rebornType, tick, mapBornPlace, isAddSuperBuff) return True - -##复活扣除道具 -#@param curPlayer 玩家实例 -#@return 是否扣除成功 -def __RebornDelItem(curPlayer): - rebornItem = ItemCommon.FindItemInPackByEffectEx(curPlayer, ChConfig.Def_Effect_Reborn) - if not rebornItem: - #GeRen_chenxin_143504 对不起,您没有XXX! - #PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_143504", [ChConfig.Def_ItemID_Reborn]) - return False - - #调用通用接口删除道具 - ItemCommon.DelItem(curPlayer, rebornItem, 1, True, "Reborn") - return True - #--------------------------------------------------------------------- -#=============================================================================== -# def __NotifyReBornToPlace( curPlayer ): -# #普通地图 -# if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull: -# #Revival_Home <n color="0,255,0">提示:您可以在各大主城的杂货店消除身上携带的虚弱状态!</n> 256 - -# PlayerControl.NotifyCode( curPlayer, "Revival_Home" ) -# #副本中 -# elif not FBLogic.DoNotifyReBorn( curPlayer ): -# #输出默认提示 -# PlayerControl.NotifyCode( curPlayer, "Revival_Home" ) -# -# return -#=============================================================================== + ##副本接口:玩家复活 #@param curPlayer 玩家实例 #@param tick 时间戳 @@ -4180,6 +4401,18 @@ #--------------------------------------------------------------------- #--------------------------------------------------------------------- +#// C1 05 进入跨服地图 #tagCMEnterCrossServer +# +#struct tagCMEnterCrossServer +#{ +# tagHead Head; +# DWORD DataMapID; +#}; +def OnEnterCrossServer(index, clientData, tick): + curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) + PlayerControl.PlayerEnterCrossServer(curPlayer, clientData.DataMapID) + return + #=============================================================================== # //03 21 进入副本活动#tagCEnterFbGameEvent # tagCEnterFbGameEvent * GettagCEnterFbGameEvent(); @@ -4432,6 +4665,11 @@ GameWorld.DebugLog("WorldTransPort packTransportType=%s,mapID=%s,lineID=%s,exData1=%s" % (packTransportType, mapID, lineID, exData1), playerID) lineID = -1 if lineID == 255 else lineID + if GameWorld.IsCrossServer(): + if curPlayer.GetMapID() != mapID: + return + lineID = -1 # 跨服默认只能本线 + #世界传送封包允许类型(世界,大地图,任务) if packTransportType not in ChConfig.Def_PackType_TransportType.keys(): GameWorld.ErrLog('WorldTransPort packTransportType = %s, NoFind' % (packTransportType), playerID) @@ -4663,7 +4901,7 @@ #@remarks 离线经验兑换 def PlayerExpExchange(index, curPackData, tick): # 跨服服务器功能限制 - if GameWorld.IsMergeServer(): + if GameWorld.IsCrossServer(): return #兑换公式字典 @@ -5035,6 +5273,9 @@ # 领取消费返利奖励 elif rewardType == ChConfig.Def_RewardType_CostRebate: PlayerCostRebate.OnGetCostRebateAward(curPlayer, dataEx) + # 领取累计充值奖励 + elif rewardType == ChConfig.Def_RewardType_TotalRecharge: + PlayerActTotalRecharge.OnGetTotalRechargeAward(curPlayer, dataEx) # 领取boss复活活动奖励 elif rewardType == ChConfig.Def_RewardType_BossReborn: PlayerBossReborn.GetBossRebornActionAward(curPlayer, dataEx) @@ -5053,93 +5294,16 @@ # 功能开启奖励 elif rewardType == ChConfig.Def_RewardType_OpenFunc: GameFuncComm.GetFuncOpenAward(curPlayer, dataEx) -# -# # 充值豪礼奖励 -# elif rewardType == ShareDefine.Def_RewardType_GoldGift: -# PlayerGoldGift.GetPlayerGoldGift(curPlayer, dataEx) -# -# # 累计签到奖励 -# #elif rewardType == ShareDefine.Def_RewardType_DaySign: -# # PlayerSignDay.GiveSignCntAward(curPlayer, dataEx) -# -# # 天天首充奖励 -# elif rewardType == ShareDefine.Def_RewardType_DailyGold: -# PlayerGoldGift.GetPlayerDailyGoldChargeGift(curPlayer) -# -# # 单日充值多选一礼包 -# elif rewardType == ShareDefine.Def_RewardType_SingleGoldGift: -# giftLV = 0 # 默认第一档0 -# if dataExStr: -# try: -# giftLV = int(dataExStr) -# except: -# GameWorld.ErrLog("单日充值多选一礼包奖励档错误!%s" % dataExStr) -# PlayerGoldGift.GetSingleGoldGift(curPlayer, dataEx, giftLV, 0) -# -# # 当日充值无限领取礼包 -# elif rewardType == ShareDefine.Def_RewardType_UnlimitedGoldGift: -# PlayerGoldGift.GetSingleGoldGift(curPlayer, 0, 0, 1) -# -# # 登陆签到奖励 -# #elif rewardType == ShareDefine.Def_RewardType_DayLoginSign: -# # PlayerSignDay.GetDaySignAward(curPlayer, dataEx) -# -# # 跨服PK奖励 -# elif rewardType == ShareDefine.Def_RewardType_MergePKAward: -# PlayerMergePK.OnQueryMergePKAward(curPlayer, dataEx, GameWorld.ToIntDef(dataExStr), tick) -# -# # 王者争霸全服荣耀奖励 -# elif rewardType == ShareDefine.Def_RewardType_ServerHonour: -# PlayerMergeKing.GetMergeKingAward_ServerHonour(curPlayer) -# -# # 王者争霸晋级排名奖励 -# elif rewardType == ShareDefine.Def_RewardType_MergeKingRank: -# PlayerMergeKing.GetMergeKingAward_Rank(curPlayer) -# -# # 王者争霸竞猜积分奖励 -# elif rewardType == ShareDefine.Def_RewardType_MergeKingSupport: -# PlayerMergeKing.GetMergeKingAward_Support(curPlayer, dataEx, tick) -# -# # QQ成长礼包奖励 -# elif rewardType in [ShareDefine.Def_RewardType_QQUpYellow, ShareDefine.Def_RewardType_QQUpBlue]: -# PlayerQQ.GetQQUpReward(curPlayer, rewardType, dataEx) -# -# # QQ新手礼包奖励 -# elif rewardType == ShareDefine.Def_RewardType_QQNewMan: -# PlayerQQ.GetQQNewManAward(curPlayer, rewardType, dataEx) -# -# # QQ每日礼包奖励 -# elif rewardType == ShareDefine.Def_RewardType_QQDayGift: -# PlayerQQ.GetQQDayGift(curPlayer, rewardType, dataEx) -# -# # Qzone成长礼包奖励 -# elif rewardType == ShareDefine.Def_RewardType_QzoneUp: -# PlayerQQ.GetQzoneUpReward(curPlayer, rewardType, dataEx) -# -# # Qzone新手礼包奖励 -# elif rewardType == ShareDefine.Def_RewardType_QzoneNewMan: -# PlayerQQ.GetQzoneNewManAward(curPlayer, rewardType, dataEx) -# -# # Qzone每日礼包奖励 -# elif rewardType == ShareDefine.Def_RewardType_QzoneDayGift: -# PlayerQQ.GetQzoneDayGift(curPlayer, rewardType, dataEx) -# -# # 消费VIP等级奖励 -# elif rewardType == ShareDefine.Def_RewardType_CostVIPLV: -# PlayerCostVIP.GetCostVIPAward(curPlayer, dataEx) -# -# # 消费VIP成长奖励 -# elif rewardType == ShareDefine.Def_RewardType_CostVIPGrowUp: -# PlayerCostVIP.GetVIPGrowUpAward(curPlayer, dataEx) -# # 转生领奖 -# elif rewardType == ShareDefine.Def_RewardType_Reincarnation: -# PlayerReincarnation.GetReincarnationAward(curPlayer, dataEx) -# # 跨服boss首次参与奖励 -# elif rewardType == ShareDefine.Def_RewardType_MergeBossFirstJoinAward: -# GameLogic_MergeBoss.OnGetMergeBossFirstJoinAward(curPlayer) -# # 悬赏任务积分奖励 -# elif rewardType == ShareDefine.Def_RewardType_ArrestTaskAward: -# PlayerArrestTask.OnGetArrestPointAward(curPlayer, dataEx) + # 冰晶矿脉星级奖励 + elif rewardType == ChConfig.Def_RewardType_IceLodeStar: + GameLogic_IceLode.GetIceLodeStarAward(curPlayer, dataEx) + # 领取周狂欢活动奖励 + elif rewardType == ChConfig.Def_RewardType_WeekPartyAct: + PlayerWeekParty.GetWeekPartyActionAward(curPlayer, dataEx, dataExStr) + # 领取周狂欢积分奖励 + elif rewardType == ChConfig.Def_RewardType_WeekPartyPoint: + PlayerWeekParty.GetWeekPartyPointAward(curPlayer, dataEx, dataExStr) + return @@ -5340,19 +5504,6 @@ sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList]) curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCCnt, 0, 'NPCCnt', sendMsg, len(sendMsg)) - return - - -## 跨服赛报名状态 -# @param index 玩家索引 -# @param tick 当前时间 -# @return None -def SendRegisterState(curPlayer, state): - resultPack = ChPyNetSendPack.tagMergeWarRegisterState() - resultPack.Clear() - - resultPack.RegisterState = state - NetPackCommon.SendFakePack(curPlayer, resultPack) return @@ -5570,7 +5721,7 @@ sendPack.Speed = curPlayer.GetSpeed() sendPack.MoveType = moveType # NotifyAll 做过滤或者数量处理 - PlayerControl.PyNotifyAll(curPlayer, sendPack, False, -1) + PlayerControl.PyNotifyAll(curPlayer, sendPack, False, 0) return def GetDownloadAward(curPlayer, dataEx): -- Gitblit v1.8.0