66 【公会】基础主体-服务端(公会GM命令支持跨服 CreateFamily、Family、Zhenbaoge;跨服公会聊天支持,包含公会聊天缓存;查看玩家A705回包增加公会所在服务器ID信息;)
| | |
| | | PacketCMD_1=0xC2
|
| | | PacketSubCMD_1=0x10
|
| | | PacketCallFunc_1=OnSSCommMsg
|
| | |
|
| | | [GM]
|
| | | ScriptName = GM\GMShell.py
|
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 1
|
| | |
|
| | | PacketCMD_1=0xC2
|
| | | PacketSubCMD_1=0x04
|
| | | PacketCallFunc_1=OnSSGMCMD
|
| | |
| | | FamilyName = "" #(char FamilyName[33])
|
| | | FamilyEmblemID = 0 #(DWORD FamilyEmblemID)//仙盟徽章ID
|
| | | FamilyEmblemWord = "" #(char FamilyEmblemWord[3])//徽章文字
|
| | | FamilyDataServerID = 0 #(DWORD FamilyDataServerID)//公会数据所在服务器ID,A619查看公会用
|
| | | PlusDataSize = 0 #(DWORD PlusDataSize)
|
| | | PlusData = "" #(String PlusData)//扩展记录
|
| | | data = None
|
| | |
| | | self.FamilyName,_pos = CommFunc.ReadString(_lpData, _pos,33)
|
| | | self.FamilyEmblemID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.FamilyEmblemWord,_pos = CommFunc.ReadString(_lpData, _pos,3)
|
| | | self.FamilyDataServerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PlusDataSize,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PlusData,_pos = CommFunc.ReadString(_lpData, _pos,self.PlusDataSize)
|
| | | return _pos
|
| | |
| | | self.FamilyName = ""
|
| | | self.FamilyEmblemID = 0
|
| | | self.FamilyEmblemWord = ""
|
| | | self.FamilyDataServerID = 0
|
| | | self.PlusDataSize = 0
|
| | | self.PlusData = ""
|
| | | return
|
| | |
| | | length += 4
|
| | | length += 3
|
| | | length += 4
|
| | | length += 4
|
| | | length += len(self.PlusData)
|
| | |
|
| | | return length
|
| | |
| | | data = CommFunc.WriteString(data, 33, self.FamilyName)
|
| | | data = CommFunc.WriteDWORD(data, self.FamilyEmblemID)
|
| | | data = CommFunc.WriteString(data, 3, self.FamilyEmblemWord)
|
| | | data = CommFunc.WriteDWORD(data, self.FamilyDataServerID)
|
| | | data = CommFunc.WriteDWORD(data, self.PlusDataSize)
|
| | | data = CommFunc.WriteString(data, self.PlusDataSize, self.PlusData)
|
| | | return data
|
| | |
| | | FamilyName:%s,
|
| | | FamilyEmblemID:%d,
|
| | | FamilyEmblemWord:%s,
|
| | | FamilyDataServerID:%d,
|
| | | PlusDataSize:%d,
|
| | | PlusData:%s
|
| | | '''\
|
| | |
| | | self.FamilyName,
|
| | | self.FamilyEmblemID,
|
| | | self.FamilyEmblemWord,
|
| | | self.FamilyDataServerID,
|
| | | self.PlusDataSize,
|
| | | self.PlusData
|
| | | )
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C2 04 跨服GM命令 #tagSSGMCMD
|
| | |
|
| | | class tagSSGMCMD(Structure):
|
| | | Head = tagHead()
|
| | | FromServerID = 0 #(DWORD FromServerID)//哪个服发的
|
| | | ServerType = 0 #(BYTE ServerType)//服务器类型
|
| | | PlayerID = 0 #(DWORD PlayerID)//哪个玩家触发发送的
|
| | | CMDLen = 0 #(BYTE CMDLen)
|
| | | CMDStr = "" #(String CMDStr)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xC2
|
| | | self.Head.SubCmd = 0x04
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.FromServerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.ServerType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.CMDLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.CMDStr,_pos = CommFunc.ReadString(_lpData, _pos,self.CMDLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xC2
|
| | | self.Head.SubCmd = 0x04
|
| | | self.FromServerID = 0
|
| | | self.ServerType = 0
|
| | | self.PlayerID = 0
|
| | | self.CMDLen = 0
|
| | | self.CMDStr = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.CMDStr)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.FromServerID)
|
| | | data = CommFunc.WriteBYTE(data, self.ServerType)
|
| | | data = CommFunc.WriteDWORD(data, self.PlayerID)
|
| | | data = CommFunc.WriteBYTE(data, self.CMDLen)
|
| | | data = CommFunc.WriteString(data, self.CMDLen, self.CMDStr)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | FromServerID:%d,
|
| | | ServerType:%d,
|
| | | PlayerID:%d,
|
| | | CMDLen:%d,
|
| | | CMDStr:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.FromServerID,
|
| | | self.ServerType,
|
| | | self.PlayerID,
|
| | | self.CMDLen,
|
| | | self.CMDStr
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSSGMCMD=tagSSGMCMD()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSSGMCMD.Head.Cmd,m_NAtagSSGMCMD.Head.SubCmd))] = m_NAtagSSGMCMD
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C2 02 服务器连接跨服成功 #tagSSServerConnOK
|
| | |
|
| | | class tagSSServerConnOK(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C2 04 跨服GM命令 #tagSSGMCMD
|
| | |
|
| | | class tagSSGMCMD(Structure):
|
| | | Head = tagHead()
|
| | | FromServerID = 0 #(DWORD FromServerID)//哪个服发的
|
| | | ServerType = 0 #(BYTE ServerType)//服务器类型
|
| | | PlayerID = 0 #(DWORD PlayerID)//哪个玩家触发发送的
|
| | | CMDLen = 0 #(BYTE CMDLen)
|
| | | CMDStr = "" #(String CMDStr)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xC2
|
| | | self.Head.SubCmd = 0x04
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.FromServerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.ServerType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.CMDLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.CMDStr,_pos = CommFunc.ReadString(_lpData, _pos,self.CMDLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xC2
|
| | | self.Head.SubCmd = 0x04
|
| | | self.FromServerID = 0
|
| | | self.ServerType = 0
|
| | | self.PlayerID = 0
|
| | | self.CMDLen = 0
|
| | | self.CMDStr = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.CMDStr)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.FromServerID)
|
| | | data = CommFunc.WriteBYTE(data, self.ServerType)
|
| | | data = CommFunc.WriteDWORD(data, self.PlayerID)
|
| | | data = CommFunc.WriteBYTE(data, self.CMDLen)
|
| | | data = CommFunc.WriteString(data, self.CMDLen, self.CMDStr)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | FromServerID:%d,
|
| | | ServerType:%d,
|
| | | PlayerID:%d,
|
| | | CMDLen:%d,
|
| | | CMDStr:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.FromServerID,
|
| | | self.ServerType,
|
| | | self.PlayerID,
|
| | | self.CMDLen,
|
| | | self.CMDStr
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSSGMCMD=tagSSGMCMD()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSSGMCMD.Head.Cmd,m_NAtagSSGMCMD.Head.SubCmd))] = m_NAtagSSGMCMD
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C2 02 服务器连接跨服成功 #tagSSServerConnOK
|
| | |
|
| | | class tagSSServerConnOK(Structure):
|
| | |
| | | def GetGMServerIDList(curPlayer):
|
| | | ## 获取命令额外发送到其他服务器,如跨服
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会互通跨服ID:%s" % crossServerID)
|
| | | if crossServerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会已互通跨服ID:%s" % crossServerID)
|
| | | return [crossServerID]
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会未互通")
|
| | | return []
|
| | |
|
| | | def OnExecCross(crossPlayer, gmList):
|
| | | ## 跨服执行命令
|
| | | playerID = crossPlayer.GetPlayerID()
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | familyID = familyMgr.GetPlayerFamilyID(playerID)
|
| | | zoneID = familyMgr.GetFamilyZoneID(familyID)
|
| | | GameWorld.DebugAnswer(crossPlayer, "跨服公会ID:%s,zoneID=%s" % (familyID, zoneID))
|
| | | OnExec(crossPlayer, gmList)
|
| | | return
|
| | |
|
| | | def OnExec(curPlayer, gmList):
|
| | | ## 游戏服执行命令
|
| | |
|
| | | isMainServer = GameWorld.IsMainServer()
|
| | | if not gmList:
|
| | | if GameWorld.IsCrossServer():
|
| | | if not isMainServer:
|
| | | return
|
| | | GameWorld.DebugAnswer(curPlayer, "-----%s-----" % GameWorld.GetCurrentDataTimeStr())
|
| | | GameWorld.DebugAnswer(curPlayer, "创建假人公会: CreatFamily 个数 [总战力 ServerID 等级 成员数 是否审核 官职限制]")
|
| | | GameWorld.DebugAnswer(curPlayer, "删除假人公会: CreatFamily 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "输出公会列表: CreatFamily pl [条数 从第x名]")
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "添加公会成员: CreatFamily m 人数 [公会ID]")
|
| | | return
|
| | |
|
| | | if isMainServer:
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | if crossServerID:
|
| | | # 本服公会已互通不再执行本服命令
|
| | | return
|
| | | |
| | | crossPlayer = CrossPlayer.GetCrossPlayerMgr().FindCrossPlayer(curPlayer.GetPlayerID())
|
| | | if not crossPlayer:
|
| | | return
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | playerID = crossPlayer.GetPlayerID()
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | familyID = familyMgr.GetPlayerFamilyID(playerID)
|
| | | zoneID = familyMgr.GetFamilyZoneID(familyID)
|
| | | GameWorld.DebugAnswer(crossPlayer, "跨服公会ID:%s,zoneID=%s" % (familyID, zoneID))
|
| | | |
| | | value1 = gmList[0]
|
| | | if value1 == "pl":
|
| | | __printFamilyList(crossPlayer, gmList)
|
| | |
| | | #
|
| | | ##@package GM.Commands.Family
|
| | | #
|
| | | # @todo:仙盟
|
| | | # @todo:公会
|
| | | # @author hxp
|
| | | # @date 2025-10-10
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 仙盟
|
| | | # 详细描述: 公会
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-10-10 21:00"""
|
| | |
| | | import PlayerFamily
|
| | | import CrossPlayer
|
| | | import DBDataMgr
|
| | | import DBFamily
|
| | | import time
|
| | |
|
| | | def GetGMServerIDList(curPlayer):
|
| | | ## 获取命令额外发送到其他服务器,如跨服
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会互通跨服ID:%s" % crossServerID)
|
| | | if crossServerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会已互通跨服ID:%s" % crossServerID)
|
| | | return [crossServerID]
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会未互通")
|
| | | return []
|
| | |
|
| | | def OnExecCross(crossPlayer, gmList):
|
| | | ## 跨服执行命令
|
| | | playerID = crossPlayer.GetPlayerID()
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | familyID = familyMgr.GetPlayerFamilyID(playerID)
|
| | | zoneID = familyMgr.GetFamilyZoneID(familyID)
|
| | | GameWorld.DebugAnswer(crossPlayer, "跨服公会ID:%s,zoneID=%s" % (familyID, zoneID))
|
| | | OnExec(crossPlayer, gmList)
|
| | | return
|
| | |
|
| | | def OnExec(curPlayer, msgList):
|
| | | ## 游戏服执行命令
|
| | |
|
| | | isMainServer = GameWorld.IsMainServer()
|
| | | if not msgList:
|
| | | if GameWorld.IsCrossServer():
|
| | | if not isMainServer:
|
| | | return
|
| | | GameWorld.DebugAnswer(curPlayer, "-----%s-----" % GameWorld.GetCurrentDataTimeStr())
|
| | | GameWorld.DebugAnswer(curPlayer, "设置等级: Family lv 等级 经验")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置徽章: Family e 徽章ID [剩余时间秒]")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置贡献: Family c 今日贡献 累计贡献 [成员ID]")
|
| | |
| | | if not crossPlayer:
|
| | | return
|
| | |
|
| | | isMainServer = GameWorld.IsMainServer()
|
| | | value = msgList[0]
|
| | | |
| | | # 都在本服执行的
|
| | | if value == "l":
|
| | | if not isMainServer:
|
| | | return
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "设置离开: Info=%s,%s" % (leaveInfo, GameWorld.ChangeTimeNumToStr(leaveTime)))
|
| | | return
|
| | |
|
| | | if isMainServer and DBFamily.IsFamilyCross():
|
| | | GameWorld.DebugAnswer(curPlayer, "公会已跨服由跨服执行命令")
|
| | | return
|
| | | |
| | | if isMainServer:
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | if crossServerID:
|
| | | # 本服公会已互通不再执行本服命令
|
| | | return
|
| | | |
| | | familyID = crossPlayer.GetFamilyID()
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | curFamily = familyMgr.FindFamily(familyID) if familyID else None
|
| | | if not curFamily:
|
| | | GameWorld.DebugAnswer(crossPlayer, "玩家未加入仙盟!")
|
| | | GameWorld.DebugAnswer(crossPlayer, "玩家未加入公会!")
|
| | | return
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | zoneID = familyMgr.GetFamilyZoneID(familyID)
|
| | | GameWorld.DebugAnswer(crossPlayer, "跨服公会ID:%s,zoneID=%s" % (familyID, zoneID))
|
| | | |
| | | syncMemIDList = []
|
| | | if value == "lv":
|
| | | lv = msgList[1] if len(msgList) > 1 else 1
|
| | | exp = msgList[2] if len(msgList) > 2 else 0
|
| | | if not IpyGameDataPY.GetIpyGameData("Family", lv):
|
| | | GameWorld.DebugAnswer(crossPlayer, "仙盟等级不存在: %s" % (lv))
|
| | | GameWorld.DebugAnswer(crossPlayer, "公会等级不存在: %s" % (lv))
|
| | | return
|
| | | curFamily.SetLV(lv)
|
| | | curFamily.SetExp(exp)
|
| | | GameWorld.DebugAnswer(crossPlayer, "设置仙盟等级:%s, exp=%s" % (lv, exp))
|
| | | GameWorld.DebugAnswer(crossPlayer, "设置公会等级:%s, exp=%s" % (lv, exp))
|
| | |
|
| | | elif value == "e":
|
| | | emblemID = msgList[1] if len(msgList) > 1 else 0
|
| | |
| | |
|
| | | elif value == "n":
|
| | | PlayerFamily.SetRenameTime(curFamily, 0)
|
| | | GameWorld.DebugAnswer(crossPlayer, "重置改名CD")
|
| | | GameWorld.DebugAnswer(crossPlayer, "重置公会改名CD")
|
| | |
|
| | | elif value == "c":
|
| | | contribDay = msgList[1] if len(msgList) > 1 else 0
|
| | |
| | | member.SetContribDay(contribDay)
|
| | | member.SetContribTotal(contribTotal)
|
| | | GameWorld.DebugAnswer(crossPlayer, "设置贡献:%s/%s, ID:%s" % (contribDay, contribTotal, memID))
|
| | | syncMemIDList.append(memID)
|
| | |
|
| | | elif value == "ml":
|
| | | memID = msgList[1] if len(msgList) > 1 else 0
|
| | |
| | | return
|
| | | member.SetOffTime(int(time.time()) - logoutMinutes * 60)
|
| | | GameWorld.DebugAnswer(crossPlayer, "成员ID:%s,离线时间:%s" % (memID, GameWorld.ChangeTimeNumToStr(member.GetOffTime())))
|
| | | syncMemIDList.append(memID)
|
| | |
|
| | | PlayerFamily.Sync_FamilyInfo(crossPlayer)
|
| | | isSyncMem = True if syncMemIDList else False
|
| | | PlayerFamily.Sync_FamilyInfo(crossPlayer, syncMemIDList=syncMemIDList, isSyncMem=isSyncMem)
|
| | | return
|
| | |
| | |
|
| | | import ChConfig
|
| | | import GameWorld
|
| | | import CrossPlayer
|
| | | import PlayerControl
|
| | | import PlayerFamilyZhenbaoge
|
| | | import PlayerFamily
|
| | |
| | | import random
|
| | | import time
|
| | |
|
| | | ## GM命令执行入口
|
| | | # @param curPlayer 当前玩家
|
| | | # @param msgList 参数列表 [addSkillID]
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GetGMServerIDList(curPlayer):
|
| | | ## 获取命令额外发送到其他服务器,如跨服
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | if crossServerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会已互通跨服ID:%s" % crossServerID)
|
| | | return [crossServerID]
|
| | | GameWorld.DebugAnswer(curPlayer, "本服公会未互通")
|
| | | return []
|
| | |
|
| | | def OnExec(curPlayer, msgList):
|
| | |
|
| | | isMainServer = GameWorld.IsMainServer()
|
| | | if not msgList:
|
| | | if not isMainServer:
|
| | | return
|
| | | GameWorld.DebugAnswer(curPlayer, "-----%s-----" % GameWorld.GetCurrentDataTimeStr())
|
| | | GameWorld.DebugAnswer(curPlayer, "重置公会珍宝阁: Zhenbaoge 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置今日状态值: Zhenbaoge d")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置退公会时间: Zhenbaoge ft x分钟前")
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "AB值没有填则按常规砍价价格计算")
|
| | | return
|
| | |
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if not familyID:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有仙盟")
|
| | | return
|
| | | curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
|
| | | if not curFamily:
|
| | | crossPlayer = CrossPlayer.GetCrossPlayerMgr().FindCrossPlayer(curPlayer.GetPlayerID())
|
| | | if not crossPlayer:
|
| | | return
|
| | |
|
| | | value1 = msgList[0]
|
| | | if value1 == 0:
|
| | | PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置仙盟珍宝阁OK")
|
| | | familyID = crossPlayer.GetFamilyID()
|
| | | if not familyID:
|
| | | GameWorld.DebugAnswer(crossPlayer, "没有仙盟")
|
| | | return
|
| | | |
| | | elif value1 == "d":
|
| | | value1 = msgList[0]
|
| | | |
| | | # 默认本服执行的
|
| | | if value1 == "d":
|
| | | if not isMainServer:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 0)
|
| | | PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer)
|
| | |
| | | return
|
| | |
|
| | | elif value1 == "ft":
|
| | | if not isMainServer:
|
| | | return
|
| | | minutes = msgList[1] if len(msgList) > 1 else 0
|
| | | leaveFamilyTimeEx = int(time.time()) - minutes * 60
|
| | | PlayerControl.SetLeaveFamilyTimeEx(curPlayer, leaveFamilyTimeEx)
|
| | | GameWorld.DebugAnswer(curPlayer, "设置退仙盟时间:%s" % GameWorld.ChangeTimeNumToStr(leaveFamilyTimeEx))
|
| | | return
|
| | |
|
| | | if isMainServer:
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | if crossServerID:
|
| | | # 本服公会已互通不再执行本服命令
|
| | | return
|
| | | |
| | | # 本服、跨服通用
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | curFamily = familyMgr.FindFamily(familyID)
|
| | | if not curFamily:
|
| | | GameWorld.DebugAnswer(crossPlayer, "玩家未加入公会!")
|
| | | return
|
| | | |
| | | if GameWorld.IsCrossServer():
|
| | | zoneID = familyMgr.GetFamilyZoneID(familyID)
|
| | | GameWorld.DebugAnswer(crossPlayer, "跨服公会ID:%s,zoneID=%s" % (familyID, zoneID))
|
| | | |
| | | if value1 == 0:
|
| | | PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
|
| | | GameWorld.DebugAnswer(crossPlayer, "重置仙盟珍宝阁OK")
|
| | | return
|
| | | |
| | | #添加假砍价
|
| | | gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)
|
| | | if not gActionData:
|
| | | GameWorld.DebugAnswer(curPlayer, "请先重置珍宝阁")
|
| | | GameWorld.DebugAnswer(crossPlayer, "请先重置珍宝阁")
|
| | | return
|
| | |
|
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, PlayerFamilyZhenbaoge.ActionType)
|
| | |
| | | actionData = PlayerFamilyZhenbaoge.AddCutPrice(familyID, playerID, playerName, cutPrice, gActionData, False)
|
| | | syncActionDataList.append(actionData)
|
| | | nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
|
| | | GameWorld.DebugAnswer(curPlayer, "砍价人次:%s,砍价:%s,现价:%s" % (fackID % 1000, cutPrice, nowPrice))
|
| | | GameWorld.DebugAnswer(crossPlayer, "砍价人次:%s,砍价:%s,现价:%s" % (fackID % 1000, cutPrice, nowPrice))
|
| | |
|
| | | PlayerFamily.SendFamilyAction(syncActionDataList)
|
| | | nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
|
| | | GameWorld.DebugAnswer(curPlayer, "添加假砍价数:%s,总砍价数:%s,当前价格:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
|
| | | GameWorld.DebugAnswer(crossPlayer, "添加假砍价数:%s,总砍价数:%s,当前价格:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
|
| | | return
|
| | |
| | | import Commands
|
| | | import IPY_GameWorld
|
| | | import DataRecordPack
|
| | | import ChServerToServerPyPack
|
| | | import NetPackCommon
|
| | | import PlayerControl
|
| | | import ReadChConfig
|
| | | import traceback
|
| | | import FBLogic
|
| | | import GameObj
|
| | | import CrossMsg
|
| | | import ShareDefine
|
| | | import CrossPlayer
|
| | | #---------------------------------------------------------------------
|
| | |
| | | continue
|
| | | inputList[i] = value
|
| | |
|
| | | if GameWorld.IsMainServer():
|
| | | callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "GetGMServerIDList"))
|
| | | if callFunc != None:
|
| | | gmServerIDList = callFunc(curPlayer)
|
| | | if gmServerIDList:
|
| | | CrossMsg.SendToCrossServer(ShareDefine.S2C_GMCMD, {"CMD":inputList}, gmServerIDList, curPlayer.GetPlayerID())
|
| | | |
| | | |
| | | callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnExec"))
|
| | | if callFunc:
|
| | | #删除命令,只将参数传入
|
| | | callFunc(curPlayer, inputList[1:])
|
| | | DR_UseGMCMD(curPlayer, inputStr)
|
| | | |
| | | # 检查是否额外发给其他跨服服务器
|
| | | if GameWorld.IsMainServer():
|
| | | callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "GetGMServerIDList"))
|
| | | if callFunc != None:
|
| | | gmServerIDList = callFunc(curPlayer)
|
| | | pack = ChServerToServerPyPack.tagSSGMCMD()
|
| | | pack.FromServerID = GameWorld.GetGameWorld().GetServerID()
|
| | | pack.ServerType = GameWorld.GetServerType()
|
| | | pack.PlayerID = curPlayer.GetPlayerID()
|
| | | pack.CMDStr = str(inputList)
|
| | | pack.CMDLen = len(pack.CMDStr)
|
| | | NetPackCommon.SendCrossServerToServerPack(pack, gmServerIDList, dirType=ShareDefine.dirType_Cross)
|
| | | return
|
| | |
|
| | | # GameObj 的 Get、Set函数
|
| | |
| | | # raise Exception(errorMsg)
|
| | | return
|
| | |
|
| | | def S2C_GMCMD(dataMsg, fromServerID, playerID):
|
| | | cmdList = dataMsg["CMD"]
|
| | | |
| | | callName = "%s.%s" % (cmdList[0], "OnExecCross")
|
| | | callFunc = GameWorld.GetExecFunc(Commands, callName)
|
| | | if callFunc == None:
|
| | | GameWorld.ErrLog("找不到此GM命令处理函数%s" % callName)
|
| | | return
|
| | | GameWorld.Log("跨服执行GM命令:%s" % cmdList)
|
| | | |
| | | #// C2 04 跨服GM命令 #tagSSGMCMD
|
| | | #
|
| | | #struct tagSSGMCMD
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD FromServerID; //哪个服发的
|
| | | # BYTE ServerType; //服务器类型
|
| | | # DWORD PlayerID; //哪个玩家触发发送的
|
| | | # BYTE CMDLen;
|
| | | # char CMDStr[CMDLen];
|
| | | #};
|
| | | def OnSSGMCMD(netPack):
|
| | | fromServerID = netPack.FromServerID
|
| | | playerID = netPack.PlayerID
|
| | | cmdStr = netPack.CMDStr
|
| | | GameWorld.Log("OnSSGMCMD cmdStr=%s,fromServerID=%s" % (cmdStr, fromServerID), playerID)
|
| | | crossPlayer = CrossPlayer.GetCrossPlayerMgr().FindCrossPlayer(playerID)
|
| | | if not crossPlayer:
|
| | | crossPlayer = CrossPlayer.GetCrossPlayerMgr().RegistPlayer(playerID)
|
| | | |
| | | #只将实际参数传入
|
| | | callFunc(crossPlayer, cmdList[1:])
|
| | | GameWorld.ErrLog("本服找不到crossPlayer!", playerID)
|
| | | return
|
| | | cmdList = eval(cmdStr)
|
| | | callFunName = cmdList[0]
|
| | | callName = "%s.%s" % (callFunName, "OnExec")
|
| | | callFunc = GameWorld.GetExecFunc(Commands, callName)
|
| | | if not callFunc:
|
| | | GameWorld.DebugAnswer(crossPlayer, "找不到该跨服命令! %s" % callName)
|
| | | return
|
| | | try:
|
| | | #只将实际参数传入
|
| | | callFunc(crossPlayer, cmdList[1:])
|
| | | except BaseException:
|
| | | GameWorld.DebugAnswer(crossPlayer, "跨服执行GM命令错误!serverID=%s" % GameWorld.GetGameWorld().GetServerID())
|
| | | errorMsg = str(traceback.format_exc())
|
| | | GameWorld.ErrLog('GM命令错误 - > %s' % errorMsg, crossPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | ## 使用GM命令流向
|
| | |
| | | import ShareDefine
|
| | | import NetPackCommon
|
| | | import ChServerToServerPyPack
|
| | | from GM import GMShell
|
| | | import PlayerViewCache
|
| | | import PlayerFamily
|
| | | import CrossPlayer
|
| | |
| | | DBFamily.S2C_FamilyData(dataMsg, fromServerID)
|
| | | elif msgType == ShareDefine.S2C_FamilyPyPack: # 公会功能玩家请求py包转发
|
| | | PlayerFamily.S2C_FamilyPyPack(dataMsg, fromServerID, playerID)
|
| | | elif msgType == ShareDefine.S2C_GMCMD:
|
| | | GMShell.S2C_GMCMD(dataMsg, fromServerID, playerID)
|
| | |
|
| | | # 游戏服务器要处理的消息
|
| | | elif curServerType == ShareDefine.serverType_Main:
|
| | |
| | | import PlayerMail
|
| | | import PlayerTask
|
| | | import CrossPlayer
|
| | | import PlayerTalk
|
| | | import DirtyList
|
| | | import DBDataMgr
|
| | | import DBFamily
|
| | |
| | | ## 玩家上线,游戏服跨服通用,流程上当做以前GameServer处理公会一样,处理后再通知地图(现在的游戏服)
|
| | | PlayerLoginRefreshFamily(crossPlayer)
|
| | | Sync_RequestAddFamilyInfo(crossPlayer, False)
|
| | | PlayerTalk.NotifyTalkCache(crossPlayer, [IPY_GameWorld.tcFamily]) # 公会聊天缓存
|
| | | #PlayerFamilyTaofa.OnPlayerLogin(curPlayer) 讨伐待修改
|
| | | return
|
| | |
|
| | |
| | | CrossPlayer.SendFakePackByFamily(familyID, clientPack)
|
| | | return
|
| | |
|
| | | def OnFamilyTalk(curPlayer, familyID, talkPack, tick):
|
| | | clientData, tick = None, 0
|
| | | reqDataEx = {"talkBuffer":talkPack.GetBuffer()}
|
| | | FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnFamilyTalk", reqCD=0, reqDataEx=reqDataEx)
|
| | | return
|
| | | def __OnFamilyTalk(crossPlayer, clientData, tick, fromServerID=0, reqDataEx=None):
|
| | | talkBuffer = reqDataEx["talkBuffer"]
|
| | | playerID = crossPlayer.GetPlayerID()
|
| | | familyID = crossPlayer.GetFamilyID()
|
| | | if not familyID or not talkBuffer:
|
| | | return
|
| | | clientPack = ChPyNetSendPack.tagMCTalk()
|
| | | clientPack.ReadData(talkBuffer)
|
| | | |
| | | CrossPlayer.SendFakePackByFamily(familyID, clientPack)
|
| | | |
| | | # 聊天缓存
|
| | | channelType = clientPack.ChannelType
|
| | | content = clientPack.Content
|
| | | bubbleBox = clientPack.BubbleBox
|
| | | PlayerTalk.DoTalkCache(channelType, playerID, content, bubbleBox, familyID)
|
| | | return
|
| | |
|
| | | ## -------------------------------------- 游戏服本服处理 --------------------------------------------
|
| | | '''
|
| | | 为方便本服、跨服互通公会逻辑统一,公会相关数据处理统一使用 CrossPlayer,视为以前的GameServer处理,这样本服跨服的公会管理通用
|
| | |
| | | import IpyGameDataPY
|
| | | import PlayerControl
|
| | | import PlayerFamily
|
| | | import CrossPlayer
|
| | | import DBDataMgr
|
| | |
|
| | | import math
|
| | |
| | | }
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | NotifyTalkCache(curPlayer)
|
| | | crossPlayer = CrossPlayer.GetCrossPlayerMgr().FindCrossPlayer(curPlayer.GetPlayerID())
|
| | | NotifyTalkCache(crossPlayer, [IPY_GameWorld.tcWorld])
|
| | | return
|
| | |
|
| | | #// B3 20 聊天 #tagCSTalk
|
| | |
| | |
|
| | | if channelType == IPY_GameWorld.tcWorld:
|
| | | NetPackCommon.SendFackPackOnline(clientPack)
|
| | | DoTalkCache(channelType, playerID, content, bubbleBox, familyID)
|
| | | elif channelType == IPY_GameWorld.tcFamily:
|
| | | PlayerFamily.Broadcast_FamilyPack(familyID, clientPack)
|
| | | PlayerFamily.OnFamilyTalk(curPlayer, familyID, clientPack, tick)
|
| | |
|
| | | DoTalkCache(channelType, playerID, content, bubbleBox, familyID)
|
| | | return
|
| | |
|
| | | def __CheckTalk(curPlayer, channelType, content, tick, checkGMForbidenTalk=True):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def NotifyTalkCache(curPlayer):
|
| | | def NotifyTalkCache(crossPlayer, channelTypeList):
|
| | | ##上线通知聊天缓存
|
| | | |
| | | # @param channelTypeList: 指定需要通知聊天缓存频道列表,不同频道的缓存可能存储在不同的服务器,如公会在公会数据所在服等
|
| | | if not crossPlayer:
|
| | | return
|
| | | for channelType in ChannelCacheMax.keys():
|
| | | if channelType not in channelTypeList:
|
| | | continue
|
| | | cacheList = []
|
| | | if channelType == IPY_GameWorld.tcFamily:
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | familyID = crossPlayer.GetFamilyID()
|
| | | if not familyID:
|
| | | continue
|
| | | familyActonMgr = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ShareDefine.Def_ActionType_TalkCache)
|
| | |
| | | clientPack.ChannelType = channelType
|
| | | clientPack.InfoList = packCacheList
|
| | | clientPack.Count = len(clientPack.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | CrossPlayer.SendFakePack(crossPlayer, clientPack)
|
| | |
|
| | | return
|
| | |
| | | clientPack.ServerID = curCache.GetServerID()
|
| | | clientPack.FightPower = curCache.GetFightPower()
|
| | | clientPack.FightPowerEx = curCache.GetFightPowerEx()
|
| | | clientPack.FamilyID = curCache.GetFamilyID()
|
| | | familyID = curCache.GetFamilyID()
|
| | | familyDataServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | if familyDataServerID <= 0:
|
| | | familyDataServerID = GameWorld.GetGameWorld().GetServerID() # 公会未跨服时默认就是玩家所在服
|
| | | clientPack.FamilyID = familyID
|
| | | clientPack.FamilyName = curCache.GetFamilyName()
|
| | | clientPack.FamilyEmblemID = curCache.GetFamilyEmblemID()
|
| | | clientPack.FamilyEmblemWord = curCache.GetFamilyEmblemWord()
|
| | | clientPack.FamilyDataServerID = familyDataServerID
|
| | | clientPack.PlusData = curCache.GetPlusData()
|
| | | clientPack.PlusDataSize = len(clientPack.PlusData)
|
| | | return clientPack
|
| | |
| | | S2C_PlayerBaseInfo = "S2C_PlayerBaseInfo" # 玩家基础信息同步
|
| | | S2C_FamilyData = "S2C_FamilyData" # 公会首次跨服互通时同步数据
|
| | | S2C_FamilyPyPack = "S2C_FamilyPyPack" # 公会功能玩家请求包
|
| | | S2C_GMCMD = "S2C_GMCMD" # GM命令
|
| | |
|
| | | # 游戏服 -> 任意服务器
|
| | | S2S_ViewTagFamily = "S2S_ViewTagFamily" # 查看目标公会
|