#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.ChatBox
|
#
|
# @todo:ÁÄÌì¿ò
|
# @author hxp
|
# @date 2024-09-13
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÁÄÌì¿ò
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2024-09-13 16:30"""
|
#-------------------------------------------------------------------------------
|
|
import GameWorld
|
import IpyGameDataPY
|
import PlayerControl
|
import PlayerChatBox
|
import ChConfig
|
|
#Â߼ʵÏÖ
|
## GMÃüÁîÖ´ÐÐÈë¿Ú
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param msgList ²ÎÊýÁбí
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnExec(curPlayer, msgList):
|
|
if not msgList:
|
GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr())
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÆøÅÝ¿ò: ChatBox b1 ÆøÅÝ¿òID [ÓÐЧÃë]")
|
GameWorld.DebugAnswer(curPlayer, "ɾ³ýÆøÅÝ¿ò: ChatBox b0 [ÆøÅÝ¿òID]")
|
GameWorld.DebugAnswer(curPlayer, "ÆøÅÝ¿òÐǼ¶: ChatBox bs ÆøÅÝ¿òID ÐǼ¶")
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼Ó±íÇé°ü: ChatBox e1 ±íÇé°üID [ÓÐЧÃë]")
|
GameWorld.DebugAnswer(curPlayer, "ɾ³ý±íÇé°ü: ChatBox e0 [±íÇé°üID]")
|
GameWorld.DebugAnswer(curPlayer, "ÓÐЧÃë:²»Ìî¶Á±í,0-ÓÀ¾Ã,>0Ö¸¶¨ÓÐЧÃë")
|
return
|
|
syncBoxIDList = []
|
packIDList = []
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
value1 = msgList[0]
|
|
# ɾ³ýÆøÅÝ¿ò
|
if value1 == "b0":
|
boxID = msgList[1] if len(msgList) > 1 else 0
|
if not boxID:
|
for index in range(ipyDataMgr.GetChatBubbleBoxCount()):
|
ipyData = ipyDataMgr.GetChatBubbleBoxByIndex(index)
|
boxID = ipyData.GetBoxID()
|
if ipyData.GetUnlockDefault():
|
continue
|
if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, boxID):
|
continue
|
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, boxID, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChatBoxEndTime % boxID, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChatBoxStar % boxID, 0)
|
syncBoxIDList.append(boxID)
|
else:
|
ipyData = IpyGameDataPY.GetIpyGameData("ChatBubbleBox", boxID)
|
if not ipyData:
|
GameWorld.DebugAnswer(curPlayer, "¸ÃÆøÅÝ¿ò²»´æÔÚ:%s" % boxID)
|
return
|
if ipyData.GetUnlockDefault():
|
GameWorld.DebugAnswer(curPlayer, "¸ÃÆøÅÝ¿òĬÈϼ¤»î:%s" % boxID)
|
return
|
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ChatBubbleBoxState, boxID, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChatBoxEndTime % boxID, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChatBoxStar % boxID, 0)
|
syncBoxIDList.append(boxID)
|
GameWorld.DebugAnswer(curPlayer, "ɾ³ýÆøÅÝ¿ò:%s" % syncBoxIDList)
|
|
# Ìí¼ÓÆøÅÝ¿ò
|
elif value1 == "b1":
|
boxID = msgList[1] if len(msgList) > 1 else 0
|
expireTimes = msgList[2] if len(msgList) > 2 else None
|
if PlayerChatBox.AddChatBox(curPlayer, boxID, expireTimes):
|
endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChatBoxEndTime % boxID)
|
endTimeStr = "ÓÀ¾Ã" if not endTime else GameWorld.ChangeTimeNumToStr(endTime)
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÆøÅÝ¿ò³É¹¦:%s,µ½ÆÚ:%s" % (boxID, endTimeStr))
|
else:
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÆøÅÝ¿òʧ°Ü:%s" % (boxID))
|
|
# ÆøÅÝ¿òÐǼ¶
|
elif value1 == "bs":
|
boxID = msgList[1] if len(msgList) > 1 else 0
|
boxStar = msgList[2] if len(msgList) > 2 else 0
|
if boxStar:
|
starIpyData = IpyGameDataPY.GetIpyGameData("ChatBubbleBoxStar", boxID, boxStar)
|
if not starIpyData:
|
GameWorld.DebugAnswer(curPlayer, "ÆøÅÝ¿òÐǼ¶²»´æÔÚ:%s,star:%s" % (boxID, boxStar))
|
return
|
GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÆøÅÝ¿òÐǼ¶:%s,ÐÇ:%s" % (boxID, boxStar))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChatBoxStar % boxID, boxStar)
|
syncBoxIDList.append(boxID)
|
|
# ɾ³ý±íÇé°ü
|
elif value1 == "e0":
|
packID = msgList[1] if len(msgList) > 1 else 0
|
if not packID:
|
for index in range(ipyDataMgr.GetEmojiPackCount()):
|
ipyData = ipyDataMgr.GetEmojiPackByIndex(index)
|
packID = ipyData.GetEmojiPackID()
|
if ipyData.GetUnlockDefault():
|
continue
|
if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_EmojiPackState, packID):
|
continue
|
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_EmojiPackState, packID, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EmojiPackEndTime % packID, 0)
|
packIDList.append(packID)
|
else:
|
ipyData = IpyGameDataPY.GetIpyGameData("EmojiPack", packID)
|
if not ipyData:
|
GameWorld.DebugAnswer(curPlayer, "¸Ã±íÇé°ü²»´æÔÚ:%s" % packID)
|
return
|
if ipyData.GetUnlockDefault():
|
GameWorld.DebugAnswer(curPlayer, "¸Ã±íÇé°üĬÈϼ¤»î:%s" % packID)
|
return
|
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_EmojiPackState, packID, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EmojiPackEndTime % packID, 0)
|
packIDList.append(packID)
|
GameWorld.DebugAnswer(curPlayer, "ɾ³ý±íÇé°ü:%s" % packIDList)
|
|
# Ìí¼Ó±íÇé°ü
|
elif value1 == "e1":
|
packID = msgList[1] if len(msgList) > 1 else 0
|
expireTimes = msgList[2] if len(msgList) > 2 else None
|
if PlayerChatBox.AddEmojiPack(curPlayer, packID, expireTimes):
|
endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EmojiPackEndTime % packID)
|
endTimeStr = "ÓÀ¾Ã" if not endTime else GameWorld.ChangeTimeNumToStr(endTime)
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼Ó±íÇé°ü³É¹¦:%s,µ½ÆÚ:%s" % (packID, endTimeStr))
|
else:
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼Ó±íÇé°üʧ°Ü:%s" % (packID))
|
|
if syncBoxIDList:
|
PlayerChatBox.RefreshBoxAttr(curPlayer)
|
PlayerChatBox.SyncChatBoxInfo(curPlayer, syncBoxIDList)
|
|
if packIDList:
|
PlayerChatBox.SyncEmojiPackInfo(curPlayer, packIDList)
|
return
|