From 2a3e2e53da4ff2005fc84f702483fd3f29b9c569 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 17 十月 2025 20:28:44 +0800
Subject: [PATCH] 237 【福利内容】每日任务/每周任务/章节奖励-服务端(章节奖励英雄之路,成就系统)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Mail.py | 135 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 108 insertions(+), 27 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Mail.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Mail.py
index ab5ab3f..e4848fb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Mail.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Mail.py
@@ -19,7 +19,10 @@
import PlayerMail
import ShareDefine
import DataRecordPack
+import IpyGameDataPY
import DBDataMgr
+import ItemCommon
+import CommFunc
import random
## 执行逻辑
@@ -32,6 +35,9 @@
GameWorld.DebugAnswer(curPlayer, "清空邮件: Mail 0")
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]
@@ -44,10 +50,50 @@
PrintPlayerMail(curPlayer)
return
+ if value == "s":
+ 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):
@@ -57,36 +103,73 @@
mailTypeKey = gmList[2] if len(gmList) > 2 else ""
paramList = gmList[3:]
- itemIDList = range(3501, 3530 + 1)
- moneyIDList = [20, 30]
-
mailMgr = DBDataMgr.GetMailMgr()
mailCntBef = mailMgr.GetPersonalMailCount(playerID)
-
- isBind = 0
for _ in range(sendCnt):
-
- itemList = []
- if mailItemCnt:
- for moneyID in moneyIDList:
- itemCount = random.choice([100, 1000, 10000, 20000, 50000, 100000, 200000, 300000, 500000])
- itemList.append([moneyID, itemCount, isBind])
- if len(itemList) >= mailItemCnt:
- break
-
- random.shuffle(itemIDList)
- for i in range(mailItemCnt):
- itemID = itemIDList[i]
- itemCount = random.randint(1, 100000)
- itemList.append([itemID, itemCount, isBind])
- if len(itemList) >= mailItemCnt:
- break
-
- PlayerMail.SendMailByKey(mailTypeKey, playerID, itemList, paramList)
+ itemList = __randMailItem(mailItemCnt)
+ 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))
return
+
+def SendServerMail(curPlayer, gmList):
+ mailItemCnt = gmList[1] if len(gmList) > 1 else 5
+ limitDays = gmList[2] if len(gmList) > 2 else 7
+
+ randValue = random.randint(1, 1000)
+ title = GameWorld.GbkToCode("全服邮件标题%s" % randValue)
+ text = GameWorld.GbkToCode(
+ '''全服邮件内容全服邮件内容全服邮件内容全服邮件内容全服邮件内容
+ 全服邮件内容全服邮件内容全服邮件内容全服邮件内容全服邮件内容%s
+ ''' % randValue
+ )
+ itemList = __randMailItem(mailItemCnt)
+
+ PlayerMail.SendSeverMail("", title, text, itemList, limitDays)
+ GameWorld.DebugAnswer(curPlayer, "发送全服邮件OK!")
+ return
+
+def __randMailItem(mailItemCnt):
+ moneyIDList = [1, 2, 3]
+ equipIDList = range(100501, 100512)
+ heroIDList = range(510001, 510016)
+ itemIDList = [4, 5, 7, 8, 9, 10, 11, 12, 13, 1000, 1001, 1002] #range(3501, 3530 + 1)
+
+ isBind = 0
+ itemList = []
+ if mailItemCnt:
+ for moneyID in moneyIDList:
+ itemCount = random.choice([100, 1000, 10000, 20000, 50000, 100000, 200000, 300000, 500000])
+ itemList.append([moneyID, itemCount, isBind])
+ if len(itemList) >= mailItemCnt:
+ break
+
+ random.shuffle(equipIDList)
+ for i in range(3):
+ itemID = equipIDList[i%len(equipIDList)]
+ itemCount = 1
+ itemList.append([itemID, itemCount, isBind])
+ if len(itemList) >= mailItemCnt:
+ break
+
+ random.shuffle(heroIDList)
+ for i in range(3):
+ itemID = heroIDList[i%len(heroIDList)]
+ itemCount = 1
+ itemList.append([itemID, itemCount, isBind])
+ if len(itemList) >= mailItemCnt:
+ break
+
+ random.shuffle(itemIDList)
+ for i in range(mailItemCnt):
+ itemID = itemIDList[i%len(itemIDList)]
+ itemCount = random.randint(1, 100000)
+ itemList.append([itemID, itemCount, isBind])
+ if len(itemList) >= mailItemCnt:
+ break
+
+ return itemList
def ClearMail(curPlayer):
notifyGUIDState = {}
@@ -98,15 +181,13 @@
DataRecordPack.DR_MailDel(playerID, guid, "GMDel")
notifyGUIDState[guid] = ShareDefine.MailState_Del
GameWorld.DebugAnswer(curPlayer, "删除个人邮件:%s" % len(guidList))
+ PlayerMail.Sync_PlayerMailState(curPlayer, notifyGUIDState)
guidList = mailMgr.GetServerMailGuids()
for guid in guidList:
- playerStateDict = mailMgr.DelServerMail(guid)
- if playerID in playerStateDict and playerStateDict[playerID] < ShareDefine.MailState_Del:
- notifyGUIDState[guid] = ShareDefine.MailState_Del
+ PlayerMail.DelServerMail(guid, "GMDel")
if len(guidList):
GameWorld.DebugAnswer(curPlayer, "删除全服邮件:%s" % len(guidList))
- PlayerMail.Sync_PlayerMailState(curPlayer, notifyGUIDState)
return
def PrintPlayerMail(curPlayer):
--
Gitblit v1.8.0