| | |
| | | """Version = 2016-07-20 14:30"""
|
| | | #------------------------------------------------------------------------------
|
| | | import GameWorld
|
| | | import EventShell
|
| | | import PlayerControl
|
| | | import IPY_GameWorld
|
| | | import PlayerEventCounter
|
| | | import ChConfig
|
| | | import PlayerCoin
|
| | | import ChPlayer
|
| | | import ShareDefine
|
| | | #---------------------------------------------------------------------
|
| | | #记录玩家初始化过程中。积累的封包
|
| | | OnHourKey = 'PlayerGSInitOK_OnHourKey'
|
| | |
| | | OnWeekExKey = 'PlayerGSInitOK_OnWeekExKey'
|
| | | OnMonthExKey = 'PlayerGSInitOK_OnMonthExKey'
|
| | | #---------------------------------------------------------------------
|
| | | #记录玩家任务信息,积累的封包( 无任务ID )
|
| | | Mission_No_ID_OnLeaveFamily = 'Mission_No_ID_OnLeaveFamily' #离开家族触发
|
| | | Mission_No_ID_OnMemberChange = 'Mission_No_ID_OnMemberChange' #家族长变更
|
| | | #---------------------------------------------------------------------
|
| | | #记录玩家任务信息,积累的封包( 有任务ID )
|
| | | Mission_Have_ID_OnActive = 'Mission_Have_ID_OnActive' #GM开启活动
|
| | | Mission_Have_ID_OnDeActive = 'Mission_Have_ID_OnDeActive' #GM关闭活动
|
| | | Mission_Have_ID_OnMissionPub = 'Mission_Have_ID_OnMissionPub' #发布任务
|
| | | #---------------------------------------------------------------------
|
| | | #玩家离开副本
|
| | | Def_RouteServerInitOK_LeaveFBKey = 'RouteServerInitOK_LeaveFBKey' #玩家离开副本
|
| | | #---------------------------------------------------------------------
|
| | | #class IPY_MLeaveEvent
|
| | | #{
|
| | | #public:
|
| | | #
|
| | | # int GetPlayerID();
|
| | | #
|
| | | # int GetType();
|
| | | #};
|
| | |
|
| | |
|
| | | ## GameServer通知玩家离开事件
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_LeaveEvent(index, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | pack = IPY_GameWorld.IPY_MLeaveEvent()
|
| | | if curPlayer.GetID() != pack.GetPlayerID():
|
| | | #不是自己
|
| | | return
|
| | | |
| | | EventShell.DoExitEvent(curPlayer)
|
| | | return
|
| | | |
| | | #//////////////////////////////////////////////////////////////
|
| | | #//04 02 玩家扣钱#tagMPayMoney
|
| | | #tagMPayMoney * GettagMPayMoney();
|
| | | #
|
| | | #class IPY_MPayMoney
|
| | | #{
|
| | | #public:
|
| | | # //金钱类型
|
| | | # int GetMoneyType();
|
| | | # //金钱
|
| | | # int GetMoney();
|
| | | #};
|
| | |
|
| | |
|
| | | ## 付钱 04 02 玩家扣钱
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_PayMoney(index, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | pack = IPY_GameWorld.IPY_MPayMoney()
|
| | | |
| | | if curPlayer.GetID() != pack.GetPlayerID():
|
| | | #不是自己
|
| | | return
|
| | | moneyType = pack.GetMoneyType()
|
| | | moneyNum = pack.GetMoney()
|
| | | if moneyType == ShareDefine.TYPE_Price_Gold_Paper_Money:
|
| | | costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, moneyNum)
|
| | | else:
|
| | | costMoneyList = [[moneyType, moneyNum]]
|
| | | if not costMoneyList:
|
| | | return
|
| | | for moneyType, moneyCnt in costMoneyList:
|
| | | PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_GameServer)
|
| | | return
|
| | | |
| | | #//////////////////////////////////////////////////////////////
|
| | | #//01 07 经验倍率改变#tagMExpRateChange
|
| | | #tagMExpRateChange * GettagMExpRateChange();
|
| | | #
|
| | | #class IPY_MExpRateChange
|
| | | #{
|
| | | #public:
|
| | | #
|
| | | # int GetExpRate();
|
| | | #};
|
| | |
|
| | | ## 01 07 经验倍率改变
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_SetExpRate(index, tick):
|
| | | gameServerPack = IPY_GameWorld.IPY_MExpRateChange()
|
| | | expRate = gameServerPack.GetExpRate()
|
| | | #---同步世界服务器经验倍率---
|
| | | GameWorld.GetGameWorld().SetExpRate(expRate)
|
| | | GameWorld.Log("通知地图服务器经验倍率变更 = %s"%(expRate))
|
| | |
|
| | | #---通知全服玩家经验倍率变更---
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | |
| | | for i in range(0, playerManager.GetActivePlayerCount()):
|
| | | curPlayer = playerManager.GetActivePlayerByIndex(i)
|
| | |
|
| | | if not GameWorld.IsNormalPlayer(curPlayer):
|
| | | continue
|
| | | |
| | | PlayerControl.Sync_ExpRateChange(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | | #//////////////////////////////////////////////////////////////
|
| | | #//01 08 激活活动#tagMActiveEvent
|
| | | #tagMActiveEvent * GettagMActiveEvent();
|
| | | #
|
| | | #class IPY_MActiveEvent
|
| | | #{
|
| | | #public:
|
| | | #
|
| | | # int GetEventID();
|
| | | # //是否激活
|
| | | # int GetIsActive();
|
| | | # //是否只针对所选地图
|
| | | # int GetSelectMap();
|
| | | # //地图数目
|
| | | # int GetMapListCount();
|
| | | # //size = MapListCount
|
| | | # int GetMapList(int index);
|
| | | #};
|
| | |
|
| | | ## 活动地图时当前地图
|
| | | # @param pack 封包
|
| | | # @return True or False
|
| | | # @remarks 函数详细说明.
|
| | | def __IsCurrentMapInGameEventSelectMap(pack):
|
| | | for i in range(pack.GetMapListCount()):
|
| | | if pack.GetMapList(i) == GameWorld.GetGameWorld().GetMapID():
|
| | | return True
|
| | | |
| | | return False
|
| | |
|
| | | ## 01 08 激活活动
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_ActiveEvent(index, tick):
|
| | | pack = IPY_GameWorld.IPY_MActiveEvent()
|
| | | |
| | | if pack.GetSelectMap():
|
| | | #要选择地图的
|
| | | if not __IsCurrentMapInGameEventSelectMap(pack):
|
| | | return
|
| | | |
| | | if pack.GetIsActive():
|
| | | GameWorld.GetGameWorld().AddActiveEvent(pack.GetEventID())
|
| | | __ActiveGMEvent(pack.GetEventID())
|
| | | else:
|
| | | __DeActiveGMEvent(pack.GetEventID())
|
| | | GameWorld.GetGameWorld().DelActiveEvent(pack.GetEventID())
|
| | | |
| | | return
|
| | |
|
| | | ## 全服玩家都触发这个任务
|
| | | # @param missionID 事件ID
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __ActiveGMEvent(missionID):
|
| | | #全服玩家都触发这个任务
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | |
|
| | | for i in range(playerManager.OnlineCount()):
|
| | | curPlayer = playerManager.OnlineAt(i)
|
| | | if curPlayer.IsEmpty():
|
| | | continue
|
| | | |
| | | EventShell.EventResponse_OnActive(curPlayer, missionID)
|
| | | |
| | | return
|
| | |
|
| | | ## 全服玩家都取消这个任务
|
| | | # @param missionID 事件ID
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __DeActiveGMEvent(missionID):
|
| | | #全服玩家都触发这个任务
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | |
|
| | | for i in range(playerManager.OnlineCount()):
|
| | | curPlayer = playerManager.OnlineAt(i)
|
| | | if curPlayer.IsEmpty():
|
| | | continue
|
| | | |
| | | EventShell.EventResponse_OnDeActive(curPlayer, missionID)
|
| | | |
| | | return
|
| | |
|
| | | #//////////////////////////////////////////////////////////////
|
| | | #//01 10 任务发布#tagMMissionPub
|
| | | #tagMMissionPub * GettagMMissionPub();
|
| | | #
|
| | | #class IPY_MMissionPub
|
| | | #{
|
| | | #public:
|
| | | # //发布任务ID
|
| | | # int GetMissionID();
|
| | | # //发布类型(家族, 国家) TMissinoPubType
|
| | | # int GetMissinoPubType();
|
| | | # //发布ID
|
| | | # int GetPubID();
|
| | | #};
|
| | | ## 01 10 任务发布
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_MissionPub(index, tick):
|
| | | pack = IPY_GameWorld.IPY_MMissionPub()
|
| | | missionPubManager = GameWorld.GetGameWorld().GetDBMissionPubManager()
|
| | | curMissionPub = missionPubManager.AddDBMissionPub(pack.GetMissionID())
|
| | | curMissionPub.SetMissinoPubType(pack.GetMissinoPubType())
|
| | | curMissionPub.SetPubID(pack.GetPubID())
|
| | | GameWorld.Log('任务发布, ID = %s'%pack.GetPubID())
|
| | | __MissionPub(curMissionPub)
|
| | | return
|
| | |
|
| | | ## 全服玩家都触发这个任务
|
| | | # @param curMissionPub 任务发布表
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __MissionPub(curMissionPub):
|
| | | #全服玩家都触发这个任务
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | |
|
| | | for i in range(playerManager.OnlineCount()):
|
| | | curPlayer = playerManager.OnlineAt(i)
|
| | | if curPlayer.IsEmpty():
|
| | | continue
|
| | | |
| | | EventShell.CheckTrigMissionPub(curPlayer, curMissionPub)
|
| | | |
| | | return
|
| | |
|
| | | #//////////////////////////////////////////////////////////////
|
| | | #//04 03 禁止继续掉落#tagMForbiddenDrop
|
| | | #tagMForbiddenDrop * GettagMForbiddenDrop();
|
| | | #
|
| | | #class IPY_MForbiddenDrop
|
| | | #{
|
| | | #public:
|
| | | # //是否能够继续掉落
|
| | | # int GetCanDrop();
|
| | | #
|
| | | # int GetItemID();
|
| | | #
|
| | | # int GetDropFunctionType();
|
| | | #};
|
| | | ## 04 03 禁止继续掉落
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_ForbiddenDrop(index, tick):
|
| | | pack = IPY_GameWorld.IPY_MForbiddenDrop()
|
| | | itemID = pack.GetItemID()
|
| | | functionType = pack.GetDropFunctionType()
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | if pack.GetCanDrop():
|
| | | gameWorld.DelForbiddenDrop(itemID, functionType)
|
| | | else:
|
| | | gameWorld.AddForbiddenDrop(itemID, functionType)
|
| | |
|
| | | return
|
| | |
|
| | | ## 清空禁止掉落物品
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_ClearForbiddenDrop(index, tick):
|
| | | GameWorld.GetGameWorld().ClearForbiddenDrop()
|
| | | return
|
| | |
|
| | | ## GameServer通知地图服务器, 玩家保存数据到数据库
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_PlayerSave(index, tick):
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # #2009-07-04 因地图服务器有可能关闭重开,这里要判定空
|
| | | # if not curPlayer:
|
| | | # return
|
| | | |
| | | # # 1为保存 0为正常下线
|
| | | # curPlayer.SetCountryLastWeekHornor(1) # 利用此字段通知为保存数据,非下线数据
|
| | | # curPlayer.PushSaveData()
|
| | | # curPlayer.SetCountryLastWeekHornor(0) # 利用此字段通知为保存数据,非下线数据
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | | # //////////////////////////////////////////////////////////////
|
| | |
| | |
|
| | | #设置初始化成功
|
| | | curPlayer.SetGameServerInitOK(True)
|
| | | |
| | | #触发GM开关活动
|
| | | #EventShell.PlayerGMEventTrig(curPlayer)
|
| | | #触发他人发布活动
|
| | | #EventShell.PlayerMissionPubEventTrig(curPlayer)
|
| | |
|
| | | #时间缓存封包
|
| | | if Get_PlayerGameServerInitOK_OnHour(curPlayer):
|
| | |
| | | PlayerEventCounter.PlayerOnYear(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnYear(curPlayer, 0)
|
| | |
|
| | | #无任务ID的任务缓存处理
|
| | | #===========================================================================
|
| | | # if Get_Mission_No_ID_OnLeaveFamily(curPlayer):
|
| | | # EventShell.EventResponse_OnLeaveFamily(curPlayer)
|
| | | # Set_Mission_No_ID_OnLeaveFamily(curPlayer, 0)
|
| | | # |
| | | # if Get_Mission_No_ID_OnMemberChange(curPlayer):
|
| | | # EventShell.EventResponse_OnMemberChange(curPlayer)
|
| | | # Set_Mission_No_ID_OnMemberChange(curPlayer, 0)
|
| | | # |
| | | # #有任务ID的任务缓存处理 |
| | | # if Get_Mission_Have_ID_OnActive(curPlayer):
|
| | | # EventShell.EventResponse_OnActive(curPlayer , Get_Mission_Have_ID_OnActive(curPlayer))
|
| | | # Set_Mission_Have_ID_OnActive(curPlayer, 0)
|
| | | # |
| | | # if Get_Mission_Have_ID_OnDeActive(curPlayer):
|
| | | # EventShell.EventResponse_OnDeActive(curPlayer , Get_Mission_Have_ID_OnDeActive(curPlayer))
|
| | | # Set_Mission_Have_ID_OnDeActive(curPlayer, 0)
|
| | | # |
| | | # if Get_Mission_Have_ID_OnMissionPub(curPlayer):
|
| | | # EventShell.EventResponse_OnMissionPub(curPlayer , Get_Mission_Have_ID_OnMissionPub(curPlayer))
|
| | | # Set_Mission_Have_ID_OnMissionPub(curPlayer, 0)
|
| | | #===========================================================================
|
| | | |
| | | #查询是否还在申请家族列表中
|
| | | ChPlayer.QueryIsResFamily(curPlayer)
|
| | | #邮件
|
| | | PlayerControl.SendUnLoginOKPlayerMailCache(curPlayer)
|
| | | #刷新排行榜称号
|
| | |
| | | def Get_PlayerGameServerInitOK_OnYear(curPlayer):
|
| | | return curPlayer.GetDictByKey(OnYearKey)
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ## 设置离开家族触发
|
| | | # @param curPlayer 当前玩家
|
| | | # @param value keyֵ
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Set_Mission_No_ID_OnLeaveFamily(curPlayer, value):
|
| | | curPlayer.SetDict(Mission_No_ID_OnLeaveFamily, value)
|
| | | #GameWorld.Log('Set_Mission_No_ID_OnLeaveFamily, value = %s'%( value ) , curPlayer.GetID())
|
| | | return
|
| | |
|
| | | ## 获取玩家字典 离开家族
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Get_Mission_No_ID_OnLeaveFamily(curPlayer):
|
| | | return curPlayer.GetDictByKey(Mission_No_ID_OnLeaveFamily)
|
| | |
|
| | | ## 设置家族长变更
|
| | | # @param curPlayer 当前玩家
|
| | | # @param value keyֵ
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Set_Mission_No_ID_OnMemberChange(curPlayer, value):
|
| | | curPlayer.SetDict(Mission_No_ID_OnMemberChange, value)
|
| | | #GameWorld.Log('Set_Mission_No_ID_OnMemberChange, value = %s'%( value ) , curPlayer.GetID())
|
| | | return
|
| | |
|
| | | ## 获取玩家字典 家族长变更
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Get_Mission_No_ID_OnMemberChange(curPlayer):
|
| | | return curPlayer.GetDictByKey(Mission_No_ID_OnMemberChange)
|
| | | #---------------------------------------------------------------------
|
| | | #
|
| | | ## 设置GM开启活动
|
| | | # @param curPlayer 当前玩家
|
| | | # @param value keyֵ
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Set_Mission_Have_ID_OnActive(curPlayer, value):
|
| | | curPlayer.SetDict(Mission_Have_ID_OnActive, value)
|
| | | #GameWorld.Log('Set_Mission_Have_ID_OnActive, value = %s'%( value ) , curPlayer.GetID())
|
| | | return
|
| | |
|
| | | ## 获取玩家字典 GM开启活动
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Get_Mission_Have_ID_OnActive(curPlayer):
|
| | | return curPlayer.GetDictByKey(Mission_Have_ID_OnActive)
|
| | |
|
| | | #GM关闭活动
|
| | | ## 设置GM关闭活动
|
| | | # @param curPlayer 当前玩家
|
| | | # @param value keyֵ
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Set_Mission_Have_ID_OnDeActive(curPlayer, value):
|
| | | curPlayer.SetDict(Mission_Have_ID_OnDeActive, value)
|
| | | #GameWorld.Log('Set_Mission_Have_ID_OnDeActive, value = %s'%( value ) , curPlayer.GetID())
|
| | | return
|
| | |
|
| | | ## 获取玩家字典 GM关闭活动
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Get_Mission_Have_ID_OnDeActive(curPlayer):
|
| | | return curPlayer.GetDictByKey(Mission_Have_ID_OnDeActive)
|
| | |
|
| | | #发布任务
|
| | | ## 设置发布任务
|
| | | # @param curPlayer 当前玩家
|
| | | # @param value keyֵ
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Set_Mission_Have_ID_OnMissionPub(curPlayer, value):
|
| | | curPlayer.SetDict(Mission_Have_ID_OnMissionPub, value)
|
| | | #GameWorld.Log('Set_Mission_Have_ID_OnMissionPub, value = %s'%( value ) , curPlayer.GetID())
|
| | | return
|
| | |
|
| | | ## 获取玩家字典 发布任务
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def Get_Mission_Have_ID_OnMissionPub(curPlayer):
|
| | | return curPlayer.GetDictByKey(Mission_Have_ID_OnMissionPub)
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //01 15 玩家在RouteServer初始化成功#tagPlayerRouteServerInitOK
|
| | | # structtagPlayerRouteServerInitOK
|
| | |
| | | # @remarks 函数详细说明.
|
| | | def Get_PlayerRouteServerInitOK_OnLeaveFB(curPlayer):
|
| | | return curPlayer.GetDictByKey(Def_RouteServerInitOK_LeaveFBKey)
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //04 05玩家点券兑换元宝#tagPlayerCoinToGold
|
| | | # struct tagPlayerCoinToGold
|
| | | # {
|
| | | # tagHead Head;
|
| | | # DWORD PlayerID;
|
| | | # DWORD Coin;//本次兑换的点数
|
| | | # DWORD PrizeCoin; //赠送的点数 |
| | | # };
|
| | | #===============================================================================
|
| | | ##04 05玩家点券兑换元宝#tagPlayerCoinToGold
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 04 05玩家点券兑换元宝#tagPlayerCoinToGold
|
| | | def GameServer_PlayerCoinToGold(index, tick):
|
| | | #===========================================================================
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # pack = IPY_GameWorld.IPY_PlayerCoinToGold()
|
| | | # if curPlayer.GetLastOrderId() == "":
|
| | | # return
|
| | | # PlayerCoin.PlayerCoinToGold(curPlayer, pack, ChConfig.Def_GiveMoney_CoinToGold)
|
| | | #===========================================================================
|
| | | return
|
| | |
|
| | | # DB推送过来的充值信息
|
| | | def PushRecharge(index, tick):
|