10261 【越南】【砍树】仙盟徽章,头像框,头像(动态),聊天气泡,聊天表情(增加仙盟徽章)
| | |
| | | BYTE BossFBCnt; //BOSS副本次数
|
| | | };
|
| | |
|
| | | //仙盟徽章表
|
| | |
|
| | | struct tagFamilyEmblem
|
| | | {
|
| | | BYTE _EmblemID; //徽章ID
|
| | | BYTE UnlockFamilyLV; //解锁仙盟等级,为0时代表其他方式解锁
|
| | | DWORD ExpireMinutes; //有效时长,分钟
|
| | | };
|
| | |
|
| | | //仙盟试炼伤血奖励表
|
| | |
|
| | | struct tagFamilyBossHurtAward
|
| | |
| | | Writer = Alee
|
| | | Releaser = Alee
|
| | | RegType = 0
|
| | | RegisterPackCount = 9
|
| | | RegisterPackCount = 10
|
| | |
|
| | | PacketCMD_1=0xA4
|
| | | PacketSubCMD_1=0x01
|
| | |
| | | PacketSubCMD_9=0x12
|
| | | PacketCallFunc_9=PySearchFamily
|
| | |
|
| | | PacketCMD_10=0xA4
|
| | | PacketSubCMD_10=0x13
|
| | | PacketCallFunc_10=OnChangeFamilyEmblem
|
| | |
|
| | | [GameWorldFamilyWar]
|
| | | ScriptName = GameWorldLogic\GameWorldFamilyWar.py
|
| | | Writer = hxp
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A4 13 修改家族徽章 #tagCGChangeFamilyEmblem
|
| | |
|
| | | class tagCGChangeFamilyEmblem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("EmblemID", c_ubyte), # 更换的徽章ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA4
|
| | | self.SubCmd = 0x13
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA4
|
| | | self.SubCmd = 0x13
|
| | | self.EmblemID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCGChangeFamilyEmblem)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A4 13 修改家族徽章 //tagCGChangeFamilyEmblem:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | EmblemID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.EmblemID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCGChangeFamilyEmblem=tagCGChangeFamilyEmblem()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGChangeFamilyEmblem.Cmd,m_NAtagCGChangeFamilyEmblem.SubCmd))] = m_NAtagCGChangeFamilyEmblem
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A4 08 查询家族行为信息 #tagCGQueryFamilyAction
|
| | |
|
| | | class tagCGQueryFamilyAction(Structure):
|
| | |
| | | Head = tagHead()
|
| | | Name = "" #(char Name[33])
|
| | | FakeID = 0 #(WORD FakeID)//假仙盟编号
|
| | | EmblemID = 0 #(BYTE EmblemID)//选择徽章ID,解锁仙盟等级为1级的均为可选ID
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.Name,_pos = CommFunc.ReadString(_lpData, _pos,33)
|
| | | self.FakeID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.EmblemID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.Head.SubCmd = 0x04
|
| | | self.Name = ""
|
| | | self.FakeID = 0
|
| | | self.EmblemID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += self.Head.GetLength()
|
| | | length += 33
|
| | | length += 2
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteString(data, 33, self.Name)
|
| | | data = CommFunc.WriteWORD(data, self.FakeID)
|
| | | data = CommFunc.WriteBYTE(data, self.EmblemID)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | Name:%s,
|
| | | FakeID:%d
|
| | | FakeID:%d,
|
| | | EmblemID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Name,
|
| | | self.FakeID
|
| | | self.FakeID,
|
| | | self.EmblemID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | WarRank = 0 #(BYTE WarRank)//联赛排名
|
| | | TotalFightPower = 0 #(DWORD TotalFightPower)//总战力,不足1个亿的部分
|
| | | TotalFightPowerEx = 0 #(DWORD TotalFightPowerEx)//总战力点,1点=1亿
|
| | | EmblemID = 0 #(BYTE EmblemID)//徽章ID
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.WarRank,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.TotalFightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.TotalFightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.EmblemID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.WarRank = 0
|
| | | self.TotalFightPower = 0
|
| | | self.TotalFightPowerEx = 0
|
| | | self.EmblemID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.WarRank)
|
| | | data = CommFunc.WriteDWORD(data, self.TotalFightPower)
|
| | | data = CommFunc.WriteDWORD(data, self.TotalFightPowerEx)
|
| | | data = CommFunc.WriteBYTE(data, self.EmblemID)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | JoinAccept:%d,
|
| | | WarRank:%d,
|
| | | TotalFightPower:%d,
|
| | | TotalFightPowerEx:%d
|
| | | TotalFightPowerEx:%d,
|
| | | EmblemID:%d
|
| | | '''\
|
| | | %(
|
| | | self.FamilyIndex,
|
| | |
| | | self.JoinAccept,
|
| | | self.WarRank,
|
| | | self.TotalFightPower,
|
| | | self.TotalFightPowerEx
|
| | | self.TotalFightPowerEx,
|
| | | self.EmblemID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | #---------------------------------------------------------------------
|
| | | #"""Version = 2016-06-06 22:00"""
|
| | | #---------------------------------------------------------------------
|
| | | import PlayerFamilyEmblem
|
| | | import PlayerFamily
|
| | | import GameWorld
|
| | | #---------------------------------------------------------------------
|
| | |
| | | Def_FamilyInfo_FightPower, # 设置家族总战力
|
| | | Def_FamilyInfo_BossFood, # 设置家族兽粮
|
| | | Def_FamilyInfo_WeekMissionMoney, # 本周任务资金
|
| | | ) = range(6)
|
| | | Def_FamilyInfo_Emblem, # 徽章
|
| | | ) = range(7)
|
| | |
|
| | | #系统提示信息表
|
| | | Def_MsgDict = {
|
| | |
| | | Def_FamilyInfo_FightPower:'总战力',
|
| | | Def_FamilyInfo_BossFood:'兽粮',
|
| | | Def_FamilyInfo_WeekMissionMoney:'本周任务资金',
|
| | | "all":'所有属性',
|
| | | Def_FamilyInfo_Emblem:'设置徽章',
|
| | | }
|
| | |
|
| | | #设置全部属性时需要设置的属性类型, 一般用于快速测试用
|
| | | Def_SetAllFamilyInfoList = [Def_FamilyInfo_Money]
|
| | | #---------------------------------------------------------------------
|
| | | ## 执行逻辑
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(curPlayer, cmdList):
|
| | | if len(cmdList) != 2:
|
| | | if not cmdList:
|
| | | helpStr = ""
|
| | | for index, name in Def_MsgDict.items():
|
| | | helpStr = helpStr + "%s-%s," % (index, name)
|
| | | GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 类型 数值')
|
| | | GameWorld.DebugAnswer(curPlayer, '%s' % helpStr)
|
| | | #GameWorld.DebugAnswer(curPlayer, ' 特殊: SetFamilyInfo all, 数值; 可设置所有战盟属性数值')
|
| | | GameWorld.DebugAnswer(curPlayer, '设置徽章: %s 徽章ID [剩余时间秒]' % Def_FamilyInfo_Emblem)
|
| | | return
|
| | |
|
| | | curFamily = curPlayer.GetFamily()
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 错误 玩家无家族')
|
| | | return
|
| | |
|
| | | funcType, funcValue = cmdList
|
| | | infoTypeList = [funcType]
|
| | | if funcType == "all":
|
| | | infoTypeList = Def_SetAllFamilyInfoList
|
| | | |
| | | __SetFamilyInfoValue(curPlayer, curFamily, infoTypeList, funcValue)
|
| | | funcType = cmdList[0]
|
| | | funcValue = cmdList[1] if len(cmdList) > 1 else 0
|
| | | |
| | | if not __SetFamilyInfoValue(curPlayer, curFamily, funcType, funcValue, cmdList):
|
| | | GameWorld.DebugAnswer(curPlayer, '设置家族%s 失败, 数值 = %s'%(Def_MsgDict[funcType], funcValue))
|
| | | return
|
| | | |
| | | #通知客户端刷新
|
| | | curFamily.Broadcast_FamilyChange()
|
| | | #通知地图服务器刷新
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, '设置家族%s 成功, 数值 = %s'%(Def_MsgDict[funcType], funcValue))
|
| | | return
|
| | |
|
| | | def __SetFamilyInfoValue(curPlayer, curFamily, infoTypeList, funcValue):
|
| | | def __SetFamilyInfoValue(curPlayer, curFamily, funcType, funcValue, cmdList):
|
| | | isLVUP = False
|
| | | isSort = False
|
| | |
|
| | | for funcType in infoTypeList:
|
| | | |
| | | if funcType == Def_FamilyInfo_LV:
|
| | | curFamily.SetLV(funcValue)
|
| | | isSort = True
|
| | |
|
| | | if funcType == Def_FamilyInfo_LV:
|
| | | curFamily.SetLV(funcValue)
|
| | | isSort = True
|
| | | |
| | | elif funcType == Def_FamilyInfo_Money:
|
| | | curFamily.SetMoney(funcValue)
|
| | | isLVUP = True
|
| | | if funcValue == 0:
|
| | | PlayerFamily.SetCurWeekMissionMoney(curFamily, 0)
|
| | | |
| | | elif funcType == Def_FamilyInfo_WarRank:
|
| | | PlayerFamily.SetFamilyWarRank(curFamily, funcValue)
|
| | | isSort = True
|
| | | |
| | | elif funcType == Def_FamilyInfo_FightPower:
|
| | | PlayerFamily.SetFamilyTotalFightPower(curFamily, funcValue)
|
| | | isSort = True
|
| | | |
| | | elif funcType == Def_FamilyInfo_BossFood:
|
| | | PlayerFamily.SetFamilyBossFood(curFamily, funcValue)
|
| | | |
| | | elif funcType == Def_FamilyInfo_WeekMissionMoney:
|
| | | elif funcType == Def_FamilyInfo_Money:
|
| | | curFamily.SetMoney(funcValue)
|
| | | isLVUP = True
|
| | | if funcValue == 0:
|
| | | PlayerFamily.SetCurWeekMissionMoney(curFamily, 0)
|
| | |
|
| | | else:
|
| | | GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 错误 funcType = %s'%(funcType))
|
| | | elif funcType == Def_FamilyInfo_WarRank:
|
| | | PlayerFamily.SetFamilyWarRank(curFamily, funcValue)
|
| | | isSort = True
|
| | | |
| | | elif funcType == Def_FamilyInfo_FightPower:
|
| | | PlayerFamily.SetFamilyTotalFightPower(curFamily, funcValue)
|
| | | isSort = True
|
| | | |
| | | elif funcType == Def_FamilyInfo_BossFood:
|
| | | PlayerFamily.SetFamilyBossFood(curFamily, funcValue)
|
| | | |
| | | elif funcType == Def_FamilyInfo_WeekMissionMoney:
|
| | | PlayerFamily.SetCurWeekMissionMoney(curFamily, 0)
|
| | | |
| | | elif funcType == Def_FamilyInfo_Emblem:
|
| | | setExpireTimes = None
|
| | | if len(cmdList) > 2:
|
| | | setExpireTimes = cmdList[2]
|
| | | if not PlayerFamilyEmblem.AddFamilyEmblem(curFamily.GetID(), funcValue, setExpireTimes):
|
| | | return
|
| | | |
| | | else:
|
| | | return
|
| | | |
| | | #自动升级战盟
|
| | | if isLVUP:
|
| | | if PlayerFamily.DoFamilyLvUp(curFamily):
|
| | | isSort = False
|
| | | if isSort:
|
| | | PlayerFamily.DoFamilySort()
|
| | | return
|
| | | return True
|
| | |
|
| | | |
| | |
| | | import IpyGameDataPY
|
| | | import PlayerFamilyParty
|
| | | import PlayerFamilyZhenfa
|
| | | import PlayerFamilyEmblem
|
| | | import GameWorldFamilyWar
|
| | | import GameWorldArena
|
| | | import CrossLuckyCloudBuy
|
| | |
| | | if curMinute % 5 == 0:
|
| | | PlayerFamily.UpdFamilyTotalFightPower()
|
| | | PlayerFamilyRedPacket.CheckDelRedpacketData()
|
| | | PlayerFamilyEmblem.CheckExpireEmblem()
|
| | |
|
| | | return
|
| | |
|
| | |
| | | ("BYTE", "BossFBCnt", 0),
|
| | | ),
|
| | |
|
| | | "FamilyEmblem":(
|
| | | ("BYTE", "EmblemID", 1),
|
| | | ("BYTE", "UnlockFamilyLV", 0),
|
| | | ("DWORD", "ExpireMinutes", 0),
|
| | | ),
|
| | |
|
| | | "FamilyBossHurtAward":(
|
| | | ("BYTE", "AwardType", 1),
|
| | | ("BYTE", "RecordIndex", 1),
|
| | |
| | | def GetNeedMoney(self): return self.attrTuple[4] # 升级需要资金 DWORD
|
| | | def GetWeekMissionMoneyMax(self): return self.attrTuple[5] # 每周任务最大可获得仙盟资金 DWORD
|
| | | def GetBossFBCnt(self): return self.attrTuple[6] # BOSS副本次数 BYTE |
| | | |
| | | # 仙盟徽章表 |
| | | class IPY_FamilyEmblem(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetEmblemID(self): return self.attrTuple[0] # 徽章ID BYTE
|
| | | def GetUnlockFamilyLV(self): return self.attrTuple[1] # 解锁仙盟等级,为0时代表其他方式解锁 BYTE
|
| | | def GetExpireMinutes(self): return self.attrTuple[2] # 有效时长,分钟 DWORD |
| | | |
| | | # 仙盟试炼伤血奖励表 |
| | | class IPY_FamilyBossHurtAward(): |
| | |
| | | self.__LoadFileData("CreateRoleLimitServer", onlyCheck)
|
| | | self.__LoadFileData("WorldLV", onlyCheck)
|
| | | self.__LoadFileData("Family", onlyCheck)
|
| | | self.__LoadFileData("FamilyEmblem", onlyCheck)
|
| | | self.__LoadFileData("FamilyBossHurtAward", onlyCheck)
|
| | | self.__LoadFileData("FamilyZhenfa", onlyCheck)
|
| | | self.__LoadFileData("MarketQuery", onlyCheck)
|
| | |
| | | self.CheckLoadData("Family") |
| | | return self.ipyFamilyCache[index]
|
| | | |
| | | def GetFamilyEmblemCount(self): |
| | | self.CheckLoadData("FamilyEmblem") |
| | | return self.ipyFamilyEmblemLen
|
| | | def GetFamilyEmblemByIndex(self, index): |
| | | self.CheckLoadData("FamilyEmblem") |
| | | return self.ipyFamilyEmblemCache[index]
|
| | | |
| | | def GetFamilyBossHurtAwardCount(self): |
| | | self.CheckLoadData("FamilyBossHurtAward") |
| | | return self.ipyFamilyBossHurtAwardLen
|
| | |
| | | import PlayerBillboard
|
| | | import PlayerActBossTrial
|
| | | import PlayerCompensation
|
| | | import PlayerFamilyEmblem
|
| | | import PlayerFamilyParty
|
| | | import PlayerFamilySWRH
|
| | | import PlayerViewCache
|
| | |
| | | if not family:
|
| | | return 0
|
| | | return GetFamilyTotalFightPower(family)
|
| | | # 徽章
|
| | | def GetFamilyEmblem(curFamily): return curFamily.GetExtra6()
|
| | | def SetFamilyEmblem(curFamily, value): return curFamily.SetExtra6(value)
|
| | | # 徽章ID
|
| | | def GetFamilyEmblemID(curFamily): return curFamily.GetExtra6()
|
| | | def SetFamilyEmblemID(curFamily, emblemID): return curFamily.SetExtra6(emblemID)
|
| | |
|
| | | # 公告修改次数
|
| | | def GetFamilyBroadcastCnt(curFamily): return curFamily.GetExtra3()
|
| | |
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def DoCreateFamily(curPlayer, familyName, fakeIndex, tick):
|
| | | def DoCreateFamily(curPlayer, familyName, fakeIndex, tick, emblemID=0):
|
| | | #---验证玩家属性---
|
| | | curPlayerID = curPlayer.GetPlayerID()
|
| | |
|
| | |
| | | if curFamily == None:
|
| | | GameWorld.ErrLog("家族创建数目已满, 创建家族失败", curPlayerID)
|
| | | return
|
| | | GameWorld.Log("创建仙盟: familyID=%s,playerID=%s" % (curFamily.GetID(), curPlayerID))
|
| | | emblemIDList = PlayerFamilyEmblem.GetDefaultFamilyEmblemIDList()
|
| | | if not emblemID or emblemID not in emblemIDList:
|
| | | emblemID = random.choice(emblemIDList) # 从默认徽章中随机选择一个
|
| | | GameWorld.Log("创建仙盟: familyID=%s,playerID=%s,emblemID=%s" % (curFamily.GetID(), curPlayerID, emblemID))
|
| | | #---创建家族---
|
| | | curFamily.SetServerID(GameWorld.GetAccIDServerID(curPlayer.GetAccID()))
|
| | | curFamily.SetCreateTime(GameWorld.GetCurrentDataTimeStr())
|
| | | curFamily.SetLV(1)
|
| | | curFamily.SetAcceptJoin(ShareDefine.FamilyAcceptJoin_Agree) #设置收人方式为直接通过申请
|
| | | SetFamilyEmblemID(curFamily, emblemID)
|
| | | PyDataManager.GetFamilyStoreItemManager().DelFamilyStoreItemAll(curFamily.GetID())
|
| | |
|
| | | #新创建的仙盟默认设置已处理过合服
|
| | |
| | | # tagHead Head;
|
| | | # char Name[33];
|
| | | # WORD FakeID;
|
| | | # BYTE EmblemID; //选择徽章ID,解锁仙盟等级为1级的均为可选ID
|
| | | #};
|
| | | ## 查看申请帮会的成员信息
|
| | | # @param index 玩家索引
|
| | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | inputName = clientPack.Name
|
| | | fakeIndex = clientPack.FakeID
|
| | | emblemID = clientPack.EmblemID
|
| | | #执行创建家族逻辑
|
| | | DoCreateFamily(curPlayer, inputName, fakeIndex, tick)
|
| | | DoCreateFamily(curPlayer, inputName, fakeIndex, tick, emblemID)
|
| | | #重置查看家族状态(仅创建家族时候重置, 其余状态由MapServer退出事件时重置)
|
| | | __ClearViewFamilyState(curPlayer)
|
| | | #玩家离开事件
|
| | |
| | | totalFightPower = GetFamilyTotalFightPower(family)
|
| | | familyView.TotalFightPower = totalFightPower % ChConfig.Def_PerPointValue
|
| | | familyView.TotalFightPowerEx = totalFightPower / ChConfig.Def_PerPointValue
|
| | | familyView.EmblemID = GetFamilyEmblemID(family)
|
| | | return familyView
|
| | |
|
| | | ## 玩家模糊查询家族,0F 0D封包
|
| | |
| | | break
|
| | | familyViewPack.PageCount = len(familyViewPack.Family)
|
| | | NetPackCommon.SendFakePack(curPlayer, familyViewPack)
|
| | | return
|
| | |
|
| | | #// A4 13 修改家族徽章 #tagCGChangeFamilyEmblem
|
| | | #
|
| | | #struct tagCGChangeFamilyEmblem
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE EmblemID; // 更换的徽章ID
|
| | | #};
|
| | | def OnChangeFamilyEmblem(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | changeEmblemID = clientData.EmblemID
|
| | | PlayerFamilyEmblem.OnChangeFamilyEmblem(curPlayer, changeEmblemID)
|
| | | return
|
| | |
|
| | | #class IPY_CFamilyChangeBroadcast
|
| | |
| | | fightPower = GetFamilyTotalFightPower(curFamily)
|
| | | value1 = fightPower / ChConfig.Def_PerPointValue
|
| | | value2 = fightPower % ChConfig.Def_PerPointValue
|
| | | value3 = GetFamilyEmblem(curFamily)
|
| | | value3 = GetFamilyEmblemID(curFamily)
|
| | | value4 = curFamily.GetLV()
|
| | | value5 = curFamily.GetServerID()
|
| | | return {"id":familyID, "name":name, "id2":id2, "name2":name2, "value1":value1, "value2":value2,
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def SendFamilyAction(familyActionData, curPlayer=None):
|
| | | |
| | | familyID = familyActionData.GetFamilyId()
|
| | | |
| | | actionInfoPack = ChPyNetSendPack.tagGCFamilyActionInfo()
|
| | | actionInfoPack.Clear()
|
| | | actionInfoPack.FamilyID = familyID
|
| | | actionInfoPack.ActionType = familyActionData.GetActionType()
|
| | | actionInfoPack.FamilyActionList = [] |
| | | |
| | | actionData = ChPyNetSendPack.tagGCFamilyAction()
|
| | | actionData.Clear()
|
| | | actionData.Time = familyActionData.GetTime()
|
| | | actionData.Name = familyActionData.GetName()
|
| | | actionData.NameLen = len(actionData.Name)
|
| | | actionData.Value1 = familyActionData.GetValue1()
|
| | | actionData.Value2 = familyActionData.GetValue2()
|
| | | actionData.Value3 = familyActionData.GetValue3()
|
| | | actionData.Value4 = familyActionData.GetValue4()
|
| | | actionData.Value5 = familyActionData.GetValue5()
|
| | | actionData.Value6 = familyActionData.GetValue6()
|
| | | actionData.UseData = familyActionData.GetUseData()
|
| | | actionData.UseDataLen = len(actionData.UseData)
|
| | | actionInfoPack.FamilyActionList.append(actionData)
|
| | | |
| | | actionInfoPack.Count = len(actionInfoPack.FamilyActionList)
|
| | | |
| | | if curPlayer:
|
| | | NetPackCommon.SendFakePack(curPlayer, actionInfoPack)
|
| | | return
|
| | | |
| | | # 没有指定玩家的情况下通知全战盟
|
| | | family = GameWorld.GetFamilyManager().FindFamily(familyID)
|
| | | if not family:
|
| | | return
|
| | | |
| | | for index in xrange(family.GetCount()):
|
| | | curMember = family.GetAt(index)
|
| | | curPlayer = curMember.GetPlayer()
|
| | | #不在线
|
| | | if curPlayer == None:
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, actionInfoPack)
|
| | | |
| | | return
|
| | |
|
| | | ## 删除时机: 1-降为普通成员;2-退出家族
|
| | | def DelFamilyOfficerModelEquip(familyID, delPlayerID):
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package PlayerFamilyEmblem
|
| | | #
|
| | | # @todo:仙盟徽章
|
| | | # @author hxp
|
| | | # @date 2024-09-09
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 仙盟徽章
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2024-09-09 15:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import ShareDefine
|
| | | import PlayerFamilyAction
|
| | | import IpyGameDataPY
|
| | | import PlayerFamily
|
| | |
|
| | | import random
|
| | | import time
|
| | |
|
| | | def GetActionEmblemID(emblemActionObj): return emblemActionObj.GetValue1()
|
| | | def SetActionEmblemID(emblemActionObj, emblemID): return emblemActionObj.SetValue1(emblemID)
|
| | | def GetActionEmblemExpireTimes(emblemActionObj): return emblemActionObj.GetValue2()
|
| | | def SetActionEmblemExpireTimes(emblemActionObj, endTime): return emblemActionObj.SetValue2(endTime)
|
| | |
|
| | | def GetDefaultFamilyEmblemIDList():
|
| | | ## 获取默认的仙盟徽章ID列表,即所有解锁等级为1的徽章ID
|
| | | defaultEmblemIDList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetFamilyEmblemCount()):
|
| | | ipyData = ipyDataMgr.GetFamilyEmblemByIndex(index)
|
| | | emblemID = ipyData.GetEmblemID()
|
| | | if ipyData.GetUnlockFamilyLV() == 1:
|
| | | defaultEmblemIDList.append(emblemID)
|
| | | return defaultEmblemIDList
|
| | |
|
| | | def CheckExpireEmblem():
|
| | | ## 检查过期的勋章
|
| | | |
| | | defaultEmblemIDList = []
|
| | | curTime = int(time.time())
|
| | | actionType = ShareDefine.Def_ActionType_FamilyEmblem
|
| | | familyManager = GameWorld.GetFamilyManager()
|
| | | familyActionMgr = GameWorld.GetFamilyActionManager()
|
| | | for i in xrange(familyManager.GetCount()):
|
| | | family = familyManager.GetAt(i)
|
| | | if not family:
|
| | | continue
|
| | | familyID = family.GetID()
|
| | | familyAction = familyActionMgr.GetFamilyAction(familyID, actionType)
|
| | | for index in range(familyAction.Count())[::-1]: # 可能触发删除,倒序遍历
|
| | | emblemActionObj = familyAction.At(index)
|
| | | emblemID = GetActionEmblemID(emblemActionObj)
|
| | | isExpired, endTime = IsEmblemExpired(emblemActionObj, curTime)
|
| | | if not isExpired:
|
| | | #GameWorld.Log("检查仙盟徽章未过期! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
|
| | | continue
|
| | | familyAction.DelAction(index)
|
| | | GameWorld.Log("删除过期仙盟徽章! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
|
| | | if PlayerFamily.GetFamilyEmblemID(family) == emblemID:
|
| | | if not defaultEmblemIDList:
|
| | | defaultEmblemIDList = GetDefaultFamilyEmblemIDList()
|
| | | updEmblemID = random.choice(defaultEmblemIDList) if defaultEmblemIDList else 0
|
| | | GameWorld.Log("仙盟佩戴徽章过期恢复随机默认徽章! familyID=%s,emblemID=%s,endTime=%s,updEmblemID=%s" % (familyID, emblemID, endTime, updEmblemID))
|
| | | PlayerFamily.SetFamilyEmblemID(family, updEmblemID)
|
| | | family.Broadcast_FamilyChange()
|
| | | return
|
| | |
|
| | | def IsEmblemExpired(emblemActionObj, curTime):
|
| | | ## 勋章是否过期
|
| | | # @return: 是否过期, endTime
|
| | | |
| | | endTime = -1
|
| | | if not emblemActionObj:
|
| | | return True, endTime
|
| | | |
| | | createTime = emblemActionObj.GetTime()
|
| | | expireTimes = GetEmblemExpireTimes(emblemActionObj)
|
| | | if expireTimes == 0:
|
| | | # 永久的
|
| | | return False, 0
|
| | | |
| | | if expireTimes > 0:
|
| | | endTime = createTime + expireTimes
|
| | | if endTime >= curTime:
|
| | | # 未过期
|
| | | return False, endTime
|
| | | |
| | | return True, endTime
|
| | |
|
| | | def GetEmblemExpireTimes(emblemActionObj):
|
| | | ## 获取勋章有效时长,秒
|
| | | # @return: 0-永久;-1-无效;>0-有效秒数
|
| | | expireTimes = GetActionEmblemExpireTimes(emblemActionObj) # 有效时长,秒
|
| | | if not expireTimes:
|
| | | emblemID = GetActionEmblemID(emblemActionObj)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("FamilyEmblem", emblemID)
|
| | | if not ipyData:
|
| | | return -1
|
| | | expireTimes = ipyData.GetExpireMinutes() * 60
|
| | | return expireTimes
|
| | |
|
| | | def GetFamilyEmblemActionData(familyID, emblemID):
|
| | | ## 获取仙盟时效徽章Action数据
|
| | | actionType = ShareDefine.Def_ActionType_FamilyEmblem
|
| | | familyAction = GameWorld.GetFamilyActionManager().GetFamilyAction(familyID, actionType)
|
| | | for index in range(familyAction.Count()):
|
| | | familyActionObj = familyAction.At(index)
|
| | | if emblemID == familyActionObj.GetValue1():
|
| | | return familyActionObj
|
| | | return
|
| | |
|
| | | def AddFamilyEmblem(familyID, emblemID, setExpireTimes=None):
|
| | | ## 添加仙盟徽章
|
| | | # @param setExpireTimes: 指定的有效时长秒,0-永久,>0-有效时长秒;没有指定时直接读配置进行累加
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("FamilyEmblem", emblemID)
|
| | | if not ipyData:
|
| | | return
|
| | | unlockFamilyLV = ipyData.GetUnlockFamilyLV()
|
| | | if unlockFamilyLV:
|
| | | GameWorld.Log("仙盟解锁的徽章不需要添加! familyID=%s,emblemID=%s" % (familyID, emblemID))
|
| | | return
|
| | | if setExpireTimes >= 0:
|
| | | expireTimes = setExpireTimes
|
| | | else: |
| | | expireTimes = ipyData.GetExpireMinutes() * 60
|
| | | GameWorld.Log("添加仙盟徽章! familyID=%s,emblemID=%s,setExpireTimes=%s,expireTimes=%s" |
| | | % (familyID, emblemID, setExpireTimes, expireTimes))
|
| | | |
| | | curTime = int(time.time())
|
| | | emblemActionObj = GetFamilyEmblemActionData(familyID, emblemID)
|
| | | if not emblemActionObj:
|
| | | actionType = ShareDefine.Def_ActionType_FamilyEmblem
|
| | | familyAction = GameWorld.GetFamilyActionManager().GetFamilyAction(familyID, actionType)
|
| | | emblemActionObj = familyAction.AddAction()
|
| | | emblemActionObj.SetTime(curTime)
|
| | | emblemActionObj.SetFamilyId(familyID)
|
| | | emblemActionObj.SetActionType(actionType)
|
| | | else:
|
| | | isExpired, endTime = IsEmblemExpired(emblemActionObj, curTime)
|
| | | if setExpireTimes >= 0:
|
| | | emblemActionObj.SetTime(curTime)
|
| | | GameWorld.Log("直接设置勋章剩余时长,重新设置获得时间! familyID=%s,emblemID=%s" % (familyID, emblemID))
|
| | | elif isExpired:
|
| | | emblemActionObj.SetTime(curTime)
|
| | | GameWorld.Log("获得勋章时已过期,重新设置获得时间! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
|
| | | else:
|
| | | # 未过期,非永久的直接累加时长
|
| | | if expireTimes > 0:
|
| | | expireTimes += GetActionEmblemExpireTimes(emblemActionObj)
|
| | | GameWorld.Log("获得勋章时未过期,累加有效时长! familyID=%s,emblemID=%s,expireTimes=%s" % (familyID, emblemID, expireTimes))
|
| | | |
| | | SetActionEmblemID(emblemActionObj, emblemID)
|
| | | SetActionEmblemExpireTimes(emblemActionObj, expireTimes)
|
| | | |
| | | # ֪ͨ
|
| | | PlayerFamilyAction.SendFamilyAction(emblemActionObj)
|
| | | return emblemActionObj
|
| | |
|
| | | def OnChangeFamilyEmblem(curPlayer, emblemID):
|
| | | ## 修改仙盟徽章
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | curFamily = curPlayer.GetFamily()
|
| | | if not curFamily:
|
| | | return
|
| | | familyID = curFamily.GetID()
|
| | | |
| | | if curFamily.GetLeaderID() != playerID:
|
| | | GameWorld.DebugLog("只有盟主可以修改徽章!", playerID)
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("FamilyEmblem", emblemID)
|
| | | if not ipyData:
|
| | | return
|
| | | unlockFamilyLV = ipyData.GetUnlockFamilyLV()
|
| | | |
| | | if unlockFamilyLV:
|
| | | if curFamily.GetLV() < unlockFamilyLV:
|
| | | GameWorld.DebugLog("仙盟等级不足,无法使用该徽章! emblemID=%s,unlockFamilyLV=%s" |
| | | % (emblemID, unlockFamilyLV), playerID)
|
| | | return
|
| | | else:
|
| | | emblemActionObj = GetFamilyEmblemActionData(familyID, emblemID)
|
| | | isExpired, endTime = IsEmblemExpired(emblemActionObj, int(time.time()))
|
| | | if isExpired:
|
| | | GameWorld.DebugLog("该徽章不存在或已过期! emblemID=%s,endTime=%s" % (emblemID, endTime), playerID)
|
| | | return
|
| | | |
| | | GameWorld.DebugLog("更换仙盟徽章! familyID=%s,emblemID=%s" % (familyID, emblemID), playerID)
|
| | | PlayerFamily.SetFamilyEmblemID(curFamily, emblemID)
|
| | | PlayerFamily.SendPack_MapServer_PlayerFamilyRefresh(curFamily)
|
| | | curFamily.Broadcast_FamilyChange()
|
| | | return
|
| | |
| | | Def_ActionType_FamilyEvent, #记录家族事件12
|
| | | Def_ActionType_BossTrialSubmit, #boss凭证提交 13
|
| | | Def_ActionType_FamilyCTGAssist, #仙盟充值协助活动 14
|
| | | ) = range(0, 15)
|
| | | Def_ActionType_FamilyEmblem, #仙盟时效徽章信息 15
|
| | | ) = range(0, 16)
|
| | |
|
| | | # 家族行为事件类型定义; Def_ActionType_FamilyEvent; 存与事件记录Value1
|
| | | # 通用:time-时间;name-玩家;value1-事件类型
|
| | |
| | | Def_Player_Dict_UpdateFamilyName = "UpdateFamilyName" # 改名锁
|
| | | Def_Player_Dict_FamilyDayAward = "FamilyDayAward" # 仙盟每日奖励领奖记录
|
| | | Def_Player_Dict_FamilyMoneyDonateCount = "FamilyMoneyDonateCount" # 仙盟今日货币捐献次数
|
| | | Def_Player_Dict_FamilyEmblemID = "FamilyEmblemID" # 仙盟徽章ID
|
| | |
|
| | | # 仙盟事务
|
| | | Def_Player_Dict_FamilyAffairRefreshFree = "FamilyAffairRefreshFree" # 今日已免费刷新事务次数
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A4 13 修改家族徽章 #tagCGChangeFamilyEmblem
|
| | |
|
| | | class tagCGChangeFamilyEmblem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("EmblemID", c_ubyte), # 更换的徽章ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA4
|
| | | self.SubCmd = 0x13
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA4
|
| | | self.SubCmd = 0x13
|
| | | self.EmblemID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCGChangeFamilyEmblem)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A4 13 修改家族徽章 //tagCGChangeFamilyEmblem:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | EmblemID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.EmblemID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCGChangeFamilyEmblem=tagCGChangeFamilyEmblem()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGChangeFamilyEmblem.Cmd,m_NAtagCGChangeFamilyEmblem.SubCmd))] = m_NAtagCGChangeFamilyEmblem
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A4 08 查询家族行为信息 #tagCGQueryFamilyAction
|
| | |
|
| | | class tagCGQueryFamilyAction(Structure):
|
| | |
| | | Head = tagHead()
|
| | | Name = "" #(char Name[33])
|
| | | FakeID = 0 #(WORD FakeID)//假仙盟编号
|
| | | EmblemID = 0 #(BYTE EmblemID)//选择徽章ID,解锁仙盟等级为1级的均为可选ID
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.Name,_pos = CommFunc.ReadString(_lpData, _pos,33)
|
| | | self.FakeID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.EmblemID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.Head.SubCmd = 0x04
|
| | | self.Name = ""
|
| | | self.FakeID = 0
|
| | | self.EmblemID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += self.Head.GetLength()
|
| | | length += 33
|
| | | length += 2
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteString(data, 33, self.Name)
|
| | | data = CommFunc.WriteWORD(data, self.FakeID)
|
| | | data = CommFunc.WriteBYTE(data, self.EmblemID)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | Name:%s,
|
| | | FakeID:%d
|
| | | FakeID:%d,
|
| | | EmblemID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Name,
|
| | | self.FakeID
|
| | | self.FakeID,
|
| | | self.EmblemID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | WarRank = 0 #(BYTE WarRank)//联赛排名
|
| | | TotalFightPower = 0 #(DWORD TotalFightPower)//总战力,不足1个亿的部分
|
| | | TotalFightPowerEx = 0 #(DWORD TotalFightPowerEx)//总战力点,1点=1亿
|
| | | EmblemID = 0 #(BYTE EmblemID)//徽章ID
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.WarRank,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.TotalFightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.TotalFightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.EmblemID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.WarRank = 0
|
| | | self.TotalFightPower = 0
|
| | | self.TotalFightPowerEx = 0
|
| | | self.EmblemID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.WarRank)
|
| | | data = CommFunc.WriteDWORD(data, self.TotalFightPower)
|
| | | data = CommFunc.WriteDWORD(data, self.TotalFightPowerEx)
|
| | | data = CommFunc.WriteBYTE(data, self.EmblemID)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | JoinAccept:%d,
|
| | | WarRank:%d,
|
| | | TotalFightPower:%d,
|
| | | TotalFightPowerEx:%d
|
| | | TotalFightPowerEx:%d,
|
| | | EmblemID:%d
|
| | | '''\
|
| | | %(
|
| | | self.FamilyIndex,
|
| | |
| | | self.JoinAccept,
|
| | | self.WarRank,
|
| | | self.TotalFightPower,
|
| | | self.TotalFightPowerEx
|
| | | self.TotalFightPowerEx,
|
| | | self.EmblemID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | def GetAttr160(curPlayer): return 0
|
| | | def SetAttr160(curPlayer, value): pass
|
| | |
|
| | | # 仙盟徽章ID
|
| | | def GetFamilyEmblemID(curPlayer): return curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyEmblemID)
|
| | | def SetFamilyEmblemID(curPlayer, emblemID): NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyEmblemID, emblemID)
|
| | |
|
| | | # 仙盟事务速度加成
|
| | | def GetAffairSpeedPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AffairSpeedPer)
|
| | | def SetAffairSpeedPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AffairSpeedPer, value)
|
| | |
| | | if curPlayer.GetFamilyLastWeekActiveValue() != refreshPack.GetLastWeekFamilyActiveValue():
|
| | | curPlayer.SetFamilyLastWeekActiveValue(refreshPack.GetLastWeekFamilyActiveValue())
|
| | |
|
| | | if hasattr(refreshPack, "GetExtra6") and PlayerControl.GetFamilyEmblemID(curPlayer) != refreshPack.GetExtra6():
|
| | | PlayerControl.SetFamilyEmblemID(curPlayer, refreshPack.GetExtra6())
|
| | | |
| | | #---处理特殊逻辑, 进入退出家族---
|
| | |
|
| | | if lastFamilyID != 0 and curPlayer.GetFamilyID() == 0:
|
| | |
| | | curPlayerPropDict["Name"] = curPlayer.GetPlayerName()
|
| | | curPlayerPropDict["FamilyID"] = curPlayer.GetFamilyID()
|
| | | curPlayerPropDict["FamilyName"] = curPlayer.GetFamilyName()
|
| | | curPlayerPropDict["FamilyEmblemID"] = PlayerControl.GetFamilyEmblemID(curPlayer)
|
| | | curPlayerPropDict["TitleID"] = PlayerControl.GetTitleID(curPlayer)
|
| | | curPlayerPropDict["CoupleName"] = PlayerControl.GetCoupleName(curPlayer)
|
| | | curPlayerPropDict["FightPower"] = PlayerControl.GetFightPower(curPlayer)
|
| | |
| | | Def_ActionType_FamilyEvent, #记录家族事件12
|
| | | Def_ActionType_BossTrialSubmit, #boss凭证提交 13
|
| | | Def_ActionType_FamilyCTGAssist, #仙盟充值协助活动 14
|
| | | ) = range(0, 15)
|
| | | Def_ActionType_FamilyEmblem, #仙盟时效徽章信息 15
|
| | | ) = range(0, 16)
|
| | |
|
| | | # 家族行为事件类型定义; Def_ActionType_FamilyEvent; 存与事件记录Value1
|
| | | # 通用:time-时间;name-玩家;value1-事件类型
|