hxp
2018-11-02 95fcaaafe13a1c0a2ff7706fe7cc1964f921b7c3
4399 【后端】【1.2.0】聊天新增支持气泡框选择功能
8个文件已修改
1个文件已添加
245 ■■■■■ 已修改文件
PySysDB/PySysDBPY.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ChatBubbleBox.py 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBPY.h
@@ -1341,3 +1341,12 @@
    DWORD        _FuncID;    //功能ID
    dict        Award;    //属性类型
};
//聊天气泡表
struct tagChatBubbleBox
{
    BYTE        _BoxID;    //气泡框ID
    WORD        NeedLV;    //所需等级
    BYTE        NeedVIPLVGift;    //所需购买VIP等级礼包
};
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -6594,7 +6594,7 @@
                  ("SubCmd", c_ubyte),
                  ("MapID", c_int),    # 请求进入的地图ID
                  ("AskType", c_ubyte),    # 请求类型: 0-匹配请求;1-进入请求
                  ("Reason", c_ubyte),    # 失败原因:
                  ("Reason", c_ubyte),    # 失败原因:2-次数不足;3-进入CD中;6-门票不足
                  ]
    def __init__(self):
@@ -16778,6 +16778,62 @@
#------------------------------------------------------
# A7 17 聊天气泡框状态 #tagMCChatBubbleBoxState
class  tagMCChatBubbleBoxState(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("UseBoxID", c_ubyte),    # 当前使用的气泡框ID
                  ("BoxState", c_int),    # 按二进制位存储代表是否已开启,暂支持31位,以后有需要再加
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA7
        self.SubCmd = 0x17
        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 = 0xA7
        self.SubCmd = 0x17
        self.UseBoxID = 0
        self.BoxState = 0
        return
    def GetLength(self):
        return sizeof(tagMCChatBubbleBoxState)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A7 17 聊天气泡框状态 //tagMCChatBubbleBoxState:
                                Cmd:%s,
                                SubCmd:%s,
                                UseBoxID:%d,
                                BoxState:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.UseBoxID,
                                self.BoxState
                                )
        return DumpString
m_NAtagMCChatBubbleBoxState=tagMCChatBubbleBoxState()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCChatBubbleBoxState.Cmd,m_NAtagMCChatBubbleBoxState.SubCmd))] = m_NAtagMCChatBubbleBoxState
#------------------------------------------------------
# A7 13 动态障碍物状态 #tagMCDynamicBarrierState
class  tagMCDynamicBarrier(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -420,6 +420,7 @@
Def_Effect_AddKillBossCnt = 234   # 增加BOSS可击杀次数
Def_Effect_DogzEquipPlusExp = 235   # 神兽强化材料经验效果,A值基础经验,B值双倍强化消耗仙玉
Def_Effect_AddMagicWeaponUpExp = 236   # 增加法宝升星经验 A值法宝ID B值X经验
Def_Effect_ChatBubbleBox = 237   # 激活聊天气泡框,A值气泡框ID
#----以下未使用或代码依然存在的---
Def_Effect_ItemGiveGongXun = 1920        #使用道具给予功勋
Def_Effect_ItemGiveHonorPoint = 1922       #使用道具给予荣誉积分
@@ -3631,6 +3632,11 @@
Def_PDict_WishingWellRefreshCnt = "WishingWellRefreshCnt"  # 付费刷新次数
Def_PDict_WishingWellItem = "WishingWellItem_%s_%s"  # 物品ID,是否极品、是否绑定信息 参数(类型,物品数据)
Def_PDict_WishingWellItemCnt = "WishingWellItemCnt_%s_%s"  # 物品数量记录 参数(类型,物品数据)
#聊天气泡
Def_PDict_ChatBubbleBoxUseID = "ChatBubbleBoxUseID"  # 聊天气泡当前使用的气泡框ID
Def_PDict_ChatBubbleBoxState = "ChatBubbleBoxState_%s"  # 聊天气泡状态, 参数(key编号)
#-------------------------------------------------------------------------------
#类型 Def_PDictType_OnlinePrize
Def_PDict1_OnlinePrizeCnt = "OnlinePrizeCnt"  # 新手在线已领取奖励次数
@@ -4730,7 +4736,8 @@
ItemDel_AddFBCnt, # 增加副本可进入次数 31
ItemDel_AddKillBossCnt, # 增加BOSS可击杀次数 32
ItemDel_DogzEquipPlus, # 神兽装备强化
) = range(2000, 2000 + 34)
ItemDel_ChatBubbleBox, # 激活聊天气泡框
) = range(2000, 2000 + 35)
# 物品扣除类型对应信息 {类型:eventName, ...}
ItemDelTypeDict = {
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -6594,7 +6594,7 @@
                  ("SubCmd", c_ubyte),
                  ("MapID", c_int),    # 请求进入的地图ID
                  ("AskType", c_ubyte),    # 请求类型: 0-匹配请求;1-进入请求
                  ("Reason", c_ubyte),    # 失败原因:
                  ("Reason", c_ubyte),    # 失败原因:2-次数不足;3-进入CD中;6-门票不足
                  ]
    def __init__(self):
@@ -16778,6 +16778,62 @@
#------------------------------------------------------
# A7 17 聊天气泡框状态 #tagMCChatBubbleBoxState
class  tagMCChatBubbleBoxState(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("UseBoxID", c_ubyte),    # 当前使用的气泡框ID
                  ("BoxState", c_int),    # 按二进制位存储代表是否已开启,暂支持31位,以后有需要再加
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA7
        self.SubCmd = 0x17
        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 = 0xA7
        self.SubCmd = 0x17
        self.UseBoxID = 0
        self.BoxState = 0
        return
    def GetLength(self):
        return sizeof(tagMCChatBubbleBoxState)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A7 17 聊天气泡框状态 //tagMCChatBubbleBoxState:
                                Cmd:%s,
                                SubCmd:%s,
                                UseBoxID:%d,
                                BoxState:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.UseBoxID,
                                self.BoxState
                                )
        return DumpString
m_NAtagMCChatBubbleBoxState=tagMCChatBubbleBoxState()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCChatBubbleBoxState.Cmd,m_NAtagMCChatBubbleBoxState.SubCmd))] = m_NAtagMCChatBubbleBoxState
#------------------------------------------------------
# A7 13 动态障碍物状态 #tagMCDynamicBarrierState
class  tagMCDynamicBarrier(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1064,6 +1064,12 @@
                        ("DWORD", "FuncID", 1),
                        ("dict", "Award", 0),
                        ),
                "ChatBubbleBox":(
                        ("BYTE", "BoxID", 1),
                        ("WORD", "NeedLV", 0),
                        ("BYTE", "NeedVIPLVGift", 0),
                        ),
                }
@@ -3231,6 +3237,19 @@
    def GetFuncID(self): return self.FuncID # 功能ID
    def GetAward(self): return self.Award # 属性类型
# 聊天气泡表
class IPY_ChatBubbleBox():
    def __init__(self):
        self.BoxID = 0
        self.NeedLV = 0
        self.NeedVIPLVGift = 0
        return
    def GetBoxID(self): return self.BoxID # 气泡框ID
    def GetNeedLV(self): return self.NeedLV # 所需等级
    def GetNeedVIPLVGift(self): return self.NeedVIPLVGift # 所需购买VIP等级礼包
def Log(msg, playerID=0, par=0):
    LogUI.Msg("%s\t%s\t%s" % (par, playerID, msg))
@@ -3451,6 +3470,8 @@
        self.ipyWishingWellLen = len(self.ipyWishingWellCache)
        self.ipyFunctionForecastCache = self.__LoadFileData("FunctionForecast", IPY_FunctionForecast)
        self.ipyFunctionForecastLen = len(self.ipyFunctionForecastCache)
        self.ipyChatBubbleBoxCache = self.__LoadFileData("ChatBubbleBox", IPY_ChatBubbleBox)
        self.ipyChatBubbleBoxLen = len(self.ipyChatBubbleBoxCache)
        Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
        Log("IPY_DataMgr InitOK!")
        return
@@ -3813,6 +3834,8 @@
    def GetWishingWellByIndex(self, index): return self.ipyWishingWellCache[index]
    def GetFunctionForecastCount(self): return self.ipyFunctionForecastLen
    def GetFunctionForecastByIndex(self, index): return self.ipyFunctionForecastCache[index]
    def GetChatBubbleBoxCount(self): return self.ipyChatBubbleBoxLen
    def GetChatBubbleBoxByIndex(self, index): return self.ipyChatBubbleBoxCache[index]
IPYData = IPY_DataMgr()
def IPY_Data(): return IPYData
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -713,6 +713,7 @@
                            ChConfig.Def_Effect_AddFBCnt:"Item_AddFBCnt", # 增加副本可进入次数
                            ChConfig.Def_Effect_AddKillBossCnt:"Item_AddKillBossCnt", # 增加BOSS可击杀次数
                            ChConfig.Def_Effect_AddMagicWeaponUpExp:"Item_AddMagicWeaponUpExp", # 增加法宝升星经验
                            ChConfig.Def_Effect_ChatBubbleBox:"Item_ChatBubbleBox", # 激活聊天气泡框
                            #ChConfig.Def_PhoneVip_EffID:"Item_AddPhoneVip", # 手机VIP物品卡
                            #ChConfig.Def_Effect_AddZhenQiByTimes:"Item_AddZhenQiByTimes", # 增加真气按一天使用次数减少
                            #ChConfig.Def_Effect_AddPrestige:"Item_AddPrestige",  # 给人物威望
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ChatBubbleBox.py
New file
@@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package UseItem.Item_ChatBubbleBox
#
# @todo:激活聊天气泡框
# @author hxp
# @date 2018-11-01
# @version 1.0
#
# 详细描述: 激活聊天气泡框
#
#-------------------------------------------------------------------------------
#"""Version = 2018-11-01 21:30"""
#-------------------------------------------------------------------------------
import ItemCommon
import ChConfig
import ChPlayer
def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
    ##批量使用物品
    curEff = curRoleItem.GetEffectByIndex(0)
    bubbleBoxID = curEff.GetEffectValue(0)
    if not bubbleBoxID:
        return
    if not ChPlayer.DoActivateChatBubbleBox(curPlayer, bubbleBoxID):
        return
    ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, ChConfig.ItemDel_ChatBubbleBox)
    return True, useCnt
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -552,6 +552,8 @@
    curPlayer.SendDBQueryRecharge()
    # 小助手
    SyncLittleHelper(curPlayer)
    # 聊天气泡框
    SyncChatBubbleBoxState(curPlayer)
    
    curPlayer.SetState(0)   # 脱机挂恢复为正常上线
    curPlayer.SetFacePic(0) # 通知数据库是否保存还是下线,做一次恢复,1为保存 0为正常下线
@@ -2538,7 +2540,51 @@
#};
def OnSetChatBubbleBox(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    PlayerControl.SetChatBubbleBox(curPlayer, clientData.BubbleBoxType)
    useBoxID = clientData.BubbleBoxType
    GameWorld.DebugLog("设置使用的聊天气泡框ID: useBoxID=%s" % useBoxID, curPlayer.GetPlayerID())
    ipyData = IpyGameDataPY.GetIpyGameData("ChatBubbleBox", useBoxID)
    if not ipyData:
        return
    curBoxState = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, useBoxID)
    if not curBoxState:
        needLV = ipyData.GetNeedLV()
        if needLV and curPlayer.GetLV() < needLV:
            GameWorld.DebugLog("    等级不足,无法使用该气泡框!needLV=%s" % needLV, curPlayer.GetPlayerID())
            return
        needVIPLVGift = ipyData.GetNeedVIPLVGift() # 兼容已购买VIP礼包的老号用
        if needVIPLVGift:
            record = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_VipAwardRecord)
            hasBuy = record & pow(2, needVIPLVGift)
            if not hasBuy:
                GameWorld.DebugLog("    未购买VIP礼包,无法使用该气泡框!needVIPLVGift=%s" % needVIPLVGift, curPlayer.GetPlayerID())
                return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxUseID, useBoxID)
    SyncChatBubbleBoxState(curPlayer)
    return
def DoActivateChatBubbleBox(curPlayer, boxID):
    ## 激活聊天气泡框
    ipyData = IpyGameDataPY.GetIpyGameData("ChatBubbleBox", boxID)
    if not ipyData:
        return
    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, boxID, 1)
    SyncChatBubbleBoxState(curPlayer)
    return True
def SyncChatBubbleBoxState(curPlayer):
    ## 同步聊天气泡框状态
    useBoxID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChatBubbleBoxUseID)
    boxState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChatBubbleBoxState % 0)
    if not useBoxID and not boxState:
        return
    boxStatePack = ChPyNetSendPack.tagMCChatBubbleBoxState()
    boxStatePack.UseBoxID = useBoxID
    boxStatePack.BoxState = boxState
    NetPackCommon.SendFakePack(curPlayer, boxStatePack)
    return
#// A2 29 设置小助手 #tagCMSetLittleHelper
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -5641,10 +5641,6 @@
def GetVIPExpireTime(curPlayer): return curPlayer.GetExAttr9()
def SetVIPExpireTime(curPlayer, expireTime): return curPlayer.SetExAttr9(expireTime, False, True)
##聊天气泡框
def GetChatBubbleBox(curPlayer): return curPlayer.GetExAttr10()
def SetChatBubbleBox(curPlayer, value): return curPlayer.SetExAttr10(value, False, False)
##获得玩家威望值
def GetPrestige(curPlayer): return 0
def SetPrestige(curPlayer, value): return