From bb1595120b68d983e1a2af9a63a0006bdf2e4aca Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 17:00:08 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(货币购买日常次数优化;支持切换召集队伍)
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py | 37 +++++++++++++++++++++++++++++++------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py | 9 ++++++---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py | 7 +++++--
PySysDB/PySysDBPY.h | 3 ++-
4 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 0592cf7..b49da21 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -736,7 +736,8 @@
DWORD DayTimes; //每日次数, 0为不限制
DWORD DayBuyTimes; //每日可购买次数
BYTE BuyTimesPrivilegeID; //购买次数VIP权限ID
- DWORD BuyNeedMoney; //购买次数需要仙玉
+ BYTE MoneyType; //货币类型
+ list BuyNeedMoney; //购买次数需要仙玉
DWORD DayItemAddTimes; //每日可用物品增加次数
DWORD DayItemID; //增加次数的物品ID
BYTE DayResetType; //每日次数重置类型; 0-不重置,1-0点,2-5点
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
index 86b653f..0996b7c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
@@ -628,16 +628,16 @@
return
curFactionCount, othFactionCount = 0, 0
- for callPlayerID, buyRec in buyPlayerInfo.items():
+ for _, buyRec in buyPlayerInfo.items():
if buyRec.factionID == faction:
curFactionCount += 1
else:
othFactionCount += 1
- if playerID in buyRec.callPlayerIDList:
- GameWorld.Log("玩家已经在该召集场次阵营里! zoneID=%s,openHour=%s,openMinute=%s,callPlayerID=%s,callPlayerIDList=%s"
- % (zoneID, openHour, openMinute, callPlayerID, buyRec.callPlayerIDList), playerID)
- return
+# if playerID in buyRec.callPlayerIDList:
+# GameWorld.Log("玩家已经在该召集场次阵营里! zoneID=%s,openHour=%s,openMinute=%s,callPlayerID=%s,callPlayerIDList=%s"
+# % (zoneID, openHour, openMinute, callPlayerID, buyRec.callPlayerIDList), playerID)
+# return
if curFactionCount > othFactionCount:
GameWorld.Log("阵营平衡限制,不可再购买该跨服战场阵营! zoneID=%s,openHour=%s,openMinute=%s,faction=%s,curFactionCount(%s) > othFactionCount(%s)"
@@ -667,6 +667,8 @@
buyRec.callPlayerIDList = [playerID]
buyPlayerInfo[playerID] = buyRec
+ GameWorld.DebugLog("玩家购买开启召集场次! zoneID=%s,openHour=%s,openMinute=%s" % (zoneID, openHour, openMinute), playerID)
+
# 上榜
billboardCallCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboard", 1) # 周召集榜上榜至少次数
groupValue1, dataID, name1, name2 = zoneID, playerID, playerName, ""
@@ -675,6 +677,13 @@
if cmpValue >= billboardCallCountLimit:
CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWCall, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue)
+ for otherBuyPlayerID, otherRec in buyPlayerInfo.items():
+ if otherBuyPlayerID == playerID:
+ continue
+ if playerID in otherRec.callPlayerIDList:
+ otherRec.callPlayerIDList.remove(playerID)
+ GameWorld.DebugLog(" 从已加入的其他召集队伍移除: otherBuyPlayerID=%s,playerID=%s" % (otherBuyPlayerID, playerID), playerID)
+
SyncMapServerCrossBattlefieldBuyInfo()
# 通知子服
@@ -699,6 +708,9 @@
hmNum = GetHMNum(openHour, openMinute)
buyPlayerInfo = GetBuyPlayerInfo(zoneID, hmNum)
+ if tagPlayerID in buyPlayerInfo:
+ GameWorld.ErrLog("玩家已购买该场次召集队伍,无法加入其他召集队伍! hmNum=%s,tagPlayerID=%s in %s" % (hmNum, tagPlayerID, buyPlayerInfo.keys()), playerID)
+ return
if buyPlayerID not in buyPlayerInfo:
GameWorld.ErrLog("跨服战场不存在该玩家的召集队伍! hmNum=%s,buyPlayerID=%s" % (hmNum, buyPlayerID), playerID)
return
@@ -709,9 +721,19 @@
GameWorld.ErrLog("跨服战场召集人数已满! hmNum=%s,buyPlayerID=%s,callPlayerIDList=%s" % (hmNum, buyPlayerID, buyRec.callPlayerIDList), playerID)
return
+ GameWorld.DebugLog("玩家加入召集队伍! zoneID=%s,openHour=%s,openMinute=%s,buyPlayerID=%s,tagPlayerID=%s"
+ % (zoneID, openHour, openMinute, buyPlayerID, tagPlayerID), playerID)
+
if tagPlayerID not in buyRec.callPlayerIDList:
buyRec.callPlayerIDList.append(tagPlayerID)
+ for otherBuyPlayerID, otherRec in buyPlayerInfo.items():
+ if otherBuyPlayerID == buyPlayerID:
+ continue
+ if tagPlayerID in otherRec.callPlayerIDList:
+ otherRec.callPlayerIDList.remove(tagPlayerID)
+ GameWorld.DebugLog(" 从已加入的其他召集队伍移除: otherBuyPlayerID=%s,tagPlayerID=%s" % (otherBuyPlayerID, tagPlayerID), playerID)
+
SyncMapServerCrossBattlefieldBuyInfo()
serverGroupIDList = zoneIpyData.GetServerGroupIDList()
@@ -745,6 +767,9 @@
% (hmNum, buyPlayerID, tagPlayerID, buyRec.callPlayerIDList), playerID)
return
buyRec.callPlayerIDList.remove(tagPlayerID)
+
+ GameWorld.DebugLog("玩家召集队伍踢人! zoneID=%s,openHour=%s,openMinute=%s,buyPlayerID=%s,tagPlayerID=%s"
+ % (zoneID, openHour, openMinute, buyPlayerID, tagPlayerID), playerID)
SyncMapServerCrossBattlefieldBuyInfo()
@@ -1082,7 +1107,7 @@
openMinute = clientData.Minute
tagPlayerID = clientData.TagPlayerID
buyPlayerID = playerID
-
+ GameWorld.DebugLog("召集场次踢人: tagPlayerID=%s,openHour=%s,openMinute=%s" % (tagPlayerID, openHour, openMinute), playerID)
if buyPlayerID == tagPlayerID:
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 066fd08..66a9f49 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -609,7 +609,8 @@
("DWORD", "DayTimes", 0),
("DWORD", "DayBuyTimes", 0),
("BYTE", "BuyTimesPrivilegeID", 0),
- ("DWORD", "BuyNeedMoney", 0),
+ ("BYTE", "MoneyType", 0),
+ ("list", "BuyNeedMoney", 0),
("DWORD", "DayItemAddTimes", 0),
("DWORD", "DayItemID", 0),
("BYTE", "DayResetType", 0),
@@ -3159,7 +3160,8 @@
self.DayTimes = 0
self.DayBuyTimes = 0
self.BuyTimesPrivilegeID = 0
- self.BuyNeedMoney = 0
+ self.MoneyType = 0
+ self.BuyNeedMoney = []
self.DayItemAddTimes = 0
self.DayItemID = 0
self.DayResetType = 0
@@ -3173,6 +3175,7 @@
def GetDayTimes(self): return self.DayTimes # 每日次数, 0为不限制
def GetDayBuyTimes(self): return self.DayBuyTimes # 每日可购买次数
def GetBuyTimesPrivilegeID(self): return self.BuyTimesPrivilegeID # 购买次数VIP权限ID
+ def GetMoneyType(self): return self.MoneyType # 货币类型
def GetBuyNeedMoney(self): return self.BuyNeedMoney # 购买次数需要仙玉
def GetDayItemAddTimes(self): return self.DayItemAddTimes # 每日可用物品增加次数
def GetDayItemID(self): return self.DayItemID # 增加次数的物品ID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
index 419d510..4c36b38 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -593,13 +593,16 @@
buyTimesPrivilegeID = ipyData.GetBuyTimesPrivilegeID()
vipBuyCountEx = PlayerVip.GetPrivilegeValue(curPlayer, buyTimesPrivilegeID)
dayBuyTimesLimit += vipBuyCountEx
- buyNeedMoney = ipyData.GetBuyNeedMoney()
- if not dayBuyTimesLimit or not buyNeedMoney:
+ moneyType = ipyData.GetMoneyType()
+ buyNeedMoneyList = ipyData.GetBuyNeedMoney()
+ if not dayBuyTimesLimit or not buyNeedMoneyList:
+ GameWorld.DebugLog("无法购买! dayBuyTimesLimit=%s,buyNeedMoneyList=%s" % (dayBuyTimesLimit, buyNeedMoneyList))
return
if curDayBuyTimes >= dayBuyTimesLimit:
GameWorld.DebugLog('今日购买次数已达上限,不可增加!')
return
- if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, buyNeedMoney, ChConfig.Def_Cost_BuyDailyActionCnt, {'dailyID':dailyID, 'curDayBuyTimes':curDayBuyTimes}):
+ buyNeedMoney = buyNeedMoneyList[curDayBuyTimes] if len(buyNeedMoneyList) > curDayBuyTimes else buyNeedMoneyList[-1]
+ if not PlayerControl.PayMoney(curPlayer, moneyType, buyNeedMoney, ChConfig.Def_Cost_BuyDailyActionCnt, {'dailyID':dailyID, 'curDayBuyTimes':curDayBuyTimes}):
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID, curDayBuyTimes + 1)
--
Gitblit v1.8.0