| | |
| | | import PlayerMail
|
| | | import ShareDefine
|
| | | import DataRecordPack
|
| | | import IpyGameDataPY
|
| | | import DBDataMgr
|
| | | import ItemCommon
|
| | | import CommFunc
|
| | | import random
|
| | |
|
| | | ## 执行逻辑
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "发送邮件: Mail 几封 物品数 [模板key 参数1 ...]")
|
| | | GameWorld.DebugAnswer(curPlayer, "输出邮件: Mail p")
|
| | | GameWorld.DebugAnswer(curPlayer, "发送全服: Mail s 物品数 [天数]")
|
| | | GameWorld.DebugAnswer(curPlayer, "发送邮件: Mail pw 天数 物品ID 个数 [ID 个数 ...]")
|
| | | GameWorld.DebugAnswer(curPlayer, "个数:如果是装备则个数默认1个,个数参数改为定制属性ID")
|
| | | return
|
| | |
|
| | | value = gmList[0]
|
| | |
| | | SendServerMail(curPlayer, gmList)
|
| | | return
|
| | |
|
| | | if value == "pw":
|
| | | SendPlayerMailItem(curPlayer, gmList)
|
| | | return
|
| | | |
| | | if value > 0:
|
| | | SendPlayerMail(curPlayer, gmList)
|
| | | return
|
| | |
|
| | | return
|
| | |
|
| | | def SendPlayerMailItem(curPlayer, gmList):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | limitDays = gmList[1] if len(gmList) > 1 else 1
|
| | | itemList = gmList[2:]
|
| | | |
| | | mailItemList = []
|
| | | while len(itemList) >= 2:
|
| | | itemID = itemList.pop(0)
|
| | | itemCount = itemList.pop(0)
|
| | | |
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | GameWorld.DebugAnswer(curPlayer, "物品ID不存在! %s" % itemID)
|
| | | continue
|
| | | |
| | | if ItemCommon.GetIsEquip(itemData):
|
| | | appointID = itemCount
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", appointID)
|
| | | if not ipyData:
|
| | | GameWorld.DebugAnswer(curPlayer, "定制属性ID不存在! %s" % appointID)
|
| | | continue
|
| | | userData = CommFunc.JsonDump({ShareDefine.Def_CItemKey_AppointID:appointID})
|
| | | itemInfo = [itemID, 1, 0, userData] # 装备默认1个
|
| | | else:
|
| | | itemInfo = [itemID, itemCount]
|
| | | |
| | | mailItemList.append(itemInfo)
|
| | | |
| | | PlayerMail.SendMailByKey("", playerID, mailItemList, limitDays=limitDays)
|
| | | GameWorld.DebugAnswer(curPlayer, "发送个人邮件物品OK")
|
| | | return
|
| | |
|
| | | def SendPlayerMail(curPlayer, gmList):
|
| | |
| | | mailCntBef = mailMgr.GetPersonalMailCount(playerID)
|
| | | for _ in range(sendCnt):
|
| | | itemList = __randMailItem(mailItemCnt)
|
| | | PlayerMail.SendMailByKey(mailTypeKey, playerID, itemList, paramList)
|
| | | PlayerMail.SendMailByKey(mailTypeKey, playerID, itemList, paramList, limitDays=random.randint(1, 7))
|
| | |
|
| | | mailCntAft = mailMgr.GetPersonalMailCount(playerID)
|
| | | GameWorld.DebugAnswer(curPlayer, "发送个人邮件OK:%s, %s~%s" % (sendCnt, mailCntBef, mailCntAft))
|