8359 【主干】活跃兑换(快速完成增加可指定次数)
8346 【恺英】【后端】协助系统(增加每日协助活跃令上限及社交加成记录)
| | |
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("FinishCount", c_ubyte), #完成次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x28
|
| | | self.FinishCount = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''// B0 28 活跃放置快速完成 //tagCMActivityPlaceQuickFinish:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | SubCmd:%s,
|
| | | FinishCount:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | self.SubCmd,
|
| | | self.FinishCount
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 07 今日协助活跃令信息 #tagMCTodayAssistMoneyInfo
|
| | |
|
| | | class tagMCTodayAssistMoneyInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("TodayAssistMoney", c_ushort), #今日已获得活跃令,不含社交加成
|
| | | ("SocialMoney", c_ushort), #社交额外加成
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x07
|
| | | 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 = 0x07
|
| | | self.TodayAssistMoney = 0
|
| | | self.SocialMoney = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCTodayAssistMoneyInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 07 今日协助活跃令信息 //tagMCTodayAssistMoneyInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | TodayAssistMoney:%d,
|
| | | SocialMoney:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.TodayAssistMoney,
|
| | | self.SocialMoney
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCTodayAssistMoneyInfo=tagMCTodayAssistMoneyInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTodayAssistMoneyInfo.Cmd,m_NAtagMCTodayAssistMoneyInfo.SubCmd))] = m_NAtagMCTodayAssistMoneyInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 02 玩家时装皮肤激活状态 #tagMCClothesCoatSkinState
|
| | |
|
| | | class tagMCClothesCoatLVInfo(Structure):
|
| | |
| | |
|
| | | #协助
|
| | | Def_PDict_GetThanksGiftCount = "GetThanksGiftCount_%s" # 协助方今日接收该感谢礼盒次数,参数(礼盒物品ID)
|
| | | Def_PDict_TodayAssistMoney = "TodayAssistMoney" # 今日已获得协助货币奖励
|
| | | Def_PDict_TodayAssistMoneySocial = "TodayAssistMoneySocial" # 今日已获得协助货币 社交关系额外加成
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | | #可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
|
| | |
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("FinishCount", c_ubyte), #完成次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x28
|
| | | self.FinishCount = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''// B0 28 活跃放置快速完成 //tagCMActivityPlaceQuickFinish:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | SubCmd:%s,
|
| | | FinishCount:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | self.SubCmd,
|
| | | self.FinishCount
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 07 今日协助活跃令信息 #tagMCTodayAssistMoneyInfo
|
| | |
|
| | | class tagMCTodayAssistMoneyInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("TodayAssistMoney", c_ushort), #今日已获得活跃令,不含社交加成
|
| | | ("SocialMoney", c_ushort), #社交额外加成
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x07
|
| | | 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 = 0x07
|
| | | self.TodayAssistMoney = 0
|
| | | self.SocialMoney = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCTodayAssistMoneyInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 07 今日协助活跃令信息 //tagMCTodayAssistMoneyInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | TodayAssistMoney:%d,
|
| | | SocialMoney:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.TodayAssistMoney,
|
| | | self.SocialMoney
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCTodayAssistMoneyInfo=tagMCTodayAssistMoneyInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTodayAssistMoneyInfo.Cmd,m_NAtagMCTodayAssistMoneyInfo.SubCmd))] = m_NAtagMCTodayAssistMoneyInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 02 玩家时装皮肤激活状态 #tagMCClothesCoatSkinState
|
| | |
|
| | | class tagMCClothesCoatLVInfo(Structure):
|
| | |
| | | self.__assistAwardItemID = liheItemID
|
| | |
|
| | | fbType = GameWorld.GetMap().GetMapFBTypeByMapID(mapID)
|
| | | friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3)
|
| | | GameWorld.DebugLog("执行协助奖励逻辑", self.npcID, self.lineID)
|
| | | copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for playerID, assistPlayerIDList in self.__noAssitPlayerIDDict.items():
|
| | |
| | | GameWorld.DebugLog("协助方离线或不在本地图,不给活跃令奖励: assistPlayerID=%s" % assistPlayerID, self.npcID, self.lineID)
|
| | | continue
|
| | | isFriend = assistHurtPlayer.GetIsFriend()
|
| | | addAssistMoney = assistMoney
|
| | | if isFriend and friendAddAssistMoneyPer:
|
| | | addAssistMoney += int(assistMoney * friendAddAssistMoneyPer / 100.0)
|
| | | assistMoneyType = ShareDefine.TYPE_Price_FamilyActivity
|
| | | addAssistMoney = PlayerAssist.AddTodayAssistMoney(assistPlayer, assistMoneyType, assistMoney, isFriend)
|
| | | GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s,assistMoney=%s,isFriend=%s,addAssistMoney=%s"
|
| | | % (assistPlayerID, assistMoney, isFriend, addAssistMoney), self.npcID, self.lineID)
|
| | | PlayerControl.GiveMoney(assistPlayer, ShareDefine.TYPE_Price_FamilyActivity, addAssistMoney) # 给活跃令无视发布方是否在线
|
| | | if fbType == IPY_GameWorld.fbtNull:
|
| | | PlayerControl.NotifyCode(assistPlayer, "AssistSuccess")
|
| | | else:
|
| | | overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({ShareDefine.TYPE_Price_FamilyActivity:addAssistMoney}),
|
| | | overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({assistMoneyType:addAssistMoney}),
|
| | | FBCommon.Over_itemInfo:[]}
|
| | | FBCommon.NotifyFBOver(assistPlayer, mapID, PlayerControl.GetFBFuncLineID(assistPlayer), 1, overDict)
|
| | |
|
| | |
| | | #struct tagCMActivityPlaceQuickFinish
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE FinishCount; //完成次数
|
| | | #};
|
| | | def OnActivityPlaceQuickFinish(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | finishCount = clientData.FinishCount
|
| | | remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
|
| | | if not remainCount:
|
| | | GameWorld.DebugLog("没有剩余活跃放置次数,无法快速完成!")
|
| | | return
|
| | | finishCount = min(finishCount, remainCount)
|
| | | if not finishCount:
|
| | | return
|
| | |
|
| | | costItemID, costGoldParper = IpyGameDataPY.GetFuncEvalCfg("ActivityPlace", 5)
|
| | | costItemCount = 1 # 默认扣一个
|
| | | endCount = 1 # 只快速结算一次
|
| | | costItemCount = finishCount # 每次扣一个
|
| | |
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
|
| | | lackCnt = costItemCount - bindCnt - unBindCnt
|
| | | delItemCount = costItemCount
|
| | | if lackCnt > 0:
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, costGoldParper, ChConfig.Def_Cost_ActivityPlace):
|
| | | costGoldParperTotal = costGoldParper * lackCnt
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, costGoldParperTotal, ChConfig.Def_Cost_ActivityPlace):
|
| | | return
|
| | | else:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, ChConfig.ItemDel_ActivityPlace)
|
| | | delItemCount -= lackCnt
|
| | |
|
| | | __DoActivityPlaceRewardEnd(curPlayer, endCount)
|
| | | if delItemCount > 0:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delItemCount, ChConfig.ItemDel_ActivityPlace)
|
| | | |
| | | __DoActivityPlaceRewardEnd(curPlayer, finishCount)
|
| | | return
|
| | |
|
| | | def ProcessActivityPlace(curPlayer):
|
| | |
| | | import IpyGameDataPY
|
| | | import PlayerControl
|
| | | import NPCHurtManager
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import ItemCommon
|
| | |
| | | ipyData = ipyDataMgr.GetAssistThanksGiftByIndex(index)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GetThanksGiftCount % ipyData.GetGiftID(), 0)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoney, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoneySocial, 0)
|
| | | Sync_TodayAssistMoneyInfo(curPlayer)
|
| | | return
|
| | |
|
| | | #// B0 10 请求协助Boss #tagCMRequestAssistBoss
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def AddTodayAssistMoney(curPlayer, moneyType, addMoney, isSocialEx):
|
| | | ''' 增加今日协助货币奖励 |
| | | @param moneyType: 货币类型
|
| | | @param addMoney: 常规增加,有每日上限
|
| | | @param isSocialEx: 是否社交加成,不计入常规上限
|
| | | '''
|
| | | |
| | | todayAssistMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoney)
|
| | | socialMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoneySocial)
|
| | | todayAssistMoneyMax = IpyGameDataPY.GetFuncCfg("AssistAward", 4)
|
| | | if todayAssistMoney >= todayAssistMoneyMax:
|
| | | return 0
|
| | | |
| | | addValue = min(addMoney, todayAssistMoneyMax - todayAssistMoney)
|
| | | socialEx = 0
|
| | | if isSocialEx:
|
| | | friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3)
|
| | | socialEx = int(addValue * friendAddAssistMoneyPer / 100.0)
|
| | | |
| | | realAdd = addValue + socialEx
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, realAdd)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoney, todayAssistMoney + addValue)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoneySocial, socialMoney + socialEx)
|
| | | |
| | | Sync_TodayAssistMoneyInfo(curPlayer)
|
| | | return realAdd
|
| | |
|
| | | def Sync_TodayAssistMoneyInfo(curPlayer):
|
| | | ## 通知今日已获得协助货币信息
|
| | | infoPack = ChPyNetSendPack.tagMCTodayAssistMoneyInfo()
|
| | | infoPack.TodayAssistMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoney)
|
| | | infoPack.SocialMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoneySocial)
|
| | | NetPackCommon.SendFakePack(curPlayer, infoPack)
|
| | | return
|
| | |
|