From 2a54477d35896bd3f1bd6f48e222a438034a11b9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 27 十二月 2021 12:28:44 +0800
Subject: [PATCH] 5323 【主干】【后端】法器自动培养问题(自动购买支持按指定的商城表商品标识ID购买)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py | 11 +++++++++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFaQi.py | 3 ++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index ddcfb1c..1baa9a2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -531,9 +531,11 @@
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_DelPackIndex, int(itemIndexs))
return
-def PayAutoBuyItem(curPlayer, lackItemDict, priceType, costType=ChConfig.Def_Cost_Unknown, infoDict={}, isCheck=False):
+def PayAutoBuyItem(curPlayer, lackItemDict, priceType, costType=ChConfig.Def_Cost_Unknown, infoDict={}, isCheck=False, shopItemIndexDict=None):
''' 支付自动购买物品消耗,从商城中购买,直接扣钱,不产生物品
一般用于基础商店自动购买物品,不考虑复杂的限购逻辑
+ @param isCheck: 是否只是检查,不执行实际消耗逻辑
+ @param shopItemIndexDict: 指定购买的商品对应商城表商品ID索引字典,如果没有指定商品索引,则按消耗的价格类型自动搜索商城表
'''
addLimitCountInfo = {}
@@ -547,12 +549,17 @@
if not curItem:
return
- ipyData = ItemCommon.GetShopItemPriceIpyData(itemID, priceType)
+ if shopItemIndexDict and itemID in shopItemIndexDict:
+ itemIndex = shopItemIndexDict[itemID]
+ ipyData = IpyGameDataPY.GetIpyGameData("Store", itemIndex)
+ else:
+ ipyData = ItemCommon.GetShopItemPriceIpyData(itemID, priceType)
if not ipyData:
return
itemIndex = ipyData.GetID()
shopType = ipyData.GetShopType()
+ priceType = ipyData.GetMoneyType()
itemMoney = ipyData.GetMoneyNum()
limitCntList = ipyData.GetLimitCnt()
if limitCntList:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFaQi.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFaQi.py
index 4512d92..5e93428 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFaQi.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFaQi.py
@@ -73,6 +73,7 @@
return
costItemID = IpyGameDataPY.GetFuncCfg("FaQiUpItem", 1)
+ autoBuyShopIndex = IpyGameDataPY.GetFuncCfg("FaQiUpItem", 2)
if not costItemID or not costItemCount:
return
@@ -87,7 +88,7 @@
if lackCnt > 0:
autoBuyMoneyType = IPY_GameWorld.TYPE_Price_Gold_Money
infoDict = {ChConfig.Def_Cost_Reason_SonKey:costItemID}
- if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {costItemID:lackCnt}, autoBuyMoneyType, ChConfig.Def_Cost_FaQi, infoDict):
+ if not FunctionNPCCommon.PayAutoBuyItem(curPlayer, {costItemID:lackCnt}, autoBuyMoneyType, ChConfig.Def_Cost_FaQi, infoDict, shopItemIndexDict={costItemID:autoBuyShopIndex}):
return
delCnt -= lackCnt
--
Gitblit v1.8.0