#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.Shop
|
#
|
# @todo:ÉÌ³Ç /·»ÊÐ
|
# @author hxp
|
# @date 2025-10-21
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÉÌ³Ç /·»ÊÐ
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2025-10-21 19:00"""
|
#-------------------------------------------------------------------------------
|
|
import ChConfig
|
import IpyGameDataPY
|
import FunctionNPCCommon
|
import PlayerControl
|
import GameWorld
|
|
def OnExec(curPlayer, paramList):
|
if not paramList:
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÉ̵ê: Shop 0")
|
GameWorld.DebugAnswer(curPlayer, "ÉèÖùºÂò: Shop s ÉÌÆ·ID Òѹº´ÎÊý")
|
return
|
|
value = paramList[0]
|
if value == 0:
|
syncRefreshTypeList = []
|
syncIDList = []
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
for i in xrange(ipyDataMgr.GetStoreCount()):
|
shopItem = ipyDataMgr.GetStoreByIndex(i)
|
shopType = shopItem.GetShopType()
|
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopRefreshCnt % shopType):
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopRefreshCnt % shopType, 0)
|
syncRefreshTypeList.append(shopType)
|
if not shopItem.GetLimitCnt():
|
continue
|
shopID = shopItem.GetID()
|
curBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopBuyCnt % shopID)
|
if curBuyCnt <= 0:
|
continue
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopBuyCnt % shopID, 0)
|
syncIDList.append(shopID)
|
if syncIDList:
|
FunctionNPCCommon.SyncShopItemBuyCntInfo(curPlayer, syncIDList)
|
for shopType in syncRefreshTypeList:
|
FunctionNPCCommon.SyncShopRefreshItemInfo(curPlayer, shopType)
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖóɹ¦:%s" % syncIDList)
|
return
|
|
# ÉèÖÃÏÞ¹º
|
if value == "s":
|
shopID = paramList[1] if len(paramList) > 1 else 0
|
buyCnt = paramList[2] if len(paramList) > 2 else 0
|
ipyData = IpyGameDataPY.GetIpyGameData("Store", shopID)
|
if not ipyData:
|
GameWorld.DebugAnswer(curPlayer, "²»´æÔÚ¸ÃÉÌÆ·:%s" % shopID)
|
return
|
if not ipyData.GetLimitCnt():
|
GameWorld.DebugAnswer(curPlayer, "¸ÃÉÌÆ·Ã»ÓÐÏÞ¹º:%s" % shopID)
|
return
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopBuyCnt % shopID, buyCnt)
|
FunctionNPCCommon.SyncShopItemBuyCntInfo(curPlayer, [shopID])
|
GameWorld.DebugAnswer(curPlayer, "ÉÌÆ·ID(%s)ÏÞ¹º:%s" % (shopID, buyCnt))
|
|
return
|
|