From 95fcaaafe13a1c0a2ff7706fe7cc1964f921b7c3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 02 十一月 2018 14:04:26 +0800
Subject: [PATCH] 4399 【后端】【1.2.0】聊天新增支持气泡框选择功能

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index ba7d046..fe318e1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/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

--
Gitblit v1.8.0