9756 【BT8】【后端】结婚无限吃喜糖修改(增加可配置每日吃喜糖次数上限)
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B3 30 情缘相关信息 #tagMCLoveInfo
|
| | |
|
| | | class tagMCLoveInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("EatCandyToday", c_int), # 今日已吃喜糖次数,包含免费及付费的所有次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB3
|
| | | 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 = 0xB3
|
| | | self.SubCmd = 0x30
|
| | | self.EatCandyToday = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCLoveInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B3 30 情缘相关信息 //tagMCLoveInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | EatCandyToday:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.EatCandyToday
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCLoveInfo=tagMCLoveInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCLoveInfo.Cmd,m_NAtagMCLoveInfo.SubCmd))] = m_NAtagMCLoveInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B3 27 情戒信息 #tagMCLoveRingInfo
|
| | |
|
| | | class tagMCLoveRingInfo(Structure):
|
| | |
| | | Def_PDict_LoveRingStarLV = "LoveRingStarLV" # 情戒 - 星级
|
| | | Def_PDict_LoveRingEatCount = "LoveRingEatCount" # 情戒 - 本星已淬炼道具数
|
| | | Def_PDict_LoveCoupleIntimacy = "LoveCoupleIntimacy" # 伴侣亲密度
|
| | | Def_PDict_LoveEatCandyToday = "LoveEatCandyToday" # 今日已吃喜糖次数
|
| | | Def_PDict_CharmLV = "CharmLV" # 魅力等级
|
| | |
|
| | | #古宝
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B3 30 情缘相关信息 #tagMCLoveInfo
|
| | |
|
| | | class tagMCLoveInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("EatCandyToday", c_int), # 今日已吃喜糖次数,包含免费及付费的所有次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB3
|
| | | 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 = 0xB3
|
| | | self.SubCmd = 0x30
|
| | | self.EatCandyToday = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCLoveInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B3 30 情缘相关信息 //tagMCLoveInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | EatCandyToday:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.EatCandyToday
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCLoveInfo=tagMCLoveInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCLoveInfo.Cmd,m_NAtagMCLoveInfo.SubCmd))] = m_NAtagMCLoveInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B3 27 情戒信息 #tagMCLoveRingInfo
|
| | |
|
| | | class tagMCLoveRingInfo(Structure):
|
| | |
| | | import BuffSkill
|
| | | import PyGameData
|
| | |
|
| | | def DoPlayerOnDay(curPlayer): |
| | | def DoPlayerOnDay(curPlayer):
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, 0)
|
| | | Sync_LoveInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def DoPlayerLogin(curPlayer):
|
| | | Sync_LoveInfo(curPlayer)
|
| | | Sync_LoveRingInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | EatCandyMax = IpyGameDataPY.GetFuncCfg("LoveCandy", 4)
|
| | | if EatCandyMax:
|
| | | eatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday)
|
| | | if eatCandyToday >= EatCandyMax:
|
| | | GameWorld.DebugLog("已达今日吃喜糖次数上限. eatCandyToday=%s >= %s" % (eatCandyToday, EatCandyMax), playerID)
|
| | | return
|
| | | |
| | | if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick):
|
| | | PlayerControl.NotifyCode(curPlayer, "RequestLater")
|
| | | return
|
| | |
| | | if not canBuy:
|
| | | return
|
| | |
|
| | | GameWorld.Log("吃喜糖结果: isFree=%s" % (isFree), curPlayer.GetPlayerID())
|
| | | updEatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday) + 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, updEatCandyToday)
|
| | | Sync_LoveInfo(curPlayer)
|
| | | |
| | | GameWorld.Log("吃喜糖结果: isFree=%s,updEatCandyToday=%s" % (isFree, updEatCandyToday), curPlayer.GetPlayerID())
|
| | |
|
| | | if not isFree:
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:"EatCandy"}
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def Sync_LoveInfo(curPlayer):
|
| | | ## 同步情缘相关信息
|
| | | clientPack = ChPyNetSendPack.tagMCLoveInfo()
|
| | | clientPack.EatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def SyncMapServerIntimacy(curPlayer, dataMsg):
|
| | | tagID, intimacyValue = dataMsg
|
| | | coupleID = PlayerControl.GetCoupleID(curPlayer)
|