hxp
5 天以前 26958aff1b844a743a805b4f9075bee800b72a46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/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