| | |
| | | DWORD LVUPNeedTime; //升级下一级所需所需秒
|
| | | list EquipColorRateList; //产出装备品质概率列表,[0品质万分率, 1品质万分率, ...]
|
| | | };
|
| | |
|
| | | //淘金营地表
|
| | |
|
| | | struct GoldRushCamp
|
| | | {
|
| | | BYTE _CampID;
|
| | | WORD PanningUnlock; //淘金次数解锁
|
| | | list MoneyUnlock; //货币解锁,货币类型|货币值
|
| | | };
|
| | |
|
| | | //淘金监工表
|
| | |
|
| | | struct GoldRushWorker
|
| | | {
|
| | | BYTE _WorkerID;
|
| | | WORD PlayerLVUnlock; //主公等级解锁
|
| | | list MoneyUnlock; //货币解锁,货币类型|货币值
|
| | | };
|
| | |
|
| | | //淘金物品表
|
| | |
|
| | | struct GoldRushItem
|
| | | {
|
| | | BYTE _GoldID; //淘金ID
|
| | | DWORD ItemID; //物品ID
|
| | | BYTE ItemLV; //物品等级
|
| | | DWORD ItemCount; //物品个数
|
| | | DWORD RefreshWeight; //常规刷新权重
|
| | | BYTE WorkerMax; //监工上限
|
| | | BYTE NeedSeconds; //耗时秒
|
| | | };
|
| | |
|
| | |
| | | PacketSubCMD_2=0x24
|
| | | PacketCallFunc_2=OnUseTreeLVUPTimeItem
|
| | |
|
| | | ;福地
|
| | | [PlayerMineArea]
|
| | | ScriptName = Player\PlayerMineArea.py
|
| | | ;淘金
|
| | | [PlayerGoldRush]
|
| | | ScriptName = Player\PlayerGoldRush.py
|
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 4
|
| | |
|
| | | PacketCMD_1=0xB0
|
| | | PacketSubCMD_1=0x30
|
| | | PacketCallFunc_1=OnMineItemPull
|
| | | PacketSubCMD_1=0x36
|
| | | PacketCallFunc_1=OnGoldRushOP
|
| | |
|
| | | PacketCMD_2=0xB0
|
| | | PacketSubCMD_2=0x31
|
| | | PacketCallFunc_2=OnMineItemRefresh
|
| | | PacketSubCMD_2=0x37
|
| | | PacketCallFunc_2=OnGoldRushUnlock
|
| | |
|
| | | PacketCMD_3=0xB0
|
| | | PacketSubCMD_3=0x32
|
| | | PacketCallFunc_3=OnMineWorkerEmploy
|
| | | PacketSubCMD_3=0x38
|
| | | PacketCallFunc_3=OnGoldRushWarehouseAward
|
| | |
|
| | | PacketCMD_4=0xB0
|
| | | PacketSubCMD_4=0x35
|
| | | PacketCallFunc_4=OnMineHouseKeeperFreeUse
|
| | | PacketSubCMD_4=0x39
|
| | | PacketCallFunc_4=OnGoldRushAutoFreeUse
|
| | |
|
| | | ;仙盟攻城战
|
| | | [PlayerActFamilyGCZ]
|
| | |
| | | #镜像切磋
|
| | | Def_FBMapID_MirrorBattle = 100
|
| | |
|
| | | #回合战斗自定义地图ID
|
| | | TurnFightMapIDList = (
|
| | | Def_TFMapID_MineArea, # 福地 1
|
| | | ) = range(1, 1 + 1)
|
| | |
|
| | | #前端自定义场景地图
|
| | | ClientCustomSceneList = [Def_FBMapID_PersonalBoss, Def_FBMapID_ArenaBattle, Def_FBMapID_MirrorBattle]
|
| | |
|
| | |
| | | Def_PDict_TaskValue = "TaskValue_%s" # 当前进行中的任务进度,参数(任务组)
|
| | | Def_PDict_TaskState = "TaskState_%s" # 当前进行中的任务状态 0-无;1-进行中;2-已完成,参数(任务组)
|
| | |
|
| | | #福地
|
| | | Def_PDict_MineWorkerCount = "MineWorkerCount" # 已雇佣工人数
|
| | | Def_PDict_MineWorkerEnergyUsed = "MineWorkerEnergyUsed" # 今日已消耗体力
|
| | | Def_PDict_MineHousekeeperEndTime = "MineHousekeeperEndTime" # 自动管家到期时间戳
|
| | | Def_PDict_MineHelpAwardCount = "MineHelpAwardCount" # 今日已帮助别人奖励次数
|
| | | Def_PDict_MineRefreshCount = "MineRefreshCount_%s" # 今日已刷新次数,参数(刷新类型)
|
| | | Def_PDict_MineTreasureState = "MineTreasureState" # 聚宝盆激活状态,按类型位运算记录是否已激活
|
| | | Def_PDict_MineTreasureAward = "MineTreasureAward" # 聚宝盆奖励状态,按类型位运算记录是否已领取
|
| | | Def_PDict_MineTreasureProgess = "MineTreasureProgess_%s" # 聚宝盆进度值,参数(聚宝盆类型)
|
| | | #淘金
|
| | | Def_PDict_GoldRushCampState = "GoldRushCampState" # 已解锁营地状态,按营地ID二进制位运算判断是否已解锁
|
| | | Def_PDict_GoldRushWorkerState = "GoldRushWorkerState" # 已雇佣工人数状态,按监工ID二进制位运算判断是否已解锁
|
| | | Def_PDict_GoldRushCnt = "GoldRushCnt" # 已淘金次数
|
| | | Def_PDict_GoldRushCampInfo = "GoldRushCampInfo_%s" # 营地当前淘金信息: 已刷新次数*1000+淘金ID*10+派遣工人数,0时代表当前营地为空,参数(营地ID)
|
| | | Def_PDict_GoldRushCampEndTime = "GoldRushCampEndTime_%s" # 营地淘金结束时间戳,为0时代表未开始淘金,参数(营地ID)
|
| | | Def_PDict_GoldRushWarehouse = "GoldRushWarehouse_%s" # 仓库完成淘金ID,参数(仓库位置索引)
|
| | | Def_PDict_GoldRushRecoverTime = "GoldRushRecoverTime" # 上次恢复淘金令时间戳
|
| | | Def_PDict_GoldRushAutoEndTime = "GoldRushAutoEndTime" # 自动淘金到期时间戳
|
| | |
|
| | | #仙宫
|
| | | Def_PDict_XiangongLikeState = "XiangongLikeState_%s" # 指定仙宫今日是否已点赞,参数(仙宫ID),仙宫ID为0时代表每日的仙宫功能点赞
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 50 钓鱼收杆 #tagCMDoFish
|
| | |
|
| | | class tagCMDoFish(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("FishNum", c_ubyte), # 钓鱼编号1~N
|
| | | ("PosIndex", c_ubyte), # 停留位置1~N
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x50
|
| | | 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 = 0xB0
|
| | | self.SubCmd = 0x50
|
| | | self.FishNum = 0
|
| | | self.PosIndex = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMDoFish)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 50 钓鱼收杆 //tagCMDoFish:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | FishNum:%d,
|
| | | PosIndex:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.FishNum,
|
| | | self.PosIndex
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMDoFish=tagCMDoFish()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMDoFish.Cmd,m_NAtagCMDoFish.SubCmd))] = m_NAtagCMDoFish
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 15 接收协助感谢礼物 #tagCGGetAssistThanksGift
|
| | |
|
| | | class tagCGGetAssistThanksGift(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 34 福地请求结算奖励 #tagCGMineAreaAwardGet
|
| | | # B0 39 自动淘金免费使用 #tagCSGoldRushAutoFreeUse
|
| | |
|
| | | class tagCGMineAreaAwardGet(Structure):
|
| | | class tagCSGoldRushAutoFreeUse(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | |
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x34
|
| | | self.SubCmd = 0x39
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x34
|
| | | self.SubCmd = 0x39
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCGMineAreaAwardGet)
|
| | | return sizeof(tagCSGoldRushAutoFreeUse)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 34 福地请求结算奖励 //tagCGMineAreaAwardGet:
|
| | | DumpString = '''// B0 39 自动淘金免费使用 //tagCSGoldRushAutoFreeUse:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | |
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCGMineAreaAwardGet=tagCGMineAreaAwardGet()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGMineAreaAwardGet.Cmd,m_NAtagCGMineAreaAwardGet.SubCmd))] = m_NAtagCGMineAreaAwardGet
|
| | | m_NAtagCSGoldRushAutoFreeUse=tagCSGoldRushAutoFreeUse()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSGoldRushAutoFreeUse.Cmd,m_NAtagCSGoldRushAutoFreeUse.SubCmd))] = m_NAtagCSGoldRushAutoFreeUse
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 33 福地查看 #tagCGMineAreaView
|
| | | # B0 36 淘金操作 #tagCSGoldRushOP
|
| | |
|
| | | class tagCGMineAreaView(Structure):
|
| | | class tagCSGoldRushOP(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("QueryType", c_ubyte), # 查询同步类型:0-后端主动同步;1-查看指定福地;2-查看道友福地列表;3-查看周围随机福地列表;4-退出他人福地;5-查看记录
|
| | | ("QueryValue", c_int), # 查询值,类型1时-发送目标玩家ID;3时-发送是否重新随机
|
| | | ("OPType", c_ubyte), # 0-接受淘金;1-刷新淘金;2-开始淘金或调整监工数;3-取消淘金
|
| | | ("CampID", c_ubyte), # 营地ID
|
| | | ("WorkerCnt", c_ubyte), # 派遣监工数,仅类型2有效
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x33
|
| | | self.SubCmd = 0x36
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x33
|
| | | self.QueryType = 0
|
| | | self.QueryValue = 0
|
| | | self.SubCmd = 0x36
|
| | | self.OPType = 0
|
| | | self.CampID = 0
|
| | | self.WorkerCnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCGMineAreaView)
|
| | | return sizeof(tagCSGoldRushOP)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 33 福地查看 //tagCGMineAreaView:
|
| | | DumpString = '''// B0 36 淘金操作 //tagCSGoldRushOP:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | QueryType:%d,
|
| | | QueryValue:%d
|
| | | OPType:%d,
|
| | | CampID:%d,
|
| | | WorkerCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.QueryType,
|
| | | self.QueryValue
|
| | | self.OPType,
|
| | | self.CampID,
|
| | | self.WorkerCnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCGMineAreaView=tagCGMineAreaView()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGMineAreaView.Cmd,m_NAtagCGMineAreaView.SubCmd))] = m_NAtagCGMineAreaView
|
| | | m_NAtagCSGoldRushOP=tagCSGoldRushOP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSGoldRushOP.Cmd,m_NAtagCSGoldRushOP.SubCmd))] = m_NAtagCSGoldRushOP
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 35 福地管家免费试用 #tagCMMineHouseKeeperFreeUse
|
| | | # B0 37 淘金解锁 #tagCSGoldRushUnlock
|
| | |
|
| | | class tagCMMineHouseKeeperFreeUse(Structure):
|
| | | class tagCSGoldRushUnlock(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("UnlockType", c_ubyte), # 0-营地;1-监工
|
| | | ("UnlockID", c_ubyte), # 解锁类型对应的ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x35
|
| | | self.SubCmd = 0x37
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x35
|
| | | self.SubCmd = 0x37
|
| | | self.UnlockType = 0
|
| | | self.UnlockID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMMineHouseKeeperFreeUse)
|
| | | return sizeof(tagCSGoldRushUnlock)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 35 福地管家免费试用 //tagCMMineHouseKeeperFreeUse:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMMineHouseKeeperFreeUse=tagCMMineHouseKeeperFreeUse()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMMineHouseKeeperFreeUse.Cmd,m_NAtagCMMineHouseKeeperFreeUse.SubCmd))] = m_NAtagCMMineHouseKeeperFreeUse
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 30 福地物品拉 #tagCMMineItemPull
|
| | |
|
| | | class tagCMMineItemPull(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("PlayerID", c_int), # 福地所属玩家ID,0默认自己
|
| | | ("ItemIndex", c_ubyte), # 物品所在位置索引0~n
|
| | | ("WorkerCount", c_ubyte), # 上工人人数
|
| | | ("IsPreview", c_ubyte), # 是否预览;0-直接拉,1-预览大概时间
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x30
|
| | | 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 = 0xB0
|
| | | self.SubCmd = 0x30
|
| | | self.PlayerID = 0
|
| | | self.ItemIndex = 0
|
| | | self.WorkerCount = 0
|
| | | self.IsPreview = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMMineItemPull)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 30 福地物品拉 //tagCMMineItemPull:
|
| | | DumpString = '''// B0 37 淘金解锁 //tagCSGoldRushUnlock:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | PlayerID:%d,
|
| | | ItemIndex:%d,
|
| | | WorkerCount:%d,
|
| | | IsPreview:%d
|
| | | UnlockType:%d,
|
| | | UnlockID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.PlayerID,
|
| | | self.ItemIndex,
|
| | | self.WorkerCount,
|
| | | self.IsPreview
|
| | | self.UnlockType,
|
| | | self.UnlockID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMMineItemPull=tagCMMineItemPull()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMMineItemPull.Cmd,m_NAtagCMMineItemPull.SubCmd))] = m_NAtagCMMineItemPull
|
| | | m_NAtagCSGoldRushUnlock=tagCSGoldRushUnlock()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSGoldRushUnlock.Cmd,m_NAtagCSGoldRushUnlock.SubCmd))] = m_NAtagCSGoldRushUnlock
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 31 福地物品刷新 #tagCMMineItemRefresh
|
| | | # B0 38 淘金仓库领奖 #tagCSGoldRushWarehouseAward
|
| | |
|
| | | class tagCMMineItemRefresh(Structure):
|
| | | class tagCSGoldRushWarehouseAward(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("RefreshType", c_ubyte), # 刷新类型:0-自己物品普通刷新;1-自己物品超级刷新;2-周围福地玩家列表刷新
|
| | | ("AwardIndex", c_ubyte), # 领奖位置索引,从0开始
|
| | | ("IsAll", c_ubyte), # 是否领取所有
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x31
|
| | | self.SubCmd = 0x38
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x31
|
| | | self.RefreshType = 0
|
| | | self.SubCmd = 0x38
|
| | | self.AwardIndex = 0
|
| | | self.IsAll = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMMineItemRefresh)
|
| | | return sizeof(tagCSGoldRushWarehouseAward)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 31 福地物品刷新 //tagCMMineItemRefresh:
|
| | | DumpString = '''// B0 38 淘金仓库领奖 //tagCSGoldRushWarehouseAward:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | RefreshType:%d
|
| | | AwardIndex:%d,
|
| | | IsAll:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.RefreshType
|
| | | self.AwardIndex,
|
| | | self.IsAll
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMMineItemRefresh=tagCMMineItemRefresh()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMMineItemRefresh.Cmd,m_NAtagCMMineItemRefresh.SubCmd))] = m_NAtagCMMineItemRefresh
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 32 福地工人雇佣 #tagCMMineWorkerEmploy
|
| | |
|
| | | class tagCMMineWorkerEmploy(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x32
|
| | | 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 = 0xB0
|
| | | self.SubCmd = 0x32
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMMineWorkerEmploy)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 32 福地工人雇佣 //tagCMMineWorkerEmploy:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMMineWorkerEmploy=tagCMMineWorkerEmploy()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMMineWorkerEmploy.Cmd,m_NAtagCMMineWorkerEmploy.SubCmd))] = m_NAtagCMMineWorkerEmploy
|
| | | m_NAtagCSGoldRushWarehouseAward=tagCSGoldRushWarehouseAward()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSGoldRushWarehouseAward.Cmd,m_NAtagCSGoldRushWarehouseAward.SubCmd))] = m_NAtagCSGoldRushWarehouseAward
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ReqType", c_ubyte), # 0-停止战斗回城;1-设置消耗倍值;2-挑战关卡小怪;3-挑战关卡boss;4-继续战斗;
|
| | | ("ReqType", c_ubyte), # 0-停止战斗回城;1-设置消耗倍值;2-挑战关卡小怪;4-继续战斗;
|
| | | ("ReqValue", c_int), # 请求值,ReqType为1时发送消耗倍值
|
| | | ]
|
| | |
|
| | |
| | |
|
| | | class tagCMTurnFight(Structure):
|
| | | Head = tagHead()
|
| | | MapID = 0 #(DWORD MapID)// 自定义地图ID,可用于绑定战斗地图场景功能(如主线关卡、主线boss、爬塔、竞技场等)
|
| | | MapID = 0 #(DWORD MapID)// 自定义地图ID,可用于绑定战斗地图场景功能(如主线boss、爬塔、竞技场等)
|
| | | FuncLineID = 0 #(DWORD FuncLineID)// MapID对应的扩展值,如具体某个关卡等
|
| | | TagType = 0 #(BYTE TagType)// 目标类型,0-NPC阵容,1-玩家
|
| | | TagID = 0 #(DWORD TagID)// 目标类型对应的ID,如阵容ID或玩家ID
|
| | | TagID = 0 #(DWORD TagID)// 目标类型对应的ID,如玩家ID
|
| | | ValueCount = 0 #(BYTE ValueCount)
|
| | | ValueList = list() #(vector<DWORD> ValueList)// 附加值列表,可选,具体含义由MapID决定
|
| | | data = None
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 50 收杆结果 #tagMCFishResult
|
| | |
|
| | | class tagMCFishResult(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x50
|
| | | 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 = 0xB0
|
| | | self.SubCmd = 0x50
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCFishResult)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 50 收杆结果 //tagMCFishResult:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFishResult=tagMCFishResult()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFishResult.Cmd,m_NAtagMCFishResult.SubCmd))] = m_NAtagMCFishResult
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 05 接收协助感谢礼物预览 #tagGCGetAssistThanksGiftPreview
|
| | |
|
| | | class tagGCGetAssistThanksGiftPreview(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 34 福地结算奖励信息 #tagGCMineAreaAwardInfo
|
| | | # B0 37 淘金营地信息 #tagSCGoldRushCampInfo
|
| | |
|
| | | class tagGCMineAreaAwardInfo(Structure):
|
| | | Head = tagHead()
|
| | | AwardType = 0 #(BYTE AwardType)// 0-通知有奖励,前端下次进入福地可请求进行结算;1-结算奖励结果通知
|
| | | AwardLen = 0 #(BYTE AwardLen)
|
| | | AwardInfo = "" #(String AwardInfo)//奖励信息 [物品ID,个数,是否拍品], ...]
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x34
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.AwardType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.AwardLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.AwardInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.AwardLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x34
|
| | | self.AwardType = 0
|
| | | self.AwardLen = 0
|
| | | self.AwardInfo = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.AwardInfo)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.AwardType)
|
| | | data = CommFunc.WriteBYTE(data, self.AwardLen)
|
| | | data = CommFunc.WriteString(data, self.AwardLen, self.AwardInfo)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | AwardType:%d,
|
| | | AwardLen:%d,
|
| | | AwardInfo:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.AwardType,
|
| | | self.AwardLen,
|
| | | self.AwardInfo
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagGCMineAreaAwardInfo=tagGCMineAreaAwardInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCMineAreaAwardInfo.Head.Cmd,m_NAtagGCMineAreaAwardInfo.Head.SubCmd))] = m_NAtagGCMineAreaAwardInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 33 福地详细信息 #tagGCMineAreaInfo
|
| | |
|
| | | class tagGCMineItem(Structure):
|
| | | Index = 0 #(BYTE Index)// 矿物所在福地位置索引,0~n
|
| | | MineID = 0 #(WORD MineID)// 矿物ID,对应福地采集表中ID,0代表该索引位置没有矿物
|
| | | MineType = 0 #(BYTE MineType)// 矿物类型:0-常规;1-超级
|
| | | UpdTime = 0 #(DWORD UpdTime)// 最后一次更新时间戳
|
| | | PosLen = 0 #(BYTE PosLen)
|
| | | Position = "" #(String Position)// 最后一次更新时所在位置百分比,0~100,支持小数,下0上100,可认为分为100格,速度为 x格/秒
|
| | | SpeedLen = 0 #(BYTE SpeedLen)
|
| | | MoveSpeed = "" #(String MoveSpeed)// 移动速度,x格/秒,支持小数
|
| | | EndTime = 0 #(DWORD EndTime)// 拉取结束时间戳
|
| | | WorkerCount = 0 #(BYTE WorkerCount)// 工人个数,为0时代表福地玩家没有使用工人拉回
|
| | | RobPlayerID = 0 #(DWORD RobPlayerID)// 抢夺玩家ID,为0时代表没人抢夺
|
| | | RobWorkerCount = 0 #(BYTE RobWorkerCount)// 抢夺工人个数
|
| | | RobPlayerName = "" #(char RobPlayerName[33])
|
| | | RobJob = 0 #(BYTE RobJob)
|
| | | RobFace = 0 #(DWORD RobFace)
|
| | | RobFacePic = 0 #(DWORD RobFacePic)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.Index,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.MineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.MineType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.UpdTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PosLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Position,_pos = CommFunc.ReadString(_lpData, _pos,self.PosLen)
|
| | | self.SpeedLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.MoveSpeed,_pos = CommFunc.ReadString(_lpData, _pos,self.SpeedLen)
|
| | | self.EndTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.WorkerCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RobPlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RobWorkerCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RobPlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
|
| | | self.RobJob,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RobFace,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RobFacePic,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Index = 0
|
| | | self.MineID = 0
|
| | | self.MineType = 0
|
| | | self.UpdTime = 0
|
| | | self.PosLen = 0
|
| | | self.Position = ""
|
| | | self.SpeedLen = 0
|
| | | self.MoveSpeed = ""
|
| | | self.EndTime = 0
|
| | | self.WorkerCount = 0
|
| | | self.RobPlayerID = 0
|
| | | self.RobWorkerCount = 0
|
| | | self.RobPlayerName = ""
|
| | | self.RobJob = 0
|
| | | self.RobFace = 0
|
| | | self.RobFacePic = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.Position)
|
| | | length += 1
|
| | | length += len(self.MoveSpeed)
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | length += 33
|
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteBYTE(data, self.Index)
|
| | | data = CommFunc.WriteWORD(data, self.MineID)
|
| | | data = CommFunc.WriteBYTE(data, self.MineType)
|
| | | data = CommFunc.WriteDWORD(data, self.UpdTime)
|
| | | data = CommFunc.WriteBYTE(data, self.PosLen)
|
| | | data = CommFunc.WriteString(data, self.PosLen, self.Position)
|
| | | data = CommFunc.WriteBYTE(data, self.SpeedLen)
|
| | | data = CommFunc.WriteString(data, self.SpeedLen, self.MoveSpeed)
|
| | | data = CommFunc.WriteDWORD(data, self.EndTime)
|
| | | data = CommFunc.WriteBYTE(data, self.WorkerCount)
|
| | | data = CommFunc.WriteDWORD(data, self.RobPlayerID)
|
| | | data = CommFunc.WriteBYTE(data, self.RobWorkerCount)
|
| | | data = CommFunc.WriteString(data, 33, self.RobPlayerName)
|
| | | data = CommFunc.WriteBYTE(data, self.RobJob)
|
| | | data = CommFunc.WriteDWORD(data, self.RobFace)
|
| | | data = CommFunc.WriteDWORD(data, self.RobFacePic)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Index:%d,
|
| | | MineID:%d,
|
| | | MineType:%d,
|
| | | UpdTime:%d,
|
| | | PosLen:%d,
|
| | | Position:%s,
|
| | | SpeedLen:%d,
|
| | | MoveSpeed:%s,
|
| | | EndTime:%d,
|
| | | WorkerCount:%d,
|
| | | RobPlayerID:%d,
|
| | | RobWorkerCount:%d,
|
| | | RobPlayerName:%s,
|
| | | RobJob:%d,
|
| | | RobFace:%d,
|
| | | RobFacePic:%d
|
| | | '''\
|
| | | %(
|
| | | self.Index,
|
| | | self.MineID,
|
| | | self.MineType,
|
| | | self.UpdTime,
|
| | | self.PosLen,
|
| | | self.Position,
|
| | | self.SpeedLen,
|
| | | self.MoveSpeed,
|
| | | self.EndTime,
|
| | | self.WorkerCount,
|
| | | self.RobPlayerID,
|
| | | self.RobWorkerCount,
|
| | | self.RobPlayerName,
|
| | | self.RobJob,
|
| | | self.RobFace,
|
| | | self.RobFacePic
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCMineArea(Structure):
|
| | | PlayerID = 0 #(DWORD PlayerID)// 福地所属玩家ID,可能是自己或其他玩家ID,当ID小于10000时为假人
|
| | | PlayerName = "" #(char PlayerName[33])// 可能为空,如自己或假人
|
| | | Job = 0 #(BYTE Job)
|
| | | Face = 0 #(DWORD Face)
|
| | | FacePic = 0 #(DWORD FacePic)
|
| | | RobValue = 0 #(DWORD RobValue)// 抢劫敌对值
|
| | | MineCount = 0 #(BYTE MineCount)
|
| | | MineItemList = list() #(vector<tagGCMineItem> MineItemList)// 矿物列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
|
| | | self.Job,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Face,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.FacePic,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RobValue,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.MineCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.MineCount):
|
| | | temMineItemList = tagGCMineItem()
|
| | | _pos = temMineItemList.ReadData(_lpData, _pos)
|
| | | self.MineItemList.append(temMineItemList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.PlayerID = 0
|
| | | self.PlayerName = ""
|
| | | self.Job = 0
|
| | | self.Face = 0
|
| | | self.FacePic = 0
|
| | | self.RobValue = 0
|
| | | self.MineCount = 0
|
| | | self.MineItemList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 4
|
| | | length += 33
|
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.MineCount):
|
| | | length += self.MineItemList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteDWORD(data, self.PlayerID)
|
| | | data = CommFunc.WriteString(data, 33, self.PlayerName)
|
| | | data = CommFunc.WriteBYTE(data, self.Job)
|
| | | data = CommFunc.WriteDWORD(data, self.Face)
|
| | | data = CommFunc.WriteDWORD(data, self.FacePic)
|
| | | data = CommFunc.WriteDWORD(data, self.RobValue)
|
| | | data = CommFunc.WriteBYTE(data, self.MineCount)
|
| | | for i in range(self.MineCount):
|
| | | data = CommFunc.WriteString(data, self.MineItemList[i].GetLength(), self.MineItemList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | PlayerID:%d,
|
| | | PlayerName:%s,
|
| | | Job:%d,
|
| | | Face:%d,
|
| | | FacePic:%d,
|
| | | RobValue:%d,
|
| | | MineCount:%d,
|
| | | MineItemList:%s
|
| | | '''\
|
| | | %(
|
| | | self.PlayerID,
|
| | | self.PlayerName,
|
| | | self.Job,
|
| | | self.Face,
|
| | | self.FacePic,
|
| | | self.RobValue,
|
| | | self.MineCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCMineAreaInfo(Structure):
|
| | | Head = tagHead()
|
| | | QueryType = 0 #(BYTE QueryType)// 查询同步类型:0-后端主动同步;1-查看指定福地;2-查看道友福地列表;3-查看周围随机福地列表
|
| | | QueryValue = 0 #(DWORD QueryValue)// 查询值,类型1时-发送目标玩家ID;3时-发送是否重新随机
|
| | | AreaCount = 0 #(BYTE AreaCount)
|
| | | AreaList = list() #(vector<tagGCMineArea> AreaList)// 福地列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x33
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.QueryType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.QueryValue,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.AreaCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.AreaCount):
|
| | | temAreaList = tagGCMineArea()
|
| | | _pos = temAreaList.ReadData(_lpData, _pos)
|
| | | self.AreaList.append(temAreaList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x33
|
| | | self.QueryType = 0
|
| | | self.QueryValue = 0
|
| | | self.AreaCount = 0
|
| | | self.AreaList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.AreaCount):
|
| | | length += self.AreaList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.QueryType)
|
| | | data = CommFunc.WriteDWORD(data, self.QueryValue)
|
| | | data = CommFunc.WriteBYTE(data, self.AreaCount)
|
| | | for i in range(self.AreaCount):
|
| | | data = CommFunc.WriteString(data, self.AreaList[i].GetLength(), self.AreaList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | QueryType:%d,
|
| | | QueryValue:%d,
|
| | | AreaCount:%d,
|
| | | AreaList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.QueryType,
|
| | | self.QueryValue,
|
| | | self.AreaCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagGCMineAreaInfo=tagGCMineAreaInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCMineAreaInfo.Head.Cmd,m_NAtagGCMineAreaInfo.Head.SubCmd))] = m_NAtagGCMineAreaInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 35 福地记录信息 #tagGCMineAreaRecordInfo
|
| | |
|
| | | class tagGCMineAreaRecord(Structure):
|
| | | RecordType = 0 #(BYTE RecordType)// 记录类型;1-自己拉物品;2-物品被人抢
|
| | | TagPlayerID = 0 #(DWORD TagPlayerID)// 目标玩家ID,等于自己玩家ID时代表拉自己的,反之为抢别人的
|
| | | RecordTime = 0 #(DWORD RecordTime)// 记录时间戳
|
| | | MineID = 0 #(WORD MineID)// 矿物ID,对应福地采集表中ID
|
| | | TagPlayerName = "" #(char TagPlayerName[33])
|
| | | TagJob = 0 #(BYTE TagJob)
|
| | | TagFace = 0 #(DWORD TagFace)
|
| | | TagFacePic = 0 #(DWORD TagFacePic)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.RecordType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.TagPlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RecordTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.MineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.TagPlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
|
| | | self.TagJob,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.TagFace,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.TagFacePic,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.RecordType = 0
|
| | | self.TagPlayerID = 0
|
| | | self.RecordTime = 0
|
| | | self.MineID = 0
|
| | | self.TagPlayerName = ""
|
| | | self.TagJob = 0
|
| | | self.TagFace = 0
|
| | | self.TagFacePic = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | | length += 2
|
| | | length += 33
|
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteBYTE(data, self.RecordType)
|
| | | data = CommFunc.WriteDWORD(data, self.TagPlayerID)
|
| | | data = CommFunc.WriteDWORD(data, self.RecordTime)
|
| | | data = CommFunc.WriteWORD(data, self.MineID)
|
| | | data = CommFunc.WriteString(data, 33, self.TagPlayerName)
|
| | | data = CommFunc.WriteBYTE(data, self.TagJob)
|
| | | data = CommFunc.WriteDWORD(data, self.TagFace)
|
| | | data = CommFunc.WriteDWORD(data, self.TagFacePic)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | RecordType:%d,
|
| | | TagPlayerID:%d,
|
| | | RecordTime:%d,
|
| | | MineID:%d,
|
| | | TagPlayerName:%s,
|
| | | TagJob:%d,
|
| | | TagFace:%d,
|
| | | TagFacePic:%d
|
| | | '''\
|
| | | %(
|
| | | self.RecordType,
|
| | | self.TagPlayerID,
|
| | | self.RecordTime,
|
| | | self.MineID,
|
| | | self.TagPlayerName,
|
| | | self.TagJob,
|
| | | self.TagFace,
|
| | | self.TagFacePic
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCMineAreaRecordInfo(Structure):
|
| | | Head = tagHead()
|
| | | RecordCount = 0 #(BYTE RecordCount)
|
| | | AreaRecordList = list() #(vector<tagGCMineAreaRecord> AreaRecordList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x35
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.RecordCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RecordCount):
|
| | | temAreaRecordList = tagGCMineAreaRecord()
|
| | | _pos = temAreaRecordList.ReadData(_lpData, _pos)
|
| | | self.AreaRecordList.append(temAreaRecordList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x35
|
| | | self.RecordCount = 0
|
| | | self.AreaRecordList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.RecordCount):
|
| | | length += self.AreaRecordList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.RecordCount)
|
| | | for i in range(self.RecordCount):
|
| | | data = CommFunc.WriteString(data, self.AreaRecordList[i].GetLength(), self.AreaRecordList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | RecordCount:%d,
|
| | | AreaRecordList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.RecordCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagGCMineAreaRecordInfo=tagGCMineAreaRecordInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCMineAreaRecordInfo.Head.Cmd,m_NAtagGCMineAreaRecordInfo.Head.SubCmd))] = m_NAtagGCMineAreaRecordInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 32 福地物品拉预览结果 #tagGCMineItemPullPreviewRet
|
| | |
|
| | | class tagGCMineItemPullPreviewRet(Structure):
|
| | | class tagSCGoldRushCamp(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("PlayerID", c_int), # 福地所属玩家ID,0默认自己
|
| | | ("ItemIndex", c_ubyte), # 物品所在位置索引0~n
|
| | | ("WorkerCount", c_ubyte), # 上工人人数
|
| | | ("NeedSeconds", c_int), # 预计需要时间,秒
|
| | | ("CampID", c_ubyte), # 营地ID,从1开始
|
| | | ("GoldID", c_ubyte), # 淘金ID,为0时代表该营地为空
|
| | | ("RefreshCnt", c_ushort), # 已刷新次数
|
| | | ("EndTime", c_int), # 预计完成时的时间戳,为0时代表还未开始淘金,通过该时间进行倒计时,完成时需发送操作完成淘金
|
| | | ("WorkerCnt", c_ubyte), # 使用监工数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x32
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x32
|
| | | self.PlayerID = 0
|
| | | self.ItemIndex = 0
|
| | | self.WorkerCount = 0
|
| | | self.NeedSeconds = 0
|
| | | self.CampID = 0
|
| | | self.GoldID = 0
|
| | | self.RefreshCnt = 0
|
| | | self.EndTime = 0
|
| | | self.WorkerCnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagGCMineItemPullPreviewRet)
|
| | | return sizeof(tagSCGoldRushCamp)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 32 福地物品拉预览结果 //tagGCMineItemPullPreviewRet:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | PlayerID:%d,
|
| | | ItemIndex:%d,
|
| | | WorkerCount:%d,
|
| | | NeedSeconds:%d
|
| | | DumpString = '''// B0 37 淘金营地信息 //tagSCGoldRushCampInfo:
|
| | | CampID:%d,
|
| | | GoldID:%d,
|
| | | RefreshCnt:%d,
|
| | | EndTime:%d,
|
| | | WorkerCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.PlayerID,
|
| | | self.ItemIndex,
|
| | | self.WorkerCount,
|
| | | self.NeedSeconds
|
| | | self.CampID,
|
| | | self.GoldID,
|
| | | self.RefreshCnt,
|
| | | self.EndTime,
|
| | | self.WorkerCnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagGCMineItemPullPreviewRet=tagGCMineItemPullPreviewRet()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCMineItemPullPreviewRet.Cmd,m_NAtagGCMineItemPullPreviewRet.SubCmd))] = m_NAtagGCMineItemPullPreviewRet
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 30 玩家福地相关信息 #tagMCPlayerMineAreaInfo
|
| | |
|
| | | class tagMCPlayerMineAreaInfo(Structure):
|
| | | class tagSCGoldRushCampInfo(Structure):
|
| | | Head = tagHead()
|
| | | WorkerCount = 0 #(BYTE WorkerCount)// 已雇佣工人数
|
| | | EnergyUsed = 0 #(WORD EnergyUsed)// 今日已消耗体力
|
| | | RefreshCount = 0 #(DWORD RefreshCount)// 今日福地刷新物品次数 - 普通刷新
|
| | | RefreshCountSuper = 0 #(BYTE RefreshCountSuper)// 今日福地刷新物品次数 - 超级刷新
|
| | | RefreshCountRob = 0 #(WORD RefreshCountRob)// 今日福地刷新周围玩家次数
|
| | | TreasureCount = 0 #(BYTE TreasureCount)// 聚宝盆类型个数,对应类型 0~n
|
| | | TreasureState = list() #(vector<BYTE> TreasureState)// 聚宝盆是否已激活列表,[类型0是否已激活, ...]
|
| | | TreasureAward = list() #(vector<BYTE> TreasureAward)// 聚宝盆奖励是否已领取列表,[类型0是否已领取, ...]
|
| | | TreasureProgress = list() #(vector<BYTE> TreasureProgress)// 聚宝盆进度值列表,[类型0进度值, ...],满进度100
|
| | | HelpAwardCount = 0 #(BYTE HelpAwardCount)// 今日已帮助别人奖励次数
|
| | | HousekeeperEndTime = 0 #(DWORD HousekeeperEndTime)// 自动管家到期时间戳,有值同时也代表免费试用已使用
|
| | | CampCnt = 0 #(BYTE CampCnt)
|
| | | CampList = list() #(vector<tagSCGoldRushCamp> CampList)// 营地列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x30
|
| | | self.Head.SubCmd = 0x37
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.WorkerCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.EnergyUsed,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.RefreshCount,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RefreshCountSuper,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RefreshCountRob,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.TreasureCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.TreasureCount):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.TreasureState.append(value)
|
| | | for i in range(self.TreasureCount):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.TreasureAward.append(value)
|
| | | for i in range(self.TreasureCount):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.TreasureProgress.append(value)
|
| | | self.HelpAwardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.HousekeeperEndTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.CampCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.CampCnt):
|
| | | temCampList = tagSCGoldRushCamp()
|
| | | _pos = temCampList.ReadData(_lpData, _pos)
|
| | | self.CampList.append(temCampList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x30
|
| | | self.WorkerCount = 0
|
| | | self.EnergyUsed = 0
|
| | | self.RefreshCount = 0
|
| | | self.RefreshCountSuper = 0
|
| | | self.RefreshCountRob = 0
|
| | | self.TreasureCount = 0
|
| | | self.TreasureState = list()
|
| | | self.TreasureAward = list()
|
| | | self.TreasureProgress = list()
|
| | | self.HelpAwardCount = 0
|
| | | self.HousekeeperEndTime = 0
|
| | | self.Head.SubCmd = 0x37
|
| | | self.CampCnt = 0
|
| | | self.CampList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 2
|
| | | length += 4
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | length += 1 * self.TreasureCount
|
| | | length += 1 * self.TreasureCount
|
| | | length += 1 * self.TreasureCount
|
| | | length += 1
|
| | | length += 4
|
| | | for i in range(self.CampCnt):
|
| | | length += self.CampList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.WorkerCount)
|
| | | data = CommFunc.WriteWORD(data, self.EnergyUsed)
|
| | | data = CommFunc.WriteDWORD(data, self.RefreshCount)
|
| | | data = CommFunc.WriteBYTE(data, self.RefreshCountSuper)
|
| | | data = CommFunc.WriteWORD(data, self.RefreshCountRob)
|
| | | data = CommFunc.WriteBYTE(data, self.TreasureCount)
|
| | | for i in range(self.TreasureCount):
|
| | | data = CommFunc.WriteBYTE(data, self.TreasureState[i])
|
| | | for i in range(self.TreasureCount):
|
| | | data = CommFunc.WriteBYTE(data, self.TreasureAward[i])
|
| | | for i in range(self.TreasureCount):
|
| | | data = CommFunc.WriteBYTE(data, self.TreasureProgress[i])
|
| | | data = CommFunc.WriteBYTE(data, self.HelpAwardCount)
|
| | | data = CommFunc.WriteDWORD(data, self.HousekeeperEndTime)
|
| | | data = CommFunc.WriteBYTE(data, self.CampCnt)
|
| | | for i in range(self.CampCnt):
|
| | | data = CommFunc.WriteString(data, self.CampList[i].GetLength(), self.CampList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | WorkerCount:%d,
|
| | | EnergyUsed:%d,
|
| | | RefreshCount:%d,
|
| | | RefreshCountSuper:%d,
|
| | | RefreshCountRob:%d,
|
| | | TreasureCount:%d,
|
| | | TreasureState:%s,
|
| | | TreasureAward:%s,
|
| | | TreasureProgress:%s,
|
| | | HelpAwardCount:%d,
|
| | | HousekeeperEndTime:%d
|
| | | CampCnt:%d,
|
| | | CampList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.WorkerCount,
|
| | | self.EnergyUsed,
|
| | | self.RefreshCount,
|
| | | self.RefreshCountSuper,
|
| | | self.RefreshCountRob,
|
| | | self.TreasureCount,
|
| | | "...",
|
| | | "...",
|
| | | "...",
|
| | | self.HelpAwardCount,
|
| | | self.HousekeeperEndTime
|
| | | self.CampCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCPlayerMineAreaInfo=tagMCPlayerMineAreaInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCPlayerMineAreaInfo.Head.Cmd,m_NAtagMCPlayerMineAreaInfo.Head.SubCmd))] = m_NAtagMCPlayerMineAreaInfo
|
| | | m_NAtagSCGoldRushCampInfo=tagSCGoldRushCampInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCGoldRushCampInfo.Head.Cmd,m_NAtagSCGoldRushCampInfo.Head.SubCmd))] = m_NAtagSCGoldRushCampInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 36 淘金相关信息 #tagSCGoldRushInfo
|
| | |
|
| | | class tagSCGoldRushInfo(Structure):
|
| | | Head = tagHead()
|
| | | CampState = 0 #(DWORD CampState)// 已解锁营地状态,按营地ID二进制位运算判断是否已解锁
|
| | | WorkerState = 0 #(DWORD WorkerState)// 已雇佣工人状态,按工人ID二进制位运算判断是否已解锁
|
| | | PanningCnt = 0 #(DWORD PanningCnt)// 累计淘金次数
|
| | | LastRecoverTime = 0 #(DWORD LastRecoverTime)// 上次免费恢复淘金令时间戳,为0时可不用倒计时
|
| | | HousekeeperEndTime = 0 #(DWORD HousekeeperEndTime)// 自动管家到期时间戳,有值同时也代表免费试用已使用
|
| | | WarehouseCnt = 0 #(BYTE WarehouseCnt)// 淘金仓库物品数
|
| | | WarehouseIDList = list() #(vector<BYTE> WarehouseIDList)// 淘金仓库已完成淘金ID列表 [索引0淘金ID, ...],淘金ID为0代表该索引位置为空
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x36
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.CampState,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.WorkerState,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PanningCnt,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.LastRecoverTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.HousekeeperEndTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.WarehouseCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.WarehouseCnt):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.WarehouseIDList.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x36
|
| | | self.CampState = 0
|
| | | self.WorkerState = 0
|
| | | self.PanningCnt = 0
|
| | | self.LastRecoverTime = 0
|
| | | self.HousekeeperEndTime = 0
|
| | | self.WarehouseCnt = 0
|
| | | self.WarehouseIDList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | | length += 1 * self.WarehouseCnt
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.CampState)
|
| | | data = CommFunc.WriteDWORD(data, self.WorkerState)
|
| | | data = CommFunc.WriteDWORD(data, self.PanningCnt)
|
| | | data = CommFunc.WriteDWORD(data, self.LastRecoverTime)
|
| | | data = CommFunc.WriteDWORD(data, self.HousekeeperEndTime)
|
| | | data = CommFunc.WriteBYTE(data, self.WarehouseCnt)
|
| | | for i in range(self.WarehouseCnt):
|
| | | data = CommFunc.WriteBYTE(data, self.WarehouseIDList[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | CampState:%d,
|
| | | WorkerState:%d,
|
| | | PanningCnt:%d,
|
| | | LastRecoverTime:%d,
|
| | | HousekeeperEndTime:%d,
|
| | | WarehouseCnt:%d,
|
| | | WarehouseIDList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.CampState,
|
| | | self.WorkerState,
|
| | | self.PanningCnt,
|
| | | self.LastRecoverTime,
|
| | | self.HousekeeperEndTime,
|
| | | self.WarehouseCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCGoldRushInfo=tagSCGoldRushInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCGoldRushInfo.Head.Cmd,m_NAtagSCGoldRushInfo.Head.SubCmd))] = m_NAtagSCGoldRushInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | | # @remarks 函数详细说明.
|
| | | def OnExec(curPlayer, msgList):
|
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "CTG 金额元 是否增加集市购买额度默认是")
|
| | | GameWorld.DebugAnswer(curPlayer, "CTG 商品编号 appID 是否增加集市购买额度")
|
| | | GameWorld.DebugAnswer(curPlayer, "CTG 金额元")
|
| | | GameWorld.DebugAnswer(curPlayer, "CTG 商品编号 appID")
|
| | | return
|
| | |
|
| | | ctgValue = str(msgList[0])
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package GM.Commands.GoldRush
|
| | | #
|
| | | # @todo:淘金
|
| | | # @author hxp
|
| | | # @date 2025-09-03
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 淘金
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-09-03 15:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import PlayerControl
|
| | | import PlayerGoldRush
|
| | | import IpyGameDataPY
|
| | | import ChConfig
|
| | | import time
|
| | |
|
| | | ## GM命令执行入口
|
| | | # @param curPlayer 当前玩家
|
| | | # @param msgList 参数列表 [addSkillID]
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnExec(curPlayer, msgList):
|
| | | # @return: 是否发送到GameServer
|
| | | |
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "---------- 淘金命令 ----------")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置淘金: GoldRush 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置营地: GoldRush c ID 是否解锁")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置监工: GoldRush w ID 是否解锁")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置仓库: GoldRush a 随机未领取奖励数")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置次数: GoldRush r 已淘金次数")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置管家: GoldRush k 剩余时长分钟")
|
| | | return True
|
| | | |
| | | value1 = msgList[0]
|
| | | if value1 == 0:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampState, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWorkerState, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCnt, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushRecoverTime, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, 0)
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGoldRushCampCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushCampByIndex(index)
|
| | | campID = ipyData.GetCampID()
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampInfo % campID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, 0)
|
| | | for index in range(sum(IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1))):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWarehouse % index, 0)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置淘金")
|
| | | |
| | | elif value1 == "c":
|
| | | campID = msgList[1] if len(msgList) > 1 else 0
|
| | | unlock = msgList[2] if len(msgList) > 2 else 0
|
| | | unlockState = 1 if unlock else 0
|
| | | campState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampState)
|
| | | campState = GameWorld.SetBitValue(campState, campID, unlockState)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampState, campState)
|
| | | GameWorld.DebugAnswer(curPlayer, "营地(%s)是否解锁: %s" % (campID, unlockState))
|
| | | |
| | | elif value1 == "w":
|
| | | workerID = msgList[1] if len(msgList) > 1 else 0
|
| | | unlock = msgList[2] if len(msgList) > 2 else 0
|
| | | unlockState = 1 if unlock else 0
|
| | | workerState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWorkerState)
|
| | | workerState = GameWorld.SetBitValue(workerState, workerID, unlockState)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWorkerState, workerState)
|
| | | GameWorld.DebugAnswer(curPlayer, "监工(%s)是否解锁: %s" % (workerID, unlockState))
|
| | | |
| | | elif value1 == "a":
|
| | | ungetCnt = msgList[1] if len(msgList) > 1 else 0
|
| | | spaceList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1)
|
| | | maxSpace = sum(spaceList) if PlayerGoldRush.GoldRushAutoCanUse(curPlayer) else spaceList[0]
|
| | | for index in range(maxSpace):
|
| | | if ungetCnt <= 0:
|
| | | break
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index):
|
| | | continue
|
| | | ipyData = PlayerGoldRush.GetRefreshGoldItemIpyData(curPlayer)
|
| | | if not ipyData:
|
| | | continue
|
| | | goldID = ipyData.GetGoldID()
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWarehouse % index, goldID)
|
| | | GameWorld.DebugAnswer(curPlayer, "淘金仓库随机未领取:index:%s,ID:%s" % (index, goldID))
|
| | | ungetCnt -= 1
|
| | | |
| | | elif value1 == "r":
|
| | | goldRushCnt = msgList[1] if len(msgList) > 1 else 0
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCnt, goldRushCnt)
|
| | | GameWorld.DebugAnswer(curPlayer, "已淘金次数: %s" % goldRushCnt)
|
| | | elif value1 == "k":
|
| | | remainMinutes = msgList[1] if len(msgList) > 1 else 0
|
| | | if remainMinutes > 0:
|
| | | endTime = int(time.time()) + remainMinutes * 60
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, endTime)
|
| | | GameWorld.DebugAnswer(curPlayer, "设置管家到期时间: %s" % GameWorld.ChangeTimeNumToStr(endTime))
|
| | | else:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, 0)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置管家到期时间: 0")
|
| | | else:
|
| | | return
|
| | | PlayerGoldRush.SyncGoldRushInfo(curPlayer)
|
| | | PlayerGoldRush.SyncGoldCampInfo(curPlayer)
|
| | | return
|
| | |
| | | ("DWORD", "LVUPNeedTime", 0),
|
| | | ("list", "EquipColorRateList", 0),
|
| | | ),
|
| | |
|
| | | "GoldRushCamp":(
|
| | | ("BYTE", "CampID", 1),
|
| | | ("WORD", "PanningUnlock", 0),
|
| | | ("list", "MoneyUnlock", 0),
|
| | | ),
|
| | |
|
| | | "GoldRushWorker":(
|
| | | ("BYTE", "WorkerID", 1),
|
| | | ("WORD", "PlayerLVUnlock", 0),
|
| | | ("list", "MoneyUnlock", 0),
|
| | | ),
|
| | |
|
| | | "GoldRushItem":(
|
| | | ("BYTE", "GoldID", 1),
|
| | | ("DWORD", "ItemID", 0),
|
| | | ("BYTE", "ItemLV", 0),
|
| | | ("DWORD", "ItemCount", 0),
|
| | | ("DWORD", "RefreshWeight", 0),
|
| | | ("BYTE", "WorkerMax", 0),
|
| | | ("BYTE", "NeedSeconds", 0),
|
| | | ),
|
| | | }
|
| | |
|
| | | |
| | |
| | | def GetLVUPNeedTime(self): return self.attrTuple[2] # 升级下一级所需所需秒 DWORD
|
| | | def GetEquipColorRateList(self): return self.attrTuple[3] # 产出装备品质概率列表,[0品质万分率, 1品质万分率, ...] list |
| | |
|
| | | # 淘金营地表 |
| | | class IPY_GoldRushCamp(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetCampID(self): return self.attrTuple[0] # BYTE
|
| | | def GetPanningUnlock(self): return self.attrTuple[1] # 淘金次数解锁 WORD
|
| | | def GetMoneyUnlock(self): return self.attrTuple[2] # 货币解锁,货币类型|货币值 list |
| | | |
| | | # 淘金监工表 |
| | | class IPY_GoldRushWorker(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetWorkerID(self): return self.attrTuple[0] # BYTE
|
| | | def GetPlayerLVUnlock(self): return self.attrTuple[1] # 主公等级解锁 WORD
|
| | | def GetMoneyUnlock(self): return self.attrTuple[2] # 货币解锁,货币类型|货币值 list |
| | | |
| | | # 淘金物品表 |
| | | class IPY_GoldRushItem(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetGoldID(self): return self.attrTuple[0] # 淘金ID BYTE
|
| | | def GetItemID(self): return self.attrTuple[1] # 物品ID DWORD
|
| | | def GetItemLV(self): return self.attrTuple[2] # 物品等级 BYTE
|
| | | def GetItemCount(self): return self.attrTuple[3] # 物品个数 DWORD
|
| | | def GetRefreshWeight(self): return self.attrTuple[4] # 常规刷新权重 DWORD
|
| | | def GetWorkerMax(self): return self.attrTuple[5] # 监工上限 BYTE
|
| | | def GetNeedSeconds(self): return self.attrTuple[6] # 耗时秒 BYTE |
| | |
|
| | |
|
| | | def Log(msg, playerID=0, par=0):
|
| | | LogUI.Msg("%s\t%s\t%s" % (par, playerID, msg))
|
| | |
| | | self.__LoadFileData("Xiangong", onlyCheck)
|
| | | self.__LoadFileData("TiandaoTree", onlyCheck)
|
| | | self.__LoadFileData("TreeLV", onlyCheck)
|
| | | self.__LoadFileData("GoldRushCamp", onlyCheck)
|
| | | self.__LoadFileData("GoldRushWorker", onlyCheck)
|
| | | self.__LoadFileData("GoldRushItem", onlyCheck)
|
| | | Log("IPY_DataMgr ReloadOK! onlyCheck=%s" % onlyCheck)
|
| | | return
|
| | |
|
| | |
| | | self.CheckLoadData("TreeLV") |
| | | return self.ipyTreeLVCache[index]
|
| | |
|
| | | def GetGoldRushCampCount(self): |
| | | self.CheckLoadData("GoldRushCamp") |
| | | return self.ipyGoldRushCampLen
|
| | | def GetGoldRushCampByIndex(self, index): |
| | | self.CheckLoadData("GoldRushCamp") |
| | | return self.ipyGoldRushCampCache[index]
|
| | | |
| | | def GetGoldRushWorkerCount(self): |
| | | self.CheckLoadData("GoldRushWorker") |
| | | return self.ipyGoldRushWorkerLen
|
| | | def GetGoldRushWorkerByIndex(self, index): |
| | | self.CheckLoadData("GoldRushWorker") |
| | | return self.ipyGoldRushWorkerCache[index]
|
| | | |
| | | def GetGoldRushItemCount(self): |
| | | self.CheckLoadData("GoldRushItem") |
| | | return self.ipyGoldRushItemLen
|
| | | def GetGoldRushItemByIndex(self, index): |
| | | self.CheckLoadData("GoldRushItem") |
| | | return self.ipyGoldRushItemCache[index]
|
| | |
|
| | | IPYData = IPY_DataMgr()
|
| | | def IPY_Data(): return IPYData
|
| | |
|
| | |
| | | import PlayerFace
|
| | | import PlayerChatBox
|
| | | import PlayerXiangong
|
| | | import PlayerMineArea
|
| | | import PlayerGoldRush
|
| | | import PlayerActLoginNew
|
| | | import PlayerActBuyCountGift
|
| | | import PlayerActLunhuidian
|
| | |
| | | PlayerZhanling.OnPlayerLogin(curPlayer)
|
| | | PlayerTask.OnPlayerLogin(curPlayer)
|
| | | PlayerTree.OnPlayerLogin(curPlayer)
|
| | | PlayerMineArea.OnPlayerLogin(curPlayer)
|
| | | PlayerGoldRush.OnPlayerLogin(curPlayer)
|
| | | PlayerActFamilyGCZ.OnPlayerLogin(curPlayer)
|
| | | PlayerTalk.OnPlayerLogin(curPlayer)
|
| | |
|
| | |
| | | PlayerControl.SendMailByKey(mailTypeKey, [curPlayer.GetPlayerID()], mailItemList)
|
| | |
|
| | | PlayerHero.OnPlayerFirstLogin(curPlayer)
|
| | | |
| | | #淘金初始化
|
| | | PlayerGoldRush.InitGoldEnergy(curPlayer)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FirstLogin, 1)
|
| | | return
|
| | |
| | | #战令奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_Zhanling:
|
| | | PlayerZhanling.GetZhanlingReward(curPlayer, dataEx, dataExStr)
|
| | | #福地聚宝盆奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_MineTreasure:
|
| | | PlayerMineArea.GetMineTreasureAward(curPlayer, dataEx)
|
| | | #玩法前瞻奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_GameNotice:
|
| | | OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_GameNoticeAwardState, IpyGameDataPY.GetFuncEvalCfg("GameNoticeReward", 1))
|
| | |
| | | # ShareDefine.GameFuncID_Pet:lambda curObj:PlayerPet.DoLVUPLogic_Pet(curObj),
|
| | | # }
|
| | |
|
| | | # 功能开启需要同步到GameServer的
|
| | | FuncOpenNotifyGameServer = [ShareDefine.GameFuncID_Championship, ShareDefine.GameFuncID_MineArea]
|
| | |
|
| | | def GetFuncOpenLVIpyData(funcID): return IpyGameDataPY.GetIpyGameData("FuncOpenLV", funcID)
|
| | |
|
| | | def DoFuncOpenLogic(curPlayer, finishMissionIDList=[]):
|
| | |
| | |
|
| | | if openFuncIDList:
|
| | | Sync_FuncOpenState(curPlayer, openFuncIDList)
|
| | | notifyGameServerFuncIDList = []
|
| | | for funcID in openFuncIDList:
|
| | | if funcID not in FuncOpenNotifyGameServer:
|
| | | continue
|
| | | notifyGameServerFuncIDList.append(funcID)
|
| | | if notifyGameServerFuncIDList:
|
| | | GameWorld.DebugLog("notifyGameServerFuncIDList=%s" % notifyGameServerFuncIDList)
|
| | | msgInfo = str(notifyGameServerFuncIDList)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "FuncOpen", msgInfo, len(msgInfo))
|
| | | |
| | | PlayerActTask.OnCheckRelateFuncAct(curPlayer, openFuncIDList)
|
| | | PlayerActLoginNew.OnCheckRelateFuncAct(curPlayer, openFuncIDList)
|
| | | PlayerActBuyCountGift.OnCheckRelateFuncAct(curPlayer, openFuncIDList)
|
| | |
| | | import PlayerActTurntable
|
| | | import PlayerTongTianLing
|
| | | import PlayerZhanling
|
| | | import PlayerMineArea
|
| | | import PlayerGoldRush
|
| | | import ItemCommon
|
| | | import PyGameData
|
| | | import CommFunc
|
| | |
| | | PlayerGoldInvest.InvestByCTG(curPlayer, ctgID)
|
| | | PlayerGoldGift.OnGiftByCTGID(curPlayer, ctgID)
|
| | | PlayerZhanling.OnActiviteByCTGID(curPlayer, ctgID)
|
| | | PlayerMineArea.OnMineTreasureByCTGID(curPlayer, ctgID)
|
| | | PlayerGoldRush.OnGoldRushByCTGID(curPlayer, ctgID)
|
| | | PlayerTongTianLing.OnActiviteTTTByCTGID(curPlayer, ctgID)
|
| | |
|
| | | serverDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
|
| | |
| | | import PlayerArena
|
| | | import PyGameData
|
| | | import PlayerXiangong
|
| | | import PlayerMineArea
|
| | | import PlayerBillboard
|
| | | import PlayerViewCache
|
| | | import PlayerMail
|
| | |
| | | PlayerCrossChampionship.DoPlayerOnDay(curPlayer)
|
| | | #竞技场
|
| | | PlayerArena.OnDayEx(curPlayer)
|
| | | #福地
|
| | | PlayerMineArea.PlayerOnDay(curPlayer)
|
| | | #特殊时间点过天的,一般是游戏功能,此时立即同步一次跨服玩家数据
|
| | | CrossPlayerData.SendMergePlayerDataNow(curPlayer)
|
| | |
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.PlayerGoldRush
|
| | | #
|
| | | # @todo:淘金
|
| | | # @author hxp
|
| | | # @date 2025-09-03
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 淘金
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-09-03 15:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import GameWorld
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import ItemControler
|
| | | import ChPyNetSendPack
|
| | | import PlayerControl
|
| | | import GameFuncComm
|
| | | import ShareDefine
|
| | | import ObjPool
|
| | |
|
| | | import time
|
| | | import math
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | __CheckGoldRushFreeUnlock(curPlayer)
|
| | | SyncGoldRushInfo(curPlayer)
|
| | | SyncGoldCampInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def __CheckGoldRushFreeUnlock(curPlayer):
|
| | | ## 检查默认解锁,即没有解锁条件的,有条件的需要手动解锁
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | campState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampState)
|
| | | for index in range(ipyDataMgr.GetGoldRushCampCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushCampByIndex(index)
|
| | | campID = ipyData.GetCampID()
|
| | | if campState & pow(2, campID):
|
| | | continue
|
| | | if ipyData.GetPanningUnlock() or ipyData.GetMoneyUnlock():
|
| | | #有解锁条件的不判断
|
| | | continue
|
| | | campState |= pow(2, campID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampState, campState)
|
| | | GameWorld.DebugLog("默认解锁淘金营地: campID=%s,campState=%s" % (campID, campState), playerID)
|
| | | |
| | | workerState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWorkerState)
|
| | | for index in range(ipyDataMgr.GetGoldRushWorkerCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushWorkerByIndex(index)
|
| | | workerID = ipyData.GetWorkerID()
|
| | | if workerState & pow(2, workerID):
|
| | | continue
|
| | | if ipyData.GetPlayerLVUnlock() or ipyData.GetMoneyUnlock():
|
| | | #有解锁条件的不判断
|
| | | continue
|
| | | workerState |= pow(2, workerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWorkerState, workerState)
|
| | | GameWorld.DebugLog("默认解锁淘金监工: workerID=%s,workerState=%s" % (workerID, workerState), playerID)
|
| | | |
| | | return
|
| | |
|
| | | def OnProcess(curPlayer):
|
| | | CheckGoldPushEnergyRecover(curPlayer)
|
| | | CheckGoldRushCamp(curPlayer)
|
| | | return
|
| | |
|
| | | def GetCampInfo(curPlayer, campID):
|
| | | ## 营地信息
|
| | | # 已刷新次数*1000+淘金ID*10+派遣工人数
|
| | | # @return refreshCnt, goldID, workerCnt
|
| | | campInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampInfo % campID)
|
| | | refreshCnt = campInfo / 1000
|
| | | goldID = campInfo % 1000 / 10
|
| | | workerCnt = campInfo % 10
|
| | | return refreshCnt, goldID, workerCnt
|
| | |
|
| | | def SetCampInfo(curPlayer, campID, refreshCnt, goldID, workerCnt, isNotify=True):
|
| | | ## 设置保存营地信息
|
| | | campInfo = refreshCnt * 1000 + min(goldID, 99) * 10 + workerCnt
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampInfo % campID, campInfo)
|
| | | if isNotify:
|
| | | SyncGoldCampInfo(curPlayer, [campID])
|
| | | return campInfo
|
| | |
|
| | | def GoldRushAutoCanUse(curPlayer):
|
| | | ## 自动淘金是否可用
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushAutoEndTime)
|
| | | return int(time.time()) <= endTime
|
| | |
|
| | | #// B0 36 淘金操作 #tagCSGoldRushOP
|
| | | #
|
| | | #struct tagCSGoldRushOP
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE OPType; // 0-接受淘金;1-刷新淘金;2-开始淘金或调整监工数;3-取消淘金;
|
| | | # BYTE CampID; // 营地ID
|
| | | # BYTE WorkerCnt; // 派遣监工数,仅类型2有效
|
| | | #};
|
| | | def OnGoldRushOP(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | OPType = clientData.OPType
|
| | | campID = clientData.CampID
|
| | | workerCnt = clientData.WorkerCnt
|
| | | |
| | | campState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampState)
|
| | | if not campState & pow(2, campID):
|
| | | GameWorld.DebugLog("该营地未解锁! campID=%s,campState=%s" % (campID, campState))
|
| | | return
|
| | | |
| | | if OPType == 0: # 0-接受淘金
|
| | | __onGoldRushAccept(curPlayer, campID)
|
| | | elif OPType == 1: # 1-刷新淘金
|
| | | __onGoldRushRefresh(curPlayer, campID)
|
| | | elif OPType == 2: # 2-开始淘金或调整监工数
|
| | | __onGoldRushStart(curPlayer, campID, workerCnt)
|
| | | elif OPType == 3: # 3-取消淘金
|
| | | __onGoldRushCancel(curPlayer, campID)
|
| | | |
| | | return
|
| | |
|
| | | def __onGoldRushAccept(curPlayer, campID):
|
| | | ## 接受
|
| | | refreshCnt, goldID, workerCnt = GetCampInfo(curPlayer, campID)
|
| | | if goldID:
|
| | | GameWorld.DebugLog("该营地已经有刷新淘金了,不能接受! campID=%s,goldID=%s" % (campID, goldID))
|
| | | return
|
| | | ipyData = GetRefreshGoldItemIpyData(curPlayer)
|
| | | if not ipyData:
|
| | | return
|
| | | # 接受淘金不受其他限制,有体力就行
|
| | | needMoney = IpyGameDataPY.GetFuncCfg("GoldRushRefresh", 1) # 需要淘金令数量
|
| | | if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_GoldRushEnergy, needMoney):
|
| | | return
|
| | | goldID = ipyData.GetGoldID()
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, 0)
|
| | | campInfo = SetCampInfo(curPlayer, campID, refreshCnt, goldID, workerCnt)
|
| | | GameWorld.DebugLog("接受淘金: campID=%s,goldID=%s,campInfo=%s" % (campID, goldID, campInfo))
|
| | | CheckGoldPushEnergyRecover(curPlayer, False)
|
| | | SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def InitGoldEnergy(curPlayer):
|
| | | energyList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 2)
|
| | | maxEnergy = sum(energyList) if GoldRushAutoCanUse(curPlayer) else energyList[0]
|
| | | curEnergy = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_GoldRushEnergy)
|
| | | if curEnergy >= maxEnergy:
|
| | | return
|
| | | addEnergy = maxEnergy - curEnergy
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_GoldRushEnergy, addEnergy)
|
| | | GameWorld.DebugLog("淘金初始化: addEnergy=%s" % addEnergy)
|
| | | return
|
| | |
|
| | | def CheckGoldPushEnergyRecover(curPlayer, isNotify=True):
|
| | | ## 检查体力恢复
|
| | | energyList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 2)
|
| | | maxEnergy = sum(energyList) if GoldRushAutoCanUse(curPlayer) else energyList[0]
|
| | | curEnergy = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_GoldRushEnergy)
|
| | | lastRecoverTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushRecoverTime)
|
| | | if curEnergy >= maxEnergy:
|
| | | if lastRecoverTime:
|
| | | GameWorld.DebugLog("淘金体力已满!")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushRecoverTime, 0)
|
| | | isNotify and SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | | |
| | | curTime = int(time.time())
|
| | | passSeconds = curTime - lastRecoverTime
|
| | | if not lastRecoverTime or passSeconds < 0:
|
| | | GameWorld.DebugLog("重设淘金体力恢复时间!")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushRecoverTime, curTime)
|
| | | isNotify and SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | | |
| | | cdSeconds = IpyGameDataPY.GetFuncCfg("GoldRush", 3) * 60
|
| | | if passSeconds < cdSeconds:
|
| | | return
|
| | | recoverCnt = passSeconds / cdSeconds
|
| | | updRecoverTime = curTime - passSeconds % cdSeconds
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushRecoverTime, updRecoverTime)
|
| | | GameWorld.DebugLog("恢复淘金令: %s,passSeconds=%s,上次恢复:%s" % (recoverCnt, passSeconds, GameWorld.ChangeTimeNumToStr(lastRecoverTime)))
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_GoldRushEnergy, recoverCnt)
|
| | | if PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_GoldRushEnergy) >= maxEnergy:
|
| | | GameWorld.DebugLog("体力已满!")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushRecoverTime, 0)
|
| | | isNotify and SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def GetRefreshGoldItemIpyData(curPlayer):
|
| | | ## 获取随机刷新的淘金物品IpyData
|
| | | funcLimitDict = IpyGameDataPY.GetFuncEvalCfg("GoldRushRefresh", 5, {})
|
| | | weightList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGoldRushItemCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushItemByIndex(index)
|
| | | #goldID = ipyData.GetGoldID()
|
| | | itemID = ipyData.GetItemID()
|
| | | weight = ipyData.GetRefreshWeight()
|
| | | if not weight:
|
| | | continue
|
| | | if str(itemID) in funcLimitDict:
|
| | | funcID = funcLimitDict[str(itemID)]
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, funcID):
|
| | | continue
|
| | | weightList.append([weight, ipyData])
|
| | | return GameWorld.GetResultByWeightList(weightList)
|
| | |
|
| | | def __onGoldRushRefresh(curPlayer, campID):
|
| | | ## 刷新
|
| | | refreshCnt, goldID, workerCnt = GetCampInfo(curPlayer, campID)
|
| | | if not goldID:
|
| | | __onGoldRushAccept(curPlayer, campID)
|
| | | return
|
| | | if workerCnt:
|
| | | GameWorld.DebugLog("淘金中,不能刷新! campID=%s,workerCnt=%s" % (campID, workerCnt))
|
| | | return
|
| | | moneyType = IpyGameDataPY.GetFuncCfg("GoldRushRefresh", 2)
|
| | | needMoneyList = IpyGameDataPY.GetFuncEvalCfg("GoldRushRefresh", 3)
|
| | | if not moneyType or not needMoneyList:
|
| | | return
|
| | | needMoney = needMoneyList[refreshCnt] if len(needMoneyList) > refreshCnt else needMoneyList[-1]
|
| | | ipyData = GetRefreshGoldItemIpyData(curPlayer)
|
| | | if not ipyData:
|
| | | return
|
| | | goldID = ipyData.GetGoldID()
|
| | | if needMoney and not PlayerControl.PayMoney(curPlayer, moneyType, needMoney):
|
| | | return
|
| | | refreshCnt += 1
|
| | | campInfo = SetCampInfo(curPlayer, campID, refreshCnt, goldID, workerCnt)
|
| | | GameWorld.DebugLog("淘金营地手动刷新: campID=%s,goldID=%s,refreshCnt=%s,campInfo=%s,needMoney=%s" % (campID, goldID, refreshCnt, campInfo, needMoney))
|
| | | return
|
| | |
|
| | | def __onGoldRushStart(curPlayer, campID, setWorkerCnt):
|
| | | ## 开始/修改
|
| | | refreshCnt, goldID, workerCnt = GetCampInfo(curPlayer, campID)
|
| | | if not goldID:
|
| | | GameWorld.DebugLog("营地为空,无法开始或修改! campID=%s" % (campID))
|
| | | return
|
| | | |
| | | if workerCnt == setWorkerCnt:
|
| | | GameWorld.DebugLog("营地工人相同,无需修改! campID=%s" % (campID))
|
| | | return
|
| | | |
| | | goldIpyData = IpyGameDataPY.GetIpyGameData("GoldRushItem", goldID)
|
| | | if not goldIpyData:
|
| | | return
|
| | | |
| | | # 进行中的
|
| | | panningCnt = 0
|
| | | atWorkCnt = 0 # 工作中的工人,不含本营地
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGoldRushCampCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushCampByIndex(index)
|
| | | cID = ipyData.GetCampID()
|
| | | _, gID, wCnt = GetCampInfo(curPlayer, cID)
|
| | | if gID and wCnt:
|
| | | panningCnt += 1
|
| | | if campID != cID:
|
| | | atWorkCnt += wCnt
|
| | | |
| | | workersTotal = 0 # 总工人数
|
| | | workerState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWorkerState)
|
| | | for index in range(ipyDataMgr.GetGoldRushWorkerCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushWorkerByIndex(index)
|
| | | workerID = ipyData.GetWorkerID()
|
| | | if workerState & pow(2, workerID):
|
| | | workersTotal += 1
|
| | | idleWorkers = workersTotal - atWorkCnt # 空闲工人数
|
| | | if idleWorkers <= 0:
|
| | | GameWorld.DebugLog("没有空闲工人,无法开始淘金! atWorkCnt=%s >= %s" % (atWorkCnt, workersTotal))
|
| | | return
|
| | | workerMax = goldIpyData.GetWorkerMax()
|
| | | updWorkerCnt = min(idleWorkers, setWorkerCnt, workerMax)
|
| | | if updWorkerCnt <= 0:
|
| | | GameWorld.DebugLog("工人不足! setWorkerCnt=%s,idleWorkers=%s" % (setWorkerCnt, idleWorkers))
|
| | | return
|
| | | |
| | | GameWorld.DebugLog("开始/修改淘金: campID=%s,goldID=%s,setWorkerCnt=%s,workerMax=%s,idleWorkers=%s,updWorkerCnt=%s" |
| | | % (campID, goldID, setWorkerCnt, workerMax, idleWorkers, updWorkerCnt))
|
| | | |
| | | curTime = int(time.time())
|
| | | # 未开始的
|
| | | if not workerCnt:
|
| | | warehouseSpaceList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1) # 淘金仓库上限|自动淘金开启增加上限
|
| | | canUseSpaceMax = sum(warehouseSpaceList) if GoldRushAutoCanUse(curPlayer) else warehouseSpaceList[0]
|
| | | |
| | | # 未领取的
|
| | | unGetCnt = 0
|
| | | for index in range(sum(warehouseSpaceList)):
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index):
|
| | | unGetCnt += 1
|
| | | |
| | | if (unGetCnt + panningCnt) >= canUseSpaceMax:
|
| | | GameWorld.DebugLog("淘金仓库没有多余空间,无法淘金! (未领取(%s) + 淘金中(%s)) >= canUseSpaceMax(%s)" % (unGetCnt, panningCnt, canUseSpaceMax))
|
| | | return
|
| | | |
| | | needSeconds = goldIpyData.GetNeedSeconds() # 单个工人所需时间
|
| | | GameWorld.DebugLog(" 未开始的! 单工人耗时=%s" % (needSeconds))
|
| | | |
| | | # 中途修改的
|
| | | else:
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampEndTime % campID)
|
| | | reaminSeconds = max(0, endTime - curTime) # 剩余时间
|
| | | needSeconds = reaminSeconds * workerCnt # 单个工人耗时 = 剩余时间 * 原先的工人数
|
| | | GameWorld.DebugLog(" 修改工人数! 原剩余秒=%s,剩余单工人耗时=%s" % (reaminSeconds, needSeconds))
|
| | | |
| | | realNeedSeconds = int(math.ceil(needSeconds / float(updWorkerCnt)))
|
| | | endTime = curTime + realNeedSeconds
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, endTime)
|
| | | campInfo = SetCampInfo(curPlayer, campID, refreshCnt, goldID, updWorkerCnt)
|
| | | GameWorld.DebugLog(" updWorkerCnt=%s,realNeedSeconds=%s,endTime=%s,campInfo=%s" |
| | | % (updWorkerCnt, realNeedSeconds, GameWorld.ChangeTimeNumToStr(endTime), campInfo))
|
| | | return
|
| | |
|
| | | def __onGoldRushCancel(curPlayer, campID):
|
| | | ## 取消
|
| | | refreshCnt, goldID, workerCnt = GetCampInfo(curPlayer, campID)
|
| | | if not workerCnt:
|
| | | GameWorld.DebugLog("非淘金中,不需要取消! campID=%s" % (campID))
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, 0)
|
| | | campInfo = SetCampInfo(curPlayer, campID, refreshCnt, goldID, 0)
|
| | | GameWorld.DebugLog("取消淘金: campID=%s,goldID=%s,workerCnt=%s,campInfo=%s" % (campID, goldID, workerCnt, campInfo))
|
| | | return
|
| | |
|
| | | #// B0 37 淘金解锁 #tagCSGoldRushUnlock
|
| | | #
|
| | | #struct tagCSGoldRushUnlock
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE UnlockType; // 0-营地;1-监工
|
| | | # BYTE UnlockID; // 解锁类型对应的ID
|
| | | #};
|
| | | def OnGoldRushUnlock(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | UnlockType = clientData.UnlockType
|
| | | UnlockID = clientData.UnlockID
|
| | | if UnlockType == 1:
|
| | | __onUnlockWorker(curPlayer, UnlockID)
|
| | | else:
|
| | | __onUnlockCamp(curPlayer, UnlockID)
|
| | | return
|
| | |
|
| | | def __onUnlockCamp(curPlayer, campID):
|
| | | campState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampState)
|
| | | if campState & pow(2, campID):
|
| | | GameWorld.DebugLog("该营地已解锁! campID=%s,campState=%s" % (campID, campState))
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("GoldRushCamp", campID)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | needCnt = ipyData.GetPanningUnlock()
|
| | | panningCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCnt)
|
| | | if needCnt and panningCnt < needCnt:
|
| | | GameWorld.DebugLog("所需淘金次数不足,无法解锁营地! campID=%s,panningCnt=%s < %s" % (campID, panningCnt, needCnt))
|
| | | return
|
| | | |
| | | moneyUnlock = ipyData.GetMoneyUnlock()
|
| | | moneyType, costMoney = moneyUnlock if (moneyUnlock and len(moneyUnlock) == 2) else (0, 0)
|
| | | if moneyType and costMoney and not PlayerControl.PayMoney(curPlayer, moneyType, costMoney, "GoldRushUnlockCamp"):
|
| | | return
|
| | | |
| | | campState |= pow(2, campID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampState, campState)
|
| | | GameWorld.DebugLog("解锁淘金营地: campID=%s,campState=%s" % (campID, campState))
|
| | | SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def __onUnlockWorker(curPlayer, workerID):
|
| | | workerState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWorkerState)
|
| | | if workerState & pow(2, workerID):
|
| | | GameWorld.DebugLog("该监工已解锁! workerID=%s,workerState=%s" % (workerID, workerState))
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("GoldRushWorker", workerID)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | curLV = curPlayer.GetLV()
|
| | | needLV = ipyData.GetPlayerLVUnlock()
|
| | | if needLV and curLV < needLV:
|
| | | GameWorld.DebugLog("所需等级次数不足,无法解锁监工! workerID=%s,curLV=%s < %s" % (workerID, curLV, needLV))
|
| | | return
|
| | | |
| | | moneyUnlock = ipyData.GetMoneyUnlock()
|
| | | moneyType, costMoney = moneyUnlock if (moneyUnlock and len(moneyUnlock) == 2) else (0, 0)
|
| | | if moneyType and costMoney and not PlayerControl.PayMoney(curPlayer, moneyType, costMoney, "GoldRushUnlockWorker"):
|
| | | return
|
| | | |
| | | workerState |= pow(2, workerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWorkerState, workerState)
|
| | | GameWorld.DebugLog("解锁淘金监工: workerID=%s,workerState=%s" % (workerID, workerState))
|
| | | SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | |
|
| | | #// B0 38 淘金仓库领奖 #tagCSGoldRushWarehouseAward
|
| | | #
|
| | | #struct tagCSGoldRushWarehouseAward
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE AwardIndex; // 领奖位置索引,从0开始
|
| | | # BYTE IsAll; // 是否领取所有
|
| | | #};
|
| | | def OnGoldRushWarehouseAward(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | index = clientData.AwardIndex
|
| | | isAll = clientData.IsAll
|
| | | GameWorld.DebugLog("淘金仓库领奖: index=%s,isAll=%s" % (index, isAll))
|
| | | |
| | | getList = []
|
| | | if isAll:
|
| | | spaceList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1)
|
| | | maxSpace = sum(spaceList) if GoldRushAutoCanUse(curPlayer) else spaceList[0]
|
| | | for index in range(maxSpace):
|
| | | goldID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index)
|
| | | if not goldID:
|
| | | continue
|
| | | getList.append([index, goldID])
|
| | | else:
|
| | | goldID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index)
|
| | | if not goldID:
|
| | | GameWorld.DebugLog("该位置没有已完整的淘金奖励! index=%s" % index)
|
| | | return
|
| | | getList.append([index, goldID])
|
| | | |
| | | if not getList:
|
| | | return
|
| | | |
| | | giveItemDict = {}
|
| | | for index, goldID in getList:
|
| | | goldIpyData = IpyGameDataPY.GetIpyGameData("GoldRushItem", goldID)
|
| | | if not goldIpyData:
|
| | | continue
|
| | | itemID = goldIpyData.GetItemID()
|
| | | itemCount = goldIpyData.GetItemCount()
|
| | | giveItemDict[itemID] = giveItemDict.get(itemID, 0) + itemCount
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWarehouse % index, 0)
|
| | | GameWorld.DebugLog(" index=%s,goldID=%s,itemID=%s,itemCount=%s" % (index, goldID, itemID, itemCount))
|
| | | |
| | | itemList = [[itemID, itemCount] for itemID, itemCount in giveItemDict.items()] |
| | | GameWorld.DebugLog(" giveItemDict=%s,itemList=%s" % (giveItemDict, itemList))
|
| | | |
| | | SyncGoldRushInfo(curPlayer)
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["GoldRush", False, {}])
|
| | | return
|
| | |
|
| | | def CheckGoldRushCamp(curPlayer):
|
| | | ## 检查营地淘金
|
| | | curTime = int(time.time())
|
| | | endCampList = []
|
| | | emptyCampList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGoldRushCampCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushCampByIndex(index)
|
| | | campID = ipyData.GetCampID()
|
| | | _, goldID, _ = GetCampInfo(curPlayer, campID)
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampEndTime % campID)
|
| | | if not goldID:
|
| | | emptyCampList.append([campID, endTime])
|
| | | continue
|
| | | if not endTime:
|
| | | continue
|
| | | if curTime < endTime:
|
| | | continue
|
| | | endCampList.append([campID, goldID])
|
| | | |
| | | if endCampList:
|
| | | __doEndCamp(curPlayer, endCampList, curTime)
|
| | | |
| | | if emptyCampList:
|
| | | __doSysRefreshCampGold(curPlayer, emptyCampList, curTime)
|
| | | |
| | | return
|
| | |
|
| | | def __doEndCamp(curPlayer, endCampList, curTime):
|
| | | syncCampIDList = []
|
| | | spaceList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1)
|
| | | maxSpace = sum(spaceList) if GoldRushAutoCanUse(curPlayer) else spaceList[0]
|
| | | for index in range(maxSpace):
|
| | | if not endCampList:
|
| | | break
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index):
|
| | | continue
|
| | | campID, goldID = endCampList.pop(0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWarehouse % index, goldID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, curTime) # 再次更新endTime
|
| | | panningCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCnt) + 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCnt, panningCnt)
|
| | | SetCampInfo(curPlayer, campID, 0, 0, 0, False)
|
| | | syncCampIDList.append(campID)
|
| | | GameWorld.DebugLog("淘金结束: campID=%s,goldID=%s,放入淘金仓库index=%s,panningCnt=%s" % (campID, goldID, index, panningCnt))
|
| | | |
| | | if not syncCampIDList:
|
| | | return
|
| | | |
| | | SyncGoldCampInfo(curPlayer, syncCampIDList)
|
| | | SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def __doSysRefreshCampGold(curPlayer, emptyCampList, curTime):
|
| | | ## 系统自动刷新营地金矿
|
| | | sysRefreshCD = IpyGameDataPY.GetFuncCfg("GoldRushRefresh", 4) * 60
|
| | | if not sysRefreshCD:
|
| | | return
|
| | | |
| | | syncCampIDList = []
|
| | | refreshCnt, workerCnt = 0, 0
|
| | | for campID, endTime in emptyCampList:
|
| | | if endTime and (curTime - endTime) < sysRefreshCD:
|
| | | #GameWorld.DebugLog("系统自动刷新淘金营地金矿CD未到: campID=%s,endTime=%s,sysRefreshCD=%s > %s" % (campID, endTime, sysRefreshCD, curTime - endTime))
|
| | | continue
|
| | | |
| | | ipyData = GetRefreshGoldItemIpyData(curPlayer)
|
| | | if not ipyData:
|
| | | continue
|
| | | |
| | | goldID = ipyData.GetGoldID()
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, 0)
|
| | | campInfo = SetCampInfo(curPlayer, campID, refreshCnt, goldID, workerCnt, False)
|
| | | GameWorld.DebugLog("系统自动刷新淘金营地金矿: campID=%s,goldID=%s,campInfo=%s" % (campID, goldID, campInfo))
|
| | | syncCampIDList.append(campID)
|
| | | |
| | | if syncCampIDList:
|
| | | SyncGoldCampInfo(curPlayer, syncCampIDList)
|
| | | |
| | | return
|
| | |
|
| | | #// B0 39 自动淘金免费使用 #tagCSGoldRushAutoFreeUse
|
| | | #
|
| | | #struct tagCSGoldRushAutoFreeUse
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnGoldRushAutoFreeUse(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | OnActGoldRushAuto(curPlayer, 0)
|
| | | return
|
| | |
|
| | | def OnGoldRushByCTGID(curPlayer, ctgID):
|
| | | keeperCTGIDList = IpyGameDataPY.GetFuncEvalCfg("GoldRushAuto", 2)
|
| | | for keeperIndex, ctgIDList in enumerate(keeperCTGIDList, 1):
|
| | | if ctgID in ctgIDList:
|
| | | OnActGoldRushAuto(curPlayer, keeperIndex)
|
| | | break
|
| | | return
|
| | |
|
| | | def OnActGoldRushAuto(curPlayer, keeperIndex):
|
| | | ## 激活/增加自动管家时长
|
| | | # @param keeperIndex: 管家档位索引,0-免费,>0-付费档
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushAutoEndTime)
|
| | | if keeperIndex == 0:
|
| | | if endTime:
|
| | | GameWorld.DebugLog("淘金免费管家已领取过!", playerID)
|
| | | return
|
| | | |
| | | keeperDaysList = IpyGameDataPY.GetFuncEvalCfg("GoldRushAuto", 1)
|
| | | if keeperIndex < 0 or keeperIndex >= len(keeperDaysList):
|
| | | return
|
| | | addDays = keeperDaysList[keeperIndex]
|
| | | addSeconds = addDays * 24 * 3600
|
| | | curTime = int(time.time())
|
| | | |
| | | endTimeStr = GameWorld.ChangeTimeNumToStr(endTime) if endTime else ""
|
| | | GameWorld.DebugLog("激活淘金管家: keeperIndex=%s,addDays=%s(%s)" % (keeperIndex, addDays, addSeconds), playerID)
|
| | | GameWorld.DebugLog(" 管家到期时间: endTime=%s, %s" % (endTime, endTimeStr), playerID)
|
| | | if not endTime:
|
| | | updEndTime = curTime + addSeconds
|
| | | GameWorld.DebugLog(" 激活管家", playerID)
|
| | | elif curTime >= endTime:
|
| | | updEndTime = curTime + addSeconds |
| | | GameWorld.DebugLog(" 已过期,重新激活管家", playerID)
|
| | | else:
|
| | | updEndTime = endTime + addSeconds
|
| | | GameWorld.DebugLog(" 续费管家时长", playerID)
|
| | | |
| | | GameWorld.DebugLog(" 更新管家到期时间: updEndTime=%s, %s" % (updEndTime, GameWorld.ChangeTimeNumToStr(updEndTime)), playerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, updEndTime)
|
| | | SyncGoldRushInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def SyncGoldRushInfo(curPlayer):
|
| | | clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCGoldRushInfo)
|
| | | clientPack.CampState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampState)
|
| | | clientPack.WorkerState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWorkerState)
|
| | | clientPack.PanningCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCnt)
|
| | | clientPack.LastRecoverTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushRecoverTime)
|
| | | clientPack.HousekeeperEndTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushAutoEndTime)
|
| | | clientPack.WarehouseIDList = []
|
| | | for index in range(sum(IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1))):
|
| | | goldID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index)
|
| | | clientPack.WarehouseIDList.append(goldID)
|
| | | clientPack.WarehouseCnt = len(clientPack.WarehouseIDList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def SyncGoldCampInfo(curPlayer, syncCampIDList=None):
|
| | | poolMgr = ObjPool.GetPoolMgr()
|
| | | campList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGoldRushCampCount()):
|
| | | ipyData = ipyDataMgr.GetGoldRushCampByIndex(index)
|
| | | campID = ipyData.GetCampID()
|
| | | if syncCampIDList and campID not in syncCampIDList:
|
| | | continue
|
| | | refreshCnt, goldID, workerCnt = GetCampInfo(curPlayer, campID)
|
| | | camp = poolMgr.acquire(ChPyNetSendPack.tagSCGoldRushCamp)
|
| | | camp.CampID = campID
|
| | | camp.GoldID = goldID
|
| | | camp.RefreshCnt = refreshCnt
|
| | | camp.WorkerCnt = workerCnt
|
| | | camp.EndTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampEndTime % campID)
|
| | | campList.append(camp)
|
| | | if not campList:
|
| | | return
|
| | | clientPack = poolMgr.acquire(ChPyNetSendPack.tagSCGoldRushCampInfo)
|
| | | clientPack.CampList = campList
|
| | | clientPack.CampCnt = len(clientPack.CampList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
| | | import PlayerFace
|
| | | import PlayerBackup
|
| | | import PlayerOnline
|
| | | import PlayerGoldRush
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #放在刷buff前
|
| | | #ProcessPassiveSkill(curPlayer, tick)
|
| | |
|
| | | ProcessPlayerSecond(curPlayer, tick)
|
| | | ProcessPlayerMinute(curPlayer, tick)
|
| | |
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).DoRefreshRoleAttr()
|
| | |
| | |
|
| | | #恶意攻击时间处理
|
| | | #AttackCommon.ProcessMaliciousAttackPlayer(curPlayer, tick)
|
| | | #成就
|
| | | PlayerSuccess.FinishDelayAddSuccessProgress(curPlayer, tick, False)
|
| | | #限时抢购
|
| | | PlayerFlashSale.ProcessFlashSaleMail(curPlayer, tick)
|
| | | #地图经验
|
| | | #ProcessAreaExp(curPlayer, tick)
|
| | | #神秘商店刷新
|
| | | FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)
|
| | |
|
| | | #活跃放置
|
| | | #PlayerActivity.ProcessActivityPlace(curPlayer)
|
| | | #自定义场景
|
| | |
| | | #CrossPlayerData.ProcessCrossPlayer(curPlayer, tick)
|
| | | return
|
| | |
|
| | | def ProcessPlayerSecond(curPlayer, tick):
|
| | | #玩家每秒处理,玩家Process可能每秒多次,所以增加一个每秒处理的,减少执行次数
|
| | | lastTick = curPlayer.GetDictByKey("ProcessPlayerSecond")
|
| | | if tick - lastTick < 1000:
|
| | | return
|
| | | curPlayer.SetDict("ProcessPlayerSecond", tick)
|
| | | |
| | | #成就
|
| | | PlayerSuccess.FinishDelayAddSuccessProgress(curPlayer, tick, False)
|
| | | #限时抢购
|
| | | PlayerFlashSale.ProcessFlashSaleMail(curPlayer, tick)
|
| | | #神秘商店刷新
|
| | | FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)
|
| | | #淘金
|
| | | PlayerGoldRush.OnProcess(curPlayer)
|
| | | return
|
| | |
|
| | | def ProcessPlayerMinute(curPlayer, tick):
|
| | | #玩家每分钟处理
|
| | | lastTick = curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_Minute)
|
| | |
| | | UCN_DBPyFuncTeam="tagDBPyFuncTeam"
|
| | | UCN_DBPyFuncTeamMem="tagDBPyFuncTeamMem"
|
| | | UCN_DBPlayerRecData="tagDBPlayerRecData"
|
| | | UCN_DBPyMineAreaAward="tagDBPyMineAreaAward"
|
| | | UCN_DBPyMineAreaRecord="tagDBPyMineAreaRecord"
|
| | | UCN_DBPyMineAreaItem="tagDBPyMineAreaItem"
|
| | | UCN_DBPyCouple="tagDBPyCouple"
|
| | | UCN_DBPyUnNotifyLoveGiftRec="tagDBPyUnNotifyLoveGiftRec"
|
| | | UCN_DBPyCharmValueRec="tagDBPyCharmValueRec"
|
| | |
| | | )
|
| | | return output
|
| | |
|
| | | |
| | | # 福地矿物表 #tagDBPyMineAreaItem
|
| | | class tagDBPyMineAreaItem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('Index', ctypes.c_ubyte),
|
| | | ('MineID', ctypes.c_ushort),
|
| | | ('MineType', ctypes.c_ubyte),
|
| | | ('UpdTime', ctypes.c_ulong),
|
| | | ('PosLen', ctypes.c_ubyte),
|
| | | ('Position', ctypes.c_char_p),
|
| | | ('WorkerCount', ctypes.c_ubyte),
|
| | | ('WorkerState', ctypes.c_ubyte),
|
| | | ('RobPlayerID', ctypes.c_ulong),
|
| | | ('RobWorkerCount', ctypes.c_ubyte),
|
| | | ('RobWorkerState', ctypes.c_ubyte),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.PlayerID = 0
|
| | | self.Index = 0
|
| | | self.MineID = 0
|
| | | self.MineType = 0
|
| | | self.UpdTime = 0
|
| | | self.PosLen = 0
|
| | | self.Position = ''
|
| | | self.WorkerCount = 0
|
| | | self.WorkerState = 0
|
| | | self.RobPlayerID = 0
|
| | | self.RobWorkerCount = 0
|
| | | self.RobWorkerState = 0
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Index, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.MineID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.MineType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.UpdTime, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.PosLen, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.PosLen)
|
| | | self.Position = ctypes.c_char_p(tmp)
|
| | | self.WorkerCount, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.WorkerState, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.RobPlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.RobWorkerCount, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.RobWorkerState, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.Index)
|
| | | buf = CommFunc.WriteWORD(buf, self.MineID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.MineType)
|
| | | buf = CommFunc.WriteDWORD(buf, self.UpdTime)
|
| | | buf = CommFunc.WriteBYTE(buf, self.PosLen)
|
| | | buf = CommFunc.WriteString(buf, self.PosLen, self.Position)
|
| | | buf = CommFunc.WriteBYTE(buf, self.WorkerCount)
|
| | | buf = CommFunc.WriteBYTE(buf, self.WorkerState)
|
| | | buf = CommFunc.WriteDWORD(buf, self.RobPlayerID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.RobWorkerCount)
|
| | | buf = CommFunc.WriteBYTE(buf, self.RobWorkerState)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.PosLen
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''组织存储记录'''
|
| | | rec = {}
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'Index'] = self.Index
|
| | | rec[u'MineID'] = self.MineID
|
| | | rec[u'MineType'] = self.MineType
|
| | | rec[u'UpdTime'] = self.UpdTime
|
| | | rec[u'PosLen'] = self.PosLen
|
| | | rec[u'Position'] = fix_incomingText(self.Position)
|
| | | rec[u'WorkerCount'] = self.WorkerCount
|
| | | rec[u'WorkerState'] = self.WorkerState
|
| | | rec[u'RobPlayerID'] = self.RobPlayerID
|
| | | rec[u'RobWorkerCount'] = self.RobWorkerCount
|
| | | rec[u'RobWorkerState'] = self.RobWorkerState
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''由于MongoDB读出来是unicode,所有字符串需要进行转换'''
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.Index = rec.get(u'Index', 0)
|
| | | self.MineID = rec.get(u'MineID', 0)
|
| | | self.MineType = rec.get(u'MineType', 0)
|
| | | self.UpdTime = rec.get(u'UpdTime', 0)
|
| | | self.PosLen = rec.get(u'PosLen', 0)
|
| | | self.Position = fix_outgoingText(rec.get(u'Position', u''))
|
| | | self.WorkerCount = rec.get(u'WorkerCount', 0)
|
| | | self.WorkerState = rec.get(u'WorkerState', 0)
|
| | | self.RobPlayerID = rec.get(u'RobPlayerID', 0)
|
| | | self.RobWorkerCount = rec.get(u'RobWorkerCount', 0)
|
| | | self.RobWorkerState = rec.get(u'RobWorkerState', 0)
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''查询结果打包成二进制流'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''自定义查询'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''查询所有''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// 福地矿物表 #tagDBPyMineAreaItem:
|
| | | PlayerID = %s,
|
| | | Index = %s,
|
| | | MineID = %s,
|
| | | MineType = %s,
|
| | | UpdTime = %s,
|
| | | PosLen = %s,
|
| | | Position = %s,
|
| | | WorkerCount = %s,
|
| | | WorkerState = %s,
|
| | | RobPlayerID = %s,
|
| | | RobWorkerCount = %s,
|
| | | RobWorkerState = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.PlayerID,
|
| | | self.Index,
|
| | | self.MineID,
|
| | | self.MineType,
|
| | | self.UpdTime,
|
| | | self.PosLen,
|
| | | self.Position,
|
| | | self.WorkerCount,
|
| | | self.WorkerState,
|
| | | self.RobPlayerID,
|
| | | self.RobWorkerCount,
|
| | | self.RobWorkerState,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.PlayerID,
|
| | | self.Index,
|
| | | self.MineID,
|
| | | self.MineType,
|
| | | self.UpdTime,
|
| | | self.PosLen,
|
| | | self.Position,
|
| | | self.WorkerCount,
|
| | | self.WorkerState,
|
| | | self.RobPlayerID,
|
| | | self.RobWorkerCount,
|
| | | self.RobWorkerState,
|
| | | )
|
| | | return output
|
| | |
|
| | |
|
| | | # 福地记录表 #tagDBPyMineAreaRecord
|
| | | class tagDBPyMineAreaRecord(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('RecordType', ctypes.c_ulong),
|
| | | ('TagPlayerID', ctypes.c_ulong),
|
| | | ('RecordTime', ctypes.c_ulong),
|
| | | ('MineID', ctypes.c_ushort),
|
| | | ('DataLen', ctypes.c_ushort),
|
| | | ('Data', ctypes.c_char_p),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.PlayerID = 0
|
| | | self.RecordType = 0
|
| | | self.TagPlayerID = 0
|
| | | self.RecordTime = 0
|
| | | self.MineID = 0
|
| | | self.DataLen = 0
|
| | | self.Data = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.RecordType, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.TagPlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.RecordTime, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.MineID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.DataLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.DataLen)
|
| | | self.Data = ctypes.c_char_p(tmp)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.RecordType)
|
| | | buf = CommFunc.WriteDWORD(buf, self.TagPlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.RecordTime)
|
| | | buf = CommFunc.WriteWORD(buf, self.MineID)
|
| | | buf = CommFunc.WriteWORD(buf, self.DataLen)
|
| | | buf = CommFunc.WriteString(buf, self.DataLen, self.Data)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.DataLen
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''组织存储记录'''
|
| | | rec = {}
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'RecordType'] = self.RecordType
|
| | | rec[u'TagPlayerID'] = self.TagPlayerID
|
| | | rec[u'RecordTime'] = self.RecordTime
|
| | | rec[u'MineID'] = self.MineID
|
| | | rec[u'DataLen'] = self.DataLen
|
| | | rec[u'Data'] = fix_incomingText(self.Data)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''由于MongoDB读出来是unicode,所有字符串需要进行转换'''
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.RecordType = rec.get(u'RecordType', 0)
|
| | | self.TagPlayerID = rec.get(u'TagPlayerID', 0)
|
| | | self.RecordTime = rec.get(u'RecordTime', 0)
|
| | | self.MineID = rec.get(u'MineID', 0)
|
| | | self.DataLen = rec.get(u'DataLen', 0)
|
| | | self.Data = fix_outgoingText(rec.get(u'Data', u''))
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''查询结果打包成二进制流'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''自定义查询'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''查询所有''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// 福地记录表 #tagDBPyMineAreaRecord:
|
| | | PlayerID = %s,
|
| | | RecordType = %s,
|
| | | TagPlayerID = %s,
|
| | | RecordTime = %s,
|
| | | MineID = %s,
|
| | | DataLen = %s,
|
| | | Data = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.PlayerID,
|
| | | self.RecordType,
|
| | | self.TagPlayerID,
|
| | | self.RecordTime,
|
| | | self.MineID,
|
| | | self.DataLen,
|
| | | self.Data,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.PlayerID,
|
| | | self.RecordType,
|
| | | self.TagPlayerID,
|
| | | self.RecordTime,
|
| | | self.MineID,
|
| | | self.DataLen,
|
| | | self.Data,
|
| | | )
|
| | | return output
|
| | |
|
| | |
|
| | | # 福地结算奖励表 #tagDBPyMineAreaAward
|
| | | class tagDBPyMineAreaAward(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('GUIDLen', ctypes.c_ubyte),
|
| | | ('GUID', ctypes.c_char_p),
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('AwardTime', ctypes.c_ulong),
|
| | | ('MineID', ctypes.c_ushort),
|
| | | ('WorkerCount', ctypes.c_ubyte),
|
| | | ('AreaPlayerID', ctypes.c_ulong),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.GUIDLen = 0
|
| | | self.GUID = ''
|
| | | self.PlayerID = 0
|
| | | self.AwardTime = 0
|
| | | self.MineID = 0
|
| | | self.WorkerCount = 0
|
| | | self.AreaPlayerID = 0
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.GUIDLen, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.GUIDLen)
|
| | | self.GUID = ctypes.c_char_p(tmp)
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.AwardTime, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.MineID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.WorkerCount, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.AreaPlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteBYTE(buf, self.GUIDLen)
|
| | | buf = CommFunc.WriteString(buf, self.GUIDLen, self.GUID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.AwardTime)
|
| | | buf = CommFunc.WriteWORD(buf, self.MineID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.WorkerCount)
|
| | | buf = CommFunc.WriteDWORD(buf, self.AreaPlayerID)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.GUIDLen
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''组织存储记录'''
|
| | | rec = {}
|
| | | rec[u'GUIDLen'] = self.GUIDLen
|
| | | rec[u'GUID'] = fix_incomingText(self.GUID)
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'AwardTime'] = self.AwardTime
|
| | | rec[u'MineID'] = self.MineID
|
| | | rec[u'WorkerCount'] = self.WorkerCount
|
| | | rec[u'AreaPlayerID'] = self.AreaPlayerID
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''由于MongoDB读出来是unicode,所有字符串需要进行转换'''
|
| | | self.GUIDLen = rec.get(u'GUIDLen', 0)
|
| | | self.GUID = fix_outgoingText(rec.get(u'GUID', u''))
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.AwardTime = rec.get(u'AwardTime', 0)
|
| | | self.MineID = rec.get(u'MineID', 0)
|
| | | self.WorkerCount = rec.get(u'WorkerCount', 0)
|
| | | self.AreaPlayerID = rec.get(u'AreaPlayerID', 0)
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''查询结果打包成二进制流'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''自定义查询'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''查询所有''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// 福地结算奖励表 #tagDBPyMineAreaAward:
|
| | | GUIDLen = %s,
|
| | | GUID = %s,
|
| | | PlayerID = %s,
|
| | | AwardTime = %s,
|
| | | MineID = %s,
|
| | | WorkerCount = %s,
|
| | | AreaPlayerID = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.GUIDLen,
|
| | | self.GUID,
|
| | | self.PlayerID,
|
| | | self.AwardTime,
|
| | | self.MineID,
|
| | | self.WorkerCount,
|
| | | self.AreaPlayerID,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.GUIDLen,
|
| | | self.GUID,
|
| | | self.PlayerID,
|
| | | self.AwardTime,
|
| | | self.MineID,
|
| | | self.WorkerCount,
|
| | | self.AreaPlayerID,
|
| | | )
|
| | | return output
|
| | |
|
| | |
|
| | | # 玩家记录表 #tagDBPlayerRecData
|
| | | class tagDBPlayerRecData(Structure):
|
| | |
| | | data += DBPlayerRecData.adoQueryAll(collection)
|
| | | mylog.debug("tagDBPlayerRecData ok")
|
| | |
|
| | | collection = db[UCN_DBPyMineAreaAward]
|
| | | DBPyMineAreaAward = DataServerPlayerData.tagDBPyMineAreaAward()
|
| | | data += DBPyMineAreaAward.adoQueryAll(collection)
|
| | | mylog.debug("tagDBPyMineAreaAward ok")
|
| | | |
| | | collection = db[UCN_DBPyMineAreaRecord]
|
| | | DBPyMineAreaRecord = DataServerPlayerData.tagDBPyMineAreaRecord()
|
| | | data += DBPyMineAreaRecord.adoQueryAll(collection)
|
| | | mylog.debug("tagDBPyMineAreaRecord ok")
|
| | | |
| | | collection = db[UCN_DBPyMineAreaItem]
|
| | | DBPyMineAreaItem = DataServerPlayerData.tagDBPyMineAreaItem()
|
| | | data += DBPyMineAreaItem.adoQueryAll(collection)
|
| | | mylog.debug("tagDBPyMineAreaItem ok")
|
| | | |
| | | collection = db[UCN_DBPyCouple]
|
| | | DBPyCouple = DataServerPlayerData.tagDBPyCouple()
|
| | | data += DBPyCouple.adoQueryAll(collection)
|
| | |
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyFuncTeam, DataServerPlayerData.tagDBPyFuncTeam, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyFuncTeamMem, DataServerPlayerData.tagDBPyFuncTeamMem, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPlayerRecData, DataServerPlayerData.tagDBPlayerRecData, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyMineAreaAward, DataServerPlayerData.tagDBPyMineAreaAward, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyMineAreaRecord, DataServerPlayerData.tagDBPyMineAreaRecord, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyMineAreaItem, DataServerPlayerData.tagDBPyMineAreaItem, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyCouple, DataServerPlayerData.tagDBPyCouple, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyUnNotifyLoveGiftRec, DataServerPlayerData.tagDBPyUnNotifyLoveGiftRec, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyCharmValueRec, DataServerPlayerData.tagDBPyCharmValueRec, db)
|
| | |
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyFuncTeam, DataServerPlayerData.tagDBPyFuncTeam, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyFuncTeamMem, DataServerPlayerData.tagDBPyFuncTeamMem, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPlayerRecData, DataServerPlayerData.tagDBPlayerRecData, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyMineAreaAward, DataServerPlayerData.tagDBPyMineAreaAward, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyMineAreaRecord, DataServerPlayerData.tagDBPyMineAreaRecord, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyMineAreaItem, DataServerPlayerData.tagDBPyMineAreaItem, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyCouple, DataServerPlayerData.tagDBPyCouple, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyUnNotifyLoveGiftRec, DataServerPlayerData.tagDBPyUnNotifyLoveGiftRec, db)
|
| | | gameDataReadPos = self.savegameServerWorldData(decompressGameData, gameDataReadPos, UCN_DBPyCharmValueRec, DataServerPlayerData.tagDBPyCharmValueRec, db)
|
| | |
| | | CDBPlayerRefresh_ShieldPerDef, # 弱化护盾 282
|
| | | CDBPlayerRefresh_DOTPer, # 持续增伤 283
|
| | | CDBPlayerRefresh_DOTPerDef, # 持续减伤 284
|
| | | ) = range(146, 285)
|
| | | CDBPlayerRefresh_GoldRushEnergy, # 淘金令 285
|
| | | ) = range(146, 286)
|
| | |
|
| | | TYPE_Price_Gold_Paper_Money = 5 # 金钱类型,(先用礼券,再用金子)
|
| | | TYPE_Price_Family_Contribution = 6 # 战盟贡献度(活跃度转换得来)
|
| | |
| | | TYPE_Price_SuccessSocre = 39 # 成就积分
|
| | | TYPE_Price_FamilyFlagWarPoint = 40 # 万界积分
|
| | | TYPE_Price_Xiantao = 41 # 仙桃/战锤
|
| | | TYPE_Price_Lingyu = 42 # 灵玉/结晶
|
| | | TYPE_Price_Lingyu = 42 # 灵玉/将星玉髓
|
| | | TYPE_Price_BossTrial = 43 # boss历练凭证积分
|
| | | TYPE_Price_GatherSoul = 44 # 聚魂精华
|
| | | TYPE_Price_HorsePetTrainScore = 45 # 骑宠养成积分
|
| | |
| | | TYPE_Price_XianyuanScore = 49 # 仙缘积分
|
| | | TYPE_Price_HuanjinggeScore = 50 # 幻境阁积分
|
| | | TYPE_Price_HeroScore = 51 # 招募积分
|
| | | TYPE_Price_GoldRushEnergy = 52 # 淘金令体力
|
| | | TYPE_Price_PayCoinDay = 98 # 代币时效,每日过天重置
|
| | | TYPE_Price_PayCoin = 99 # 代币
|
| | |
|
| | |
| | | 1:"仙玉", 2:"绑玉", 3:"铜钱", 6:"战盟贡献度", 10:"战盟仓库积分", 13:"境界修行点", 14:"符印融合石", 15:"仙盟活跃令",
|
| | | 16:"助战积分", 18:"荣誉", 19:"Boss积分", 23:"符印精华", 24:"符印碎片", 25:"寻宝积分", 26:"集市额度", 27:"丹精", 28:"魂尘",
|
| | | 29:"聚魂碎片", 30:"核心环", 31:"功能特权令", 32:"环保值", 33:"GM令", 34:"古神币", 35:"功德点",
|
| | | 39:"成就积分", 40:"万界积分", 41:"战锤", 42:"结晶", 43:"凭证积分", 44:"聚魂精华", 45:"骑宠养成积分", 46:"古宝养成积分", 47:"天道果", |
| | | 49:"仙缘积分", 50:"幻境阁积分", 51:"招募积分",
|
| | | 39:"成就积分", 40:"万界积分", 41:"战锤", 42:"将星玉髓", 43:"凭证积分", 44:"聚魂精华", 45:"骑宠养成积分", 46:"古宝养成积分", 47:"天道果", |
| | | 49:"仙缘积分", 50:"幻境阁积分", 51:"招募积分", 52:"淘金令",
|
| | | 98:"代币时效", 99:"代币"
|
| | | }
|
| | |
|
| | |
| | | TYPE_Price_XianyuanScore:CDBPlayerRefresh_XianyuanScore,
|
| | | TYPE_Price_HuanjinggeScore:CDBPlayerRefresh_HuanjinggeScore,
|
| | | TYPE_Price_HeroScore:CDBPlayerRefresh_HeroScore,
|
| | | TYPE_Price_GoldRushEnergy:CDBPlayerRefresh_GoldRushEnergy,
|
| | | TYPE_Price_PayCoinDay:CDBPlayerRefresh_PayCoinDay,
|
| | | }
|
| | |
|
| | |
| | | GameFuncID_LianTi = 207 # 炼体
|
| | | GameFuncID_CrossBattlefield = 208 # 跨服古神战场
|
| | | GameFuncID_Championship = 210 # 排位
|
| | | GameFuncID_MineArea = 227 # 福地
|
| | | GameFuncID_Guaji = 228 # 挂机
|
| | | # 以下为暂时无用的
|
| | | GameFuncID_RunDaily = 34 # 日常跑环
|
| | |
| | | Def_PlayerRecType_WorshipDaily, # 玩家每日膜拜记录 2
|
| | | Def_PlayerRecType_PayCoin, # 代币记录 3
|
| | | Def_PlayerRecType_OfflineUnprocessed, # 离线未处理的逻辑 4
|
| | | Def_PlayerRecType_MineAreaRecord, # 福地其他记录信息 5
|
| | | ) = range(1, 1 + 5)
|
| | | ) = range(1, 1 + 4)
|
| | |
|
| | | #通用信息记录类型 - 新 从 300 开始,原通用记录类型最大到255
|
| | | Def_GameRecTypeList = (
|