9788 【BT9】【后端】成就系统(增加成就积分) hygame2
# Conflicts:
# ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 43 成就积分信息 #tagMCSuccessScoreInfo
|
| | |
|
| | | class tagMCSuccessScoreInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ScoreAwardState", c_int), #成就积分领奖记录,按奖励索引位记录是否领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x43
|
| | | 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 = 0xA3
|
| | | self.SubCmd = 0x43
|
| | | self.ScoreAwardState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCSuccessScoreInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 43 成就积分信息 //tagMCSuccessScoreInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ScoreAwardState:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ScoreAwardState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCSuccessScoreInfo=tagMCSuccessScoreInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuccessScoreInfo.Cmd,m_NAtagMCSuccessScoreInfo.SubCmd))] = m_NAtagMCSuccessScoreInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A3 14 通知各功能的祝福值 #tagMCSyncBlessValue
|
| | |
|
| | | class tagMCSyncSingleBlessValue(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 43 成就积分信息 #tagMCSuccessScoreInfo
|
| | |
|
| | | class tagMCSuccessScoreInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ScoreAwardState", c_int), #成就积分领奖记录,按奖励索引位记录是否领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x43
|
| | | 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 = 0xA3
|
| | | self.SubCmd = 0x43
|
| | | self.ScoreAwardState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCSuccessScoreInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 43 成就积分信息 //tagMCSuccessScoreInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ScoreAwardState:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ScoreAwardState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCSuccessScoreInfo=tagMCSuccessScoreInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuccessScoreInfo.Cmd,m_NAtagMCSuccessScoreInfo.SubCmd))] = m_NAtagMCSuccessScoreInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A3 14 通知各功能的祝福值 #tagMCSyncBlessValue
|
| | |
|
| | | class tagMCSyncSingleBlessValue(Structure):
|
| | |
| | | import ShareDefine
|
| | | import PlayerSuccess
|
| | | import GameWorld
|
| | | import PlayerControl
|
| | |
|
| | | #逻辑实现
|
| | | ## GM命令执行入口
|
| | |
| | | PlayerSuccess.Sync_SuccessInfo(curPlayer, [], True)
|
| | | # 同步成就领奖记录
|
| | | PlayerSuccess.Sync_SuccTypeIndexAwardRecord(curPlayer, [], True)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Success_ScoreAward, 0)
|
| | | PlayerSuccess.Sync_SuccessScoreAward(curPlayer)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置成就类型:%s" % resetTypeList)
|
| | | return
|
| | |
|
| | |
| | | # 同步成就领奖记录
|
| | | PlayerSuccess.Sync_SuccTypeIndexAwardRecord(curPlayer, resetIDList, True)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置成就ID领奖:%s" % resetIDList)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Success_ScoreAward, 0)
|
| | | PlayerSuccess.Sync_SuccessScoreAward(curPlayer)
|
| | | return
|
| | |
|
| | | def __DoPrintSuccess(curPlayer, msgList):
|
| | |
| | | # 古宝特殊效果物品奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_GubaoItemEff:
|
| | | PlayerGubao.GetGubaoItemEffAward(curPlayer, dataEx, dataExStr)
|
| | | # 成就积分奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_SuccessScore:
|
| | | PlayerSuccess.GetSuccessScoreAward(curPlayer, dataEx)
|
| | | #缥缈奇遇领取
|
| | | elif rewardType == ChConfig.Def_RewardType_FairyAdventuresAward:
|
| | | PlayerFairyDomain.GetFairyAdventuresAward(curPlayer, dataEx, dataExStr)
|
| | |
| | | if not succInfoList:
|
| | | continue
|
| | | __DoCheckSuccessFinish(curPlayer, succType, succInfoList)
|
| | | |
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward):
|
| | | Sync_SuccessScoreAward(curPlayer)
|
| | | return
|
| | |
|
| | | ## 检查老玩家成就激活情况
|
| | |
| | | elif mapID == ChConfig.Def_FBMapID_IceLode:
|
| | | #冰晶矿脉
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_IceLode, addCount)
|
| | | return |
| | | return
|
| | |
|
| | | def GetSuccessScoreAward(curPlayer, awardIndex):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | awardDict = IpyGameDataPY.GetFuncEvalCfg("SucceeScore", 1, {})
|
| | | if str(awardIndex) not in awardDict:
|
| | | return
|
| | | awardInfo = awardDict[str(awardIndex)]
|
| | | if len(awardInfo) != 2:
|
| | | return
|
| | | needScore, awardItemList = awardInfo
|
| | | if not PlayerControl.HaveMoney(curPlayer, ShareDefine.TYPE_Price_SuccessSocre, needScore):
|
| | | GameWorld.Log("成就积分不足,无法领奖! awardIndex=%s,needScore=%s" % (awardIndex, needScore), playerID)
|
| | | return
|
| | | awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward)
|
| | | if awardState & pow(2, awardIndex):
|
| | | GameWorld.DebugLog("已领取过该成就积分奖励! awardIndex=%s" % awardIndex, playerID)
|
| | | return
|
| | | updAwardState = awardState | pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Success_ScoreAward, updAwardState)
|
| | | GameWorld.DebugLog("领取成就积分奖励! awardIndex=%s,awardState=%s,updAwardState=%s" % (awardIndex, awardState, updAwardState), playerID)
|
| | | Sync_SuccessScoreAward(curPlayer)
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["SuccessScore", False, {}])
|
| | | return
|
| | |
|
| | | def Sync_SuccessScoreAward(curPlayer):
|
| | | clientPack = ChPyNetSendPack.tagMCSuccessScoreInfo()
|
| | | clientPack.Clear()
|
| | | clientPack.ScoreAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | | |
| | | |