From b4b72d0c241ffc26dbbbd7a047578f1f4fead2f4 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 09 十二月 2021 16:11:53 +0800
Subject: [PATCH] 9341 【BT5】【主干】【后端】情缘系统(Couple命令增加添加喜糖宴会;修复多个喜糖宴会同时存在时吃喜糖同步错误bug)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py | 45 ++++++++++++++++++++++++++++++++++++++++++++-
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py | 10 +++++++++-
2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py
index 1c90637..7d042ca 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Couple.py
@@ -29,6 +29,7 @@
GameWorld.DebugAnswer(curPlayer, "设置成亲: Couple 1 伴侣ID [可选聘礼ID]")
GameWorld.DebugAnswer(curPlayer, "设亲密度: Couple 2 目标ID 亲密度")
GameWorld.DebugAnswer(curPlayer, "增加密度: Couple 3 目标ID 亲密度")
+ GameWorld.DebugAnswer(curPlayer, "添加喜宴: Couple 4 聘礼ID 宴会个数")
return
#逻辑实现
@@ -118,7 +119,14 @@
PyDataManager.GetIntimacyManager().AddIntimacyBoth(playerID, tagPlayerID, addValue)
intimacys = PyDataManager.GetIntimacyManager().GetIntimacys(playerID)
if intimacys:
- GameWorld.DebugAnswer(curPlayer, "更新目标【%s】亲密度: %s" % (tagPlayerID, intimacys.GetTagIntimacy(tagPlayerID)))
+ GameWorld.DebugAnswer(curPlayer, "更新目标【%s】亲密度: %s" % (tagPlayerID, intimacys.GetTagIntimacy(tagPlayerID)))
+
+ # 增加亲密度
+ elif value1 == 4:
+ bridePriceID = gmList[1] if len(gmList) > 1 else 1
+ addCount = gmList[2] if len(gmList) > 2 else 1
+ addCount = PlayerLove.GMAddCandy(curPlayer, bridePriceID, addCount)
+ GameWorld.DebugAnswer(curPlayer, "添加喜宴数:%s" % addCount)
else:
__Help(curPlayer)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
index 395be4e..019ac6e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerLove.py
@@ -582,6 +582,45 @@
PyGameData.g_marryReqInfo.pop(playerID, None) # 可能存在相互提亲的情况,尝试顺便把自身的提亲请求删除,因为已经无用了
return True
+def GMAddCandy(curPlayer, bridePriceID, addCount):
+ ## GM添加测试喜糖宴会
+ fakeID = 0
+ for playerIDA, playerIDB in PyGameData.g_marryCandyInfo.keys():
+ if playerIDA < 10000:
+ fakeID = max(playerIDA, fakeID)
+ if playerIDB < 10000:
+ fakeID = max(playerIDB, fakeID)
+
+ ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID)
+ if not ipyData:
+ return 0
+ prosperity = ipyData.GetProsperity()
+ candyTimes = ipyData.GetCandyTimes()
+
+ syncCandyList = []
+ curTime = int(time.time())
+ for _ in xrange(addCount):
+ playerIDA = fakeID + 1
+ playerIDB = fakeID + 2
+ fakeID = playerIDB
+
+ candyObj = MarryCandy()
+ candyObj.playerIDA = playerIDA
+ candyObj.playerNameA = PlayerSocial.GetSocialPlayerName(playerIDA)
+ candyObj.playerIDB = playerIDB
+ candyObj.playerNameB = PlayerSocial.GetSocialPlayerName(playerIDB)
+ candyObj.bridePriceID = bridePriceID
+ candyObj.marryTime = curTime
+ candyObj.endTime = curTime + candyTimes
+ AddProsperity(candyObj, prosperity)
+
+ PyGameData.g_marryCandyInfo[(playerIDA, playerIDB)] = candyObj
+ syncCandyList.append(candyObj)
+
+ __SortCandy()
+ Sync_CandyList(None, syncCandyList)
+ return addCount
+
def __SortCandy():
PyGameData.g_marryCandySortList = PyGameData.g_marryCandyInfo.values()
PyGameData.g_marryCandySortList.sort(key=operator.attrgetter("endTime"))
@@ -1116,7 +1155,7 @@
clientPack = ChPyNetSendPack.tagGCCandyList()
clientPack.CandyInfoList = []
- for candyObj in PyGameData.g_marryCandySortList:
+ for candyObj in syncCandyList:
candyInfo = ChPyNetSendPack.tagGCCandyInfo()
candyInfo.PlayerIDA = candyObj.playerIDA
candyInfo.PlayerNameA = candyObj.playerNameA
@@ -1147,6 +1186,10 @@
continue
for candyInfo in clientPack.CandyInfoList:
+ coupleIDInfo = (candyInfo.PlayerIDA, candyInfo.PlayerIDB)
+ if coupleIDInfo not in PyGameData.g_marryCandyInfo:
+ continue
+ candyObj = PyGameData.g_marryCandyInfo[coupleIDInfo]
candyInfo.FireworksPlayerBuyCount = candyObj.fireworksCountDict.get(curPlayer.GetPlayerID(), 0)
candyInfo.PlayerFreeEatCandyCount = candyObj.playerFreeEatCountDict.get(curPlayer.GetPlayerID(), 0)
--
Gitblit v1.8.0