| | |
| | | ## 跨服服务器是否开放中
|
| | | return GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen)
|
| | |
|
| | | def SetCrossPlayerAttrValue(curPlayer, setDict, isDelay=True):
|
| | | ''' 批量设置玩家属性值
|
| | | @param setDict: 设置属性字典 {attrName:attrValue, ...}
|
| | | @param isDelay: 是否延迟同步,比如OnDay更新的数值,可能多个玩家同时更新多个属性值,所以需要设置延迟统一同步,其他具体根据功能需要选择是否延迟
|
| | | '''
|
| | | if not setDict or not PlayerControl.GetCrossMapID(curPlayer):
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | setType = "PlayerAttr"
|
| | | msgList = str([playerID, setType, setDict, isDelay])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SetCrossPlayerAttrValue", msgList, len(msgList))
|
| | | GameWorld.DebugLog("更新跨服玩家属性: isDelay=%s,%s" % (isDelay, setDict), playerID)
|
| | | return
|
| | |
|
| | | def SetCrossPlayerNomalDict(curPlayer, setDict, isDelay=True):
|
| | | ''' 批量设置玩家字典值
|
| | | @param setDict: 设置字典, 无 dictType 信息时默认类型0 {dictKey:dictValue, dictKey:[dictValue, dictType], ...}
|
| | | @param isDelay: 是否延迟同步,比如OnDay更新的数值,可能多个玩家同时更新多个属性值,所以需要设置延迟统一同步,其他具体根据功能需要选择是否延迟
|
| | | '''
|
| | | if not setDict or not PlayerControl.GetCrossMapID(curPlayer):
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | setType = "PlayerDict"
|
| | | msgList = str([playerID, setType, setDict, isDelay])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SetCrossPlayerAttrValue", msgList, len(msgList))
|
| | | GameWorld.DebugLog("更新跨服玩家字典: isDelay=%s,%s" % (isDelay, setDict), playerID)
|
| | | return
|
| | |
|
| | | def ClientServerMsg_SetPlayerAttrValue(curPlayer, playerSetInfoList):
|
| | | ## 收到子服同步的设置跨服玩家属性值
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("收到子服同步的设置跨服玩家属性值: %s" % playerSetInfoList, playerID)
|
| | | for setType, setDict in playerSetInfoList:
|
| | | if setType == "PlayerDict":
|
| | | for dictKey, valeInfo in setDict.items():
|
| | | if isinstance(valeInfo, int):
|
| | | dictValue, dictType = valeInfo, 0
|
| | | else: |
| | | dictValue, dictType = valeInfo
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, dictKey, dictValue, dictType)
|
| | | GameWorld.DebugLog(" NomalDictSetProperty dictKey=%s, dictValue=%s, dictType=%s" % (dictKey, dictValue, dictType), playerID)
|
| | | else:
|
| | | for attrName, attrValue in setDict.items():
|
| | | if hasattr(curPlayer, attrName):
|
| | | getattr(curPlayer, attrName)(attrValue)
|
| | | GameWorld.DebugLog(" curPlayer.%s(%s)" % (attrName, attrValue))
|
| | | elif hasattr(PlayerControl, attrName):
|
| | | getattr(PlayerControl, attrName)(curPlayer, attrValue)
|
| | | GameWorld.DebugLog(" PlayerControl.%s(curPlayer, %s)" % (attrName, attrValue), playerID)
|
| | | return
|
| | |
|
| | | #// C1 04 主动退出跨服 #tagCMExitCrossRealm
|
| | | #
|
| | | #struct tagCMExitCrossRealm
|