#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.SetRedPacket
|
#
|
# @todo:ÉèÖúì°ü
|
# @author hxp
|
# @date 2019-01-29
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÉèÖúì°ü
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2019-01-29 16:00"""
|
#-------------------------------------------------------------------------------
|
|
import PlayerFamilyRedPacket
|
import ShareDefine
|
import GameWorld
|
import IpyGameDataPY
|
import PlayerDBGSEvent
|
|
|
## GMÃüÁîÖ´ÐÐÈë¿Ú
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param paramList ²ÎÊýÁбí
|
# @return None or True
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnExec(curPlayer, paramList):
|
if not paramList:
|
return
|
|
# GameWorld.DebugAnswer(curPlayer, "ÖØÖÃËùÓкì°üÁìÈ¡:SetRedPacket 0")
|
# GameWorld.DebugAnswer(curPlayer, "Çå³ýËùÓÐÀàÐͺì°ü:SetRedPacket 0 0")
|
# GameWorld.DebugAnswer(curPlayer, "Çå³ýÖ¸¶¨ÀàÐͺì°ü:SetRedPacket 0 ÀàÐÍA ÀàÐÍB ...")
|
|
paramA = paramList[0]
|
paramB = paramList[1] if len(paramList) > 1 else None
|
# ÖØÖÃËùÓкì°üÊý¾Ý
|
if paramA == 0:
|
PlayerFamilyRedPacket.g_allRecordDict = {}
|
PlayerFamilyRedPacket.g_grabDataDict = {}
|
PlayerFamilyRedPacket.g_redPackCountDict = {}
|
|
universalRecMgr = GameWorld.GetUniversalRecMgr()
|
# Çå³ýËùÓÐÀàÐͺì°ü
|
if paramB == 0:
|
universalRecMgr.Delete(ShareDefine.Def_UniversalGameRecType_FamilyRedPacketAllRecord)
|
__ResetSendState([])
|
GameWorld.DebugAnswer(curPlayer, "Çå³ýËùÓÐÀàÐͺì°üOK!")
|
|
# Çå³ýÖ¸¶¨ÀàÐͺì°ü
|
elif paramB:
|
delTypeList = paramList[1:]
|
allRecordList = universalRecMgr.GetTypeList(ShareDefine.Def_UniversalGameRecType_FamilyRedPacketAllRecord)
|
delCount = 0
|
for index in xrange(allRecordList.Count()):
|
universalRecData = allRecordList.At(index - delCount)
|
strValue1 = universalRecData.GetStrValue1()
|
strValue1List = strValue1.split('|')
|
getWay = int(strValue1List[3])
|
if getWay not in delTypeList:
|
continue
|
allRecordList.Delete(index)
|
delCount += 1
|
__ResetSendState(delTypeList)
|
GameWorld.DebugAnswer(curPlayer, "Çå³ýÖ¸¶¨ÀàÐͺì°üOK!%s,ÌõÊý:%s" % (delTypeList, delCount))
|
|
# Çå³ýÇÀµÄ¼Ç¼
|
universalRecMgr.Delete(ShareDefine.Def_UniversalGameRecType_FamilyRedPacketGrabRecord)
|
PlayerFamilyRedPacket.NotifyRedPacketInfo(curPlayer)
|
GameWorld.DebugAnswer(curPlayer, "Çå³ýËùÓкì°üÁìÈ¡¼Ç¼OK!")
|
return
|
|
|
return
|
|
def __ResetSendState(delTypeList):
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
for index in xrange(ipyDataMgr.GetFamilyRedPackCount()):
|
ipyData = ipyDataMgr.GetFamilyRedPackByIndex(index)
|
if delTypeList and ipyData.GetGetType() not in delTypeList:
|
continue
|
redPackID = ipyData.GetID()
|
if PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerFamilyRedPacket.DBKey_RedPacketSend % redPackID):
|
PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerFamilyRedPacket.DBKey_RedPacketSend % redPackID, 0)
|
return
|
|
|
|