From c280ced8be799a899efc78b21cc807d435ab6609 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 10 二月 2026 19:34:03 +0800
Subject: [PATCH] 66 【公会】基础主体-服务端(退出公会时间根据当前是否互通取对应的本服或跨服时间;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyZhenbaoge.py | 97 ++++++++++++++++++++++++++++++++----------------
1 files changed, 64 insertions(+), 33 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyZhenbaoge.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyZhenbaoge.py
index d1704ce..fc26d30 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyZhenbaoge.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyZhenbaoge.py
@@ -20,9 +20,9 @@
import IpyGameDataPY
import NetPackCommon
import ChPyNetSendPack
-import ItemControler
import PlayerControl
import PlayerFamily
+import CrossPlayer
import GameWorld
import DBDataMgr
@@ -165,7 +165,11 @@
updPrice = int(lowestPrice - random.randint(0, 2)) # 之前还未到达最低价,固定最低价+随机0~2
cutPrice = nowPrice - updPrice
else:
- cutPrice = random.randint(1, 2) # 低于最低价格后砍价只能随机1或2
+ randPriceRange = IpyGameDataPY.GetFuncEvalCfg("ZhenbaogeCut", 3)
+ if len(randPriceRange) == 2:
+ cutPrice = random.randint(randPriceRange[0], randPriceRange[1])
+ else:
+ cutPrice = random.randint(1, 2) # 低于最低价格后砍价只能随机1或2
updPrice = nowPrice - cutPrice
GameWorld.DebugLog("珍宝阁砍价计算地板价保护: cutPrice=%s,nowPrice=%s,updPrice=%s" % (cutPrice, nowPrice, updPrice), playerID)
else:
@@ -201,9 +205,37 @@
#};
def OnZhenbaogeOP(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
- opType = clientData.OpType
playerID = curPlayer.GetPlayerID()
- familyID = curPlayer.GetFamilyID()
+ opType = clientData.OpType
+
+ reqDataEx = {}
+ # 砍价
+ if opType == 0:
+ leaveTimeEx = PlayerControl.GetLeaveFamilyTimeEx(curPlayer)
+ cutState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeCut)
+ if cutState and leaveTimeEx:
+ cutCDTimes = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 3) * 60
+ passTimes = PlayerFamily.GetFamilyTime() - leaveTimeEx
+ if passTimes < cutCDTimes:
+ GameWorld.DebugLog("今日已砍价变更仙盟砍价CD中! passTimes=%s < %s" % (passTimes, cutCDTimes), playerID)
+ return
+ reqDataEx["cutState"] = cutState
+ # 购买
+ elif opType == 1:
+ buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy)
+ if buyState:
+ GameWorld.DebugLog("珍宝阁今日已购买!", playerID)
+ return
+ moneyType = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 1)
+ playerMoneyValue = PlayerControl.GetMoney(curPlayer, moneyType)
+ reqDataEx["playerMoneyValue"] = playerMoneyValue
+
+ PlayerFamily.FamilyPyPackForwarding(curPlayer, clientData, tick, "PlayerFamilyZhenbaoge.__OnZhenbaogeOP", True, 20, reqDataEx=reqDataEx)
+ return
+def __OnZhenbaogeOP(crossPlayer, clientData, tick, fromServerID=0, reqDataEx=None):
+ opType = clientData.OpType
+ playerID = crossPlayer.GetPlayerID()
+ familyID = crossPlayer.GetFamilyID()
if not familyID:
GameWorld.DebugLog("没有仙盟无法操作珍宝阁!", playerID)
return
@@ -215,35 +247,31 @@
GameWorld.DebugLog("珍宝阁还没有刷新! familyID=%s" % familyID, playerID)
return
+ if not reqDataEx:
+ return
+
# 砍价
if opType == 0:
- leaveTimeEx = PlayerControl.GetLeaveFamilyTimeEx(curPlayer)
- cutState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeCut)
- if cutState and leaveTimeEx:
- cutCDTimes = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 3) * 60
- passTimes = int(time.time()) - leaveTimeEx
- if passTimes < cutCDTimes:
- GameWorld.DebugLog("今日已砍价变更仙盟砍价CD中! passTimes=%s < %s" % (passTimes, cutCDTimes), playerID)
- return
-
+ cutState = reqDataEx["cutState"]
+
cutPrice = CalcCutPrice(curFamily, gActionData, playerID)
if not cutPrice:
return
- AddCutPrice(familyID, playerID, curPlayer.GetName(), cutPrice, gActionData)
- PlayerControl.NotifyCode(curPlayer, "ZhenbaogeCut", [cutPrice])
- if not curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeCut):
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 1)
- Sync_ZhenbaogeInfo(curPlayer)
+ AddCutPrice(familyID, playerID, crossPlayer.GetPlayerName(), cutPrice, gActionData)
+ CrossPlayer.NotifyCode(crossPlayer, "ZhenbaogeCut", [cutPrice])
+ if not cutState:
+ CrossPlayer.SetPlayerNomalDict(crossPlayer, {ChConfig.Def_Player_Dict_FamilyZhenbaogeCut:1}, True)
+ #Sync_ZhenbaogeInfo(crossPlayer)
# 购买
elif opType == 1:
- buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy)
- if buyState:
- GameWorld.DebugLog("珍宝阁今日已购买!", playerID)
- return
+ #buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy)
+ #if buyState:
+ # GameWorld.DebugLog("珍宝阁今日已购买!", playerID)
+ # return
moneyType = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 1)
- playerMoneyValue = PlayerControl.GetMoney(curPlayer, moneyType)
+ playerMoneyValue = reqDataEx["playerMoneyValue"]
actionData = GetZhenbaogeActionData(familyID, playerID)
if not actionData:
@@ -265,22 +293,25 @@
SetFABuyState(actionData, 1)
PlayerFamily.SendFamilyAction(actionData)
+ moneyDict = {moneyType:0} # 奖励货币
if nowPrice > 0:
- if not PlayerControl.PayMoney(curPlayer, moneyType, nowPrice, "Zhenbaoge"):
- GameWorld.ErrLog("珍宝阁购买货币不足! nowPrice=%s" % nowPrice, playerID)
- return
+ CrossPlayer.CostPlayerResources(crossPlayer, "Zhenbaoge", {moneyType:nowPrice})
elif nowPrice < 0:
- PlayerControl.GiveMoney(curPlayer, moneyType, -nowPrice, "Zhenbaoge")
+ moneyDict[moneyType] = -nowPrice
else: # 0不处理
pass
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 1)
- Sync_ZhenbaogeInfo(curPlayer)
+ CrossPlayer.SetPlayerNomalDict(crossPlayer, {ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy:1}, True)
+ #Sync_ZhenbaogeInfo(curPlayer)
- if giveItemList:
- ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, event=["Zhenbaoge", False, {}], isNotifyAward=False)
- ItemControler.NotifyGiveAwardInfo(curPlayer, giveItemList, "Zhenbaoge", moneyInfo={moneyType:0 if nowPrice > 0 else -nowPrice})
-
+ CrossPlayer.GivePlayerResources(crossPlayer, giveItemList, moneyDict, eventName="Zhenbaoge")
+
+ return True
+
+def __OnZhenbaogeOP_Ret(curPlayer, clientData, isOK):
+ if not isOK:
+ return
+ Sync_ZhenbaogeInfo(curPlayer)
return
def Sync_ZhenbaogeInfo(curPlayer):
--
Gitblit v1.8.0