hxp
2023-07-31 495f9eed41e29b54672a767817c9cb11419dfa4c
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
5个文件已修改
149 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Success.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -24262,6 +24262,58 @@
#------------------------------------------------------
# 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):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -24262,6 +24262,58 @@
#------------------------------------------------------
# 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):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Success.py
@@ -19,6 +19,7 @@
import ShareDefine
import PlayerSuccess
import GameWorld
import PlayerControl
#逻辑实现
## GM命令执行入口
@@ -83,6 +84,8 @@
    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
@@ -111,6 +114,8 @@
    # 同步成就领奖记录
    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):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5616,6 +5616,9 @@
    # 古宝特殊效果物品奖励
    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)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSuccess.py
@@ -245,6 +245,9 @@
        if not succInfoList:
            continue
        __DoCheckSuccessFinish(curPlayer, succType, succInfoList)
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_ScoreAward):
        Sync_SuccessScoreAward(curPlayer)
    return
## 检查老玩家成就激活情况
@@ -1044,4 +1047,36 @@
    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