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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package PlayerSuperMarket
#
# @todo: É̳ÇÏà¹Ø
# @author Alee
# @date 2010-12-22 18:00
# @version 4.1
#
# ÏêϸÃèÊö: É̳ÇÏà¹Ø£¬É̳Ƿâ°üÔÚÕâ±ß´¦Àí
# @change: "2010-12-24 18:00" Alee Ìí¼ÓÌùÐĻ¹¦ÄÜ
# @change: "2010-12-28 17:40" Alee Ìí¼Ó±íÑéÖ¤±ÜÃâË¢ÎïÆ·
# @change: "2010-12-29 11:40" Alee Ìí¼Ó¹ºÂòÉ̳ǹºÂòÎïÆ·²»»¨Ç®ºÍ²»ÊǻÌùÐĸ£´üÑéÖ¤
# @change: "2010-12-29 13:50" Alee Ìí¼ÓÁìÈ¡ÎïÆ·¸öÊý
# @change: "2011-01-31 17:30" Alee É̳ǹºÂò¼Ò×åÑéÖ¤£¬±ÜÃâ·¢°ü
 
# @change: "2011-02-16 11:30" Alee Ìí¼ÓÌùÐÄÏàӦϵͳÌáʾ
# @change: "2011-02-21 09:30" Alee ÐÞ¸ÄÉ̳ǹºÂò±³°ü²»×ãµÄÌáʾ
# @change: "2011-02-22 11:30" panwei °Î³ý̨Íå´ó½Ïà¹Ø°æ±¾Çл»´úÂë
# @change: "2011-04-07 14:30" panwei PsycoÓÅ»¯
# @change: "2011-04-27 11:00" Alee Íæ¼ÒÊý¾ÝÁ÷Ïò¼Ç¼
 
# @change: "2011-05-03 14:20" chenxuewei ÏµÍ³ÌáʾÉÙ´«ÁËÒ»¸ö²ÎÊý
# @change: "2011-05-06 15:20" Alee Íæ¼Ò±£Ö¤µã³¬¹ý100¸øÌáʾ
# @change: "2011-06-17 11:00" Alee ±£Ö¤µãÔö¼õÁ÷Ïò¼Ç¼
# @change: "2011-08-02 18:00" panwei Ìí¼ÓÍæ¼Ò¼Ò×å»îÔ¾¶ÈÐÂÔöÀ´Ô´
# @change: "2011-09-20 22:30" Alee Á÷ÏòÖв»¿ÉÓû»ÐзûºÅ
# @change: "2011-11-23 14:00" jiang É̳ǹºÎïÌí¼Ó¼Ò×å»îÔ¾¶ÈϵͳÌáʾ
# @change: "2012-01-16 17:30" chengaobao ½«ÎïÆ·È¥³ý°ó¶¨
# @change: "2012-01-21 12:30" chengaobao ½«ÉèÖð󶨵Ľӿڷâ×°ÖÁItemControlerÖÐ
# @change: "2012-03-24 19:30" wdb µãȯ¶Ò»»Ôª±¦ÐÞ¸Ä
# @change: "2012-04-12 16:30" jiang È¥³ýÔª±¦Ïû·ÑÔö¼Ó»îÔ¾¶È¸ÄÖÁ¸¶¿î³É¹¦ÒÔºóͳһ²Ù×÷
# @change: "2012-06-26 18:00" jiang ²¹Æëoss¼Ç¼
# @change: "2012-06-27 15:30" whx Ôö¼ÓsetCount´íÎóoss¼Ç¼
# @change: "2012-08-10 15:00" zhangxi ÐÞ¸ÄOSS¼Ç¼
# @change: "2013-12-09 11:30" hxp ÏµÍ³Ìáʾ
# @change: "2014-01-08 13:20" hxp Ôö¼ÓÉ̳ǹºÎï×êʯ¼Æ·Ñµãʼþͬ²½£¬ÔÚPayMoneyÄڲ㴦Àí
# @change: "2014-05-06 16:40" xcc Ôö¼ÓÉ̳ÇÎïÆ·¹ºÂò
# @change: "2014-08-06 14:00" hxp Ôö¼Ó¹ºÂòÉ̳ÇÎïÆ·Ê±¿ÉÅäÖÃÈ«·þ¹ã²¥¹ºÂòÐÅÏ¢
# @change: "2014-10-17 14:20" Alee ²éѯµãȯ±ØÐëÔÚ½øÈëµØÍ¼Ö®ºó±ÜÃâÂß¼­Ë³Ðò´íÎó
# @change: "2014-12-17 12:10" ljd Ôö¼ÓVIPÉ̳ÇVIPµÈ¼¶ÏÞÖÆ
# @change: "2016-07-20 14:30" hxp Ïû·ÑµãÁ÷ÏòÕûÀí
# @change: "2016-10-08 16:30" hxp ÐÞ¸ÄÉ̳ÇÎïÆ·¼Û¸ñ»ñÈ¡·½Ê½£¬·½±ãÆäËû¹¦ÄÜ»ñÈ¡¼Û¸ñ
#---------------------------------------------------------------------
#"""Version = 2016-10-08 16:30"""
#---------------------------------------------------------------------
#µ¼Èë
import GameWorld
import IPY_GameWorld
import ChConfig
import PlayerControl
import ItemControler
import ItemCommon
import QuestCommon
import ShareDefine
import ReadChConfig
import PlayerActivity
import DataRecordPack
  
#===============================================================================
# //03 17 ²é¿´É̳ÇÎïÆ·
# struct    tagCWatchStoreItem
# {
#    BYTE        AreaIndex;   ÇøÓò£¨1£º½ð×Ó 2£ºÒø×Ó£©
#    BYTE        MenuIndex;    ²Ëµ¥
#    BYTE        TypeIndex;    ·ÖÀàIndex(>0)
#    BYTE        PageIndex;    Ò³Ãæ
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 17 ²é¿´É̳ÇÎïÆ·
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 17 ²é¿´É̳ÇÎïÆ·
def WatchStoreItem(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
    if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_WatchStoreInfo) \
            <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_WatchStoreInfo]:
        #²é¿´É̳ÇÏÞÖÆ¼ä¸ô0.5Ã룬²»¸øÌáʾ£¬±ÜÃâ¹¥»÷·þÎñÆ÷
        return
    
    curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_WatchStoreInfo, tick)
    
    #»ñµÃ²é¿´É̳Ƿâ°ü
    sendPack = IPY_GameWorld.IPY_CWatchStoreItem()
    areaIndex = sendPack.GetAreaIndex()            # ÇøÓò
    menuIndex = sendPack.GetMenuIndex()            # ²Ëµ¥
    typeIndex = sendPack.GetTypeIndex()            # ·ÖÀàË÷Òý
    pageIndex = sendPack.GetPageIndex()            # Ò³Ãæ
#    GameWorld.Log('É̳ǣº%s,%s,%s,%s'%(areaIndex, menuIndex, typeIndex, pageIndex))
    #»Ø°ü¸ø¿Í»§¶Ë
    curPlayer.Sync_StoreItem(areaIndex, menuIndex, typeIndex, pageIndex)
    
#===============================================================================
# 03 18 ¹ºÂòÉ̳ÇÎïÆ·
# struct  tagCBuyStoreItem
# {
#    BYTE        AreaIndex;   ÇøÓò£¨1£º½ð×Ó 2£ºÒø×Ó£©
#    BYTE        MenuIndex;    ²Ëµ¥
#    BYTE        TypeIndex;    ·ÖÀàIndex(>0)
#    BYTE        PageIndex;    Ò³Ãæ
#    BYTE        ItemInPage;   Õâ¸öÎïÆ·ÔÚÄÄÒ»Ò³
#    WORD        Count;        ÊýÁ¿
# }
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ 03 18 ¹ºÂòÉ̳ÇÎïÆ·
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ 03 18 ¹ºÂòÉ̳ÇÎïÆ·
def BuyStoreItem(index, tick):
    #GameWorld.GetPsycoFunc(__Func_BuyStoreItem)(index, tick)
    return
 
##¿Í»§¶Ë·â°üÏìÓ¦ 03 18 ¹ºÂòÉ̳ÇÎïÆ·
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ 03 18 ¹ºÂòÉ̳ÇÎïÆ·
def __Func_BuyStoreItem(index, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    
#    #½»Ò×µÈʼþÖÐÎÞ·¨Ê¹ÓÃ
#    if not FunctionNPCCommon.CheckPlayerCanStateEvent(curPlayer):
#        return
#    if ItemControler.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem) < 1:
#        #Task_WinLost_RoomLack02 ÄúµÄ±³°ü¿Õ¼ä²»×ã,ÇëÕûÀí±³°üºóÔÙÀ´
#        PlayerControl.NotifyCode(curPlayer , "Task_WinLost_RoomLack02")
#        return
 
    #½»Ò×µÈʼþÖÐÎÞ·¨Ê¹ÓÃ
    if curPlayer.GetPlayerAction() not in  ChConfig.Def_PlayerState_Store:
        #GeRen_admin_306641 ¶Ô²»Æð£¬Äúµ±Ç°×´Ì¬ÎÞ·¨½øÐд˲Ù×÷£¬²Ù×÷ÎÞЧ
        PlayerControl.NotifyCode(curPlayer, "GeRen_admin_306641")
        return
    
    sendPack = IPY_GameWorld.IPY_CBuyStoreItem()
    areaIndex = sendPack.GetAreaIndex()            # ÇøÓò
    menuIndex = sendPack.GetMenuIndex()            # ²Ëµ¥
    typeIndex = sendPack.GetTypeIndex()            # ·ÖÀàË÷Òý
    pageIndex = sendPack.GetPageIndex()            # Ò³Ãæ
    itemInPage = sendPack.GetItemInPage()          # ÎïÆ·±¾Ò³ÃæË÷Òý
    itemCount = sendPack.GetCount()                # ¹ºÂòÊýÁ¿
    
    #É̳DZíÊý¾Ý
    buyStoreItem = GameWorld.GetGameData().FindDBStoreItem(areaIndex, menuIndex, 
                                                           typeIndex, pageIndex, itemInPage)
    if not buyStoreItem:
        GameWorld.ErrLog("ûÓÐÊý¾Ý¹ºÂòÎïÆ·Ê§°Ü£¬ÇøÓò %s ²Ëµ¥ %s ·ÖÀà %s Ò³Ãæ %s Ò³Êý %s ÊýÁ¿ %s"%(
                areaIndex, menuIndex, typeIndex, pageIndex, itemInPage, itemCount),
                curPlayer.GetID())
        return
    
    isBind = False
    storeItemPrice = 0    # ÏúÊÛ×ܶî
    priceType = 0         # »õ±ÒÀàÐÍ
    
    #Ôª±¦£¬ÀñȯʹÓüǼ
    useGold = 0
    useGoldPaper = 0
    
    costGold = buyStoreItem.GetGold()     # µ¥¼ÛÔª±¦
    costGoldPaper = buyStoreItem.GetGoldPaper()    # µ¥¼ÛÀñȯ
    itemIDByBuy = buyStoreItem.GetItemID()
    
    #ÅжÏÖ§¸¶ÀàÐͺͽð¶î
    if costGold > 0:
        storeItemPrice = costGold*itemCount
        priceType = IPY_GameWorld.TYPE_Price_Gold_Money
        useGold = storeItemPrice
 
    #Àñȯ
    elif costGoldPaper > 0:
        storeItemPrice = costGoldPaper*itemCount
        priceType = IPY_GameWorld.TYPE_Price_Gold_Paper
        useGoldPaper = storeItemPrice
    
    else:
        GameWorld.ErrLog("É̳ÇÃâ·ÑÎïÆ· %s"%itemIDByBuy)
        return
 
#    #Òø×Ó
#    elif buyStoreItem.GetSilver():
#        storeItemPrice = buyStoreItem.GetSilver()*itemCount
#        priceType = IPY_GameWorld.TYPE_Price_Silver_Money
#
#    #񿮱
#    elif buyStoreItem.GetSilverPaper():
#        storeItemPrice = buyStoreItem.GetSilverPaper()*itemCount
#        priceType = IPY_GameWorld.TYPE_Price_Silver_Paper
 
    if storeItemPrice == 0 or priceType == 0:
        GameWorld.ErrLog('É̳ǹºÂòÎïÆ·Òì³£, Ôª±¦ºÍÀñȯÎÞ·¨¹ºÂò = %s'%(itemIDByBuy))
        return
    
    #¼Ç¼¹ºÂòʱ¼ä
    timeStr = GameWorld.GetCurrentDataTimeStr()
    
    #ÅжÏÓÐûǮ,ÔÙ´´½¨ÎïÆ·
    if not PlayerControl.HaveMoney(curPlayer, priceType, storeItemPrice):
        #½ðÇ®²»×ãµÄ¼Ç¼
        curPlayer.Sync_StoreItemRecord(timeStr, itemIDByBuy, 0, 0, 0, 'GoldShop_Shoping_MoneyLost')
        return
       
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        isBind = True
        
    itemControler = ItemControler.PlayerItemControler(curPlayer)
    
    #ÊÇ·ñ¿ÉÒÔ·ÅÈë±³°ü
    if itemControler.CanPutInItem(IPY_GameWorld.rptItem, itemIDByBuy, itemCount, isBind) != True:
        PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_202580")
        #±³°ü²»×ãµÄ¼Ç¼
        curPlayer.Sync_StoreItemRecord(timeStr, itemIDByBuy, 0, 0, 0, 'GoldShop_Shoping_BagLost')
        return
        
    #Éú³ÉÎïÆ·
    curItemTag = ItemCommon.CreateSingleItem(itemIDByBuy)
    
    if not curItemTag:
        GameWorld.ErrLog('É̳Ǵ´½¨ÎïÆ·Òì³££º%s'%(itemIDByBuy))
        return
    
    infoDict = {"ItemID":itemIDByBuy, "ItemCount":itemCount, ChConfig.Def_Cost_Reason_SonKey:itemIDByBuy}
    if not PlayerControl.PayMoney(curPlayer, priceType, storeItemPrice, ChConfig.Def_Cost_BuyStoreItem, infoDict, itemCount):
        return
    
    #Ìí¼Ó¼Ò×å»îÔ¾¶È
    addFamilyValue = SMShoppingByGoldAddFamilyVale(curPlayer, priceType, storeItemPrice)
    
    ItemControler.SetItemCount(curItemTag, itemCount, 
                               curPlayer.GetPlayerID(), curPlayer.GetAccID(), curPlayer.GetPlayerName())
            
#    GameWorld.Log('°ó¶¨£º%s ¸¶·ÑÀàÐÍ(½ð×Ó1Òø×Ó3)£º%s  ½ð¶î£º%s'%(
#    curItemTag.GetIsBind(), priceType, storeItemPrice))
    
    PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [itemIDByBuy, itemCount])
    
    # ¼ÇÂ¼Íæ¼ÒÉ̳ǹºÂòÎïÆ·
    DataRecordPack.DR_PlayerSupermarket(curPlayer, itemIDByBuy, itemCount, curItemTag.GetGUID())
    #мÓÏêϸ¼Ç¼
    curPlayer.Interface_GoldRec(itemIDByBuy, itemCount, curItemTag.GetName(), useGold, useGoldPaper)
    
    #·ÅÈë±³°ü
    itemControler.PutInItem(IPY_GameWorld.rptItem, curItemTag)
 
    #É̳ǽ»Ò׼Ǽ
    NoteLargeTrade(curPlayer, priceType, storeItemPrice, itemIDByBuy, itemCount)
    
    #¹ºÂò³É¹¦µÄ¼Ç¼
    curPlayer.Sync_StoreItemRecord(timeStr, itemIDByBuy, itemCount, priceType, 
                                   storeItemPrice, 'GoldShop_Shoping_Success')
    return
 
def GetStoreItemInfo(itemID):
    storeItemDict = ReadChConfig.GetEvalChConfig("StoreItem")
    if itemID not in storeItemDict:
        GameWorld.ErrLog("δÅäÖÃÉ̳ÇÎïÆ·¼Û¸ñÐÅÏ¢, itemID=%s" % itemID)
        return
    return storeItemDict[itemID]
 
def GetStoreItemPrice(itemID, priceType):
    ''' »ñÈ¡É̳ÇÎïÆ·¶ÔÓ¦¼Û¸ñ '''
    
    itemPriceInfo = GetStoreItemInfo(itemID)
    if not itemPriceInfo:
        return 0
    
    priceKeyDict = {
                    IPY_GameWorld.TYPE_Price_Gold_Money:"Gold",
                    IPY_GameWorld.TYPE_Price_Gold_Paper:"GoldPaper",
                    IPY_GameWorld.TYPE_Price_Silver_Money:"Silver",
                    IPY_GameWorld.TYPE_Price_Silver_Paper:"SilverPaper",
                    }
    
    if priceType not in priceKeyDict:
        GameWorld.ErrLog("δÅäÖÃÉ̳ÇÎïÆ·¼Û¸ñÐÅÏ¢, itemID=%s,»õ±ÒÀàÐÍ=%s" % (itemID, priceType))
        return 0
    
    keyName = priceKeyDict[priceType]
    price = itemPriceInfo.get(keyName, 0)
    if price in [0, -1]:
        return 0
    
    return price
 
##¿Í»§¶Ë·â°üÏìÓ¦A5 32 ¹ºÂòÉ̳ÇÎïÆ· #tagCMBuyStoreItem
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ 03 18 ¹ºÂòÉ̳ÇÎïÆ·
def OnBuyStoreItem(index, clientData, tick):
#    GameWorld.Log("OnBuyStoreItem")
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    #½»Ò×µÈʼþÖÐÎÞ·¨Ê¹ÓÃ
    if curPlayer.GetPlayerAction() not in  ChConfig.Def_PlayerState_Store:
        #GeRen_admin_306641 ¶Ô²»Æð£¬Äúµ±Ç°×´Ì¬ÎÞ·¨½øÐд˲Ù×÷£¬²Ù×÷ÎÞЧ
        PlayerControl.NotifyCode(curPlayer, "GeRen_admin_306641")
        return
    
    priceType = clientData.Type  #¹ºÂòµÄÀàÐÍ,1½ð×Ó£¬2½ðƱ£¬3Òø×Ó£¬4񿮱
    itemID = clientData.ItemID #¹ºÂòµÄÎïÆ·ID
    buyCnt = clientData.BuyCount #¹ºÂòµÄÎïÆ·ÊýÁ¿
#    GameWorld.Log("buyType=%s itemID=%s buyCnt=%s"%(buyType, itemID, buyCnt))
    
    storeItemInfo = GetStoreItemInfo(itemID)
    #ûÓÐÕÒµ½Õâ¸öÎïÆ·ID
    if None == storeItemInfo:
#        GameWorld.Log("#ûÓÐÕÒµ½Õâ¸öÎïÆ·ID")
        return
    vipLVLimit = storeItemInfo.get("VIPLVLimit")
    if vipLVLimit and curPlayer.GetVIPLv() < vipLVLimit:
        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_360882", [vipLVLimit])
        return
    
    itemCost = GetStoreItemPrice(itemID, priceType)
    #¸ÃÎïÆ·Ã»Óеļ۸ñÐÅÏ¢,0ºÍ-1ÎÒÃǶ¼µ±×öûÓм۸ñÐÅÏ¢
    if itemCost in [0, -1]:
#        GameWorld.Log("#¸ÃÎïÆ·Ã»Óеļ۸ñÐÅÏ¢,0ºÍ-1ÎÒÃǶ¼µ±×öûÓм۸ñÐÅÏ¢")
        return
    
    #¹²ÐèÒªÖ§¸¶¶àÉÙÇ®
    storeItemPrice = itemCost * buyCnt
    if storeItemPrice <= 0:
#        GameWorld.Log("#storeItemPrice <= 0")
        return
    
    #Ôª±¦£¬ÀñȯʹÓüǼ
    useGold = 0
    useGoldPaper = 0
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money:
        useGold = storeItemPrice
    elif priceType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        useGoldPaper = storeItemPrice
    
    #¼Ç¼¹ºÂòʱ¼ä
    timeStr = GameWorld.GetCurrentDataTimeStr()
    #ÅжÏÓÐûǮ,ÔÙ´´½¨ÎïÆ·
    if not PlayerControl.HaveMoney(curPlayer, priceType, storeItemPrice):
        #½ðÇ®²»×ãµÄ¼Ç¼
        curPlayer.Sync_StoreItemRecord(timeStr, itemID, 0, 0, 0, 'GoldShop_Shoping_MoneyLost')
        return
    isBind = False
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Paper:
        isBind = True
        
    itemControler = ItemControler.PlayerItemControler(curPlayer)
    
    #ÊÇ·ñ¿ÉÒÔ·ÅÈë±³°ü
    if itemControler.CanPutInItem(IPY_GameWorld.rptItem, itemID, buyCnt, isBind) != True:
        PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_202580")
        #±³°ü²»×ãµÄ¼Ç¼
        curPlayer.Sync_StoreItemRecord(timeStr, itemID, 0, 0, 0, 'GoldShop_Shoping_BagLost')
        return
        
    #Éú³ÉÎïÆ·
    curItemTag = ItemCommon.CreateSingleItem(itemID)
    
    if not curItemTag:
        GameWorld.ErrLog('É̳Ǵ´½¨ÎïÆ·Òì³££º%s'%(itemID))
        return
    
    infoDict = {"ItemID":itemID, "ItemCount":buyCnt, ChConfig.Def_Cost_Reason_SonKey:itemID}
    if not PlayerControl.PayMoney(curPlayer, priceType, storeItemPrice, ChConfig.Def_Cost_BuyStoreItem, infoDict, buyCnt):
        return
    
    #Ìí¼Ó¼Ò×å»îÔ¾¶È
    addFamilyValue = SMShoppingByGoldAddFamilyVale(curPlayer, priceType, storeItemPrice)
    
#    if useGold:
#        PlayerActivity.AddActivityFinishCnt(curPlayer, ShareDefine.ActivityNum_SuperMarketGold)
    
    ItemControler.SetItemCount(curItemTag, buyCnt, curPlayer.GetPlayerID(), curPlayer.GetAccID(), curPlayer.GetPlayerName())
    itemName = curItemTag.GetName()
    GUID = curItemTag.GetGUID()
    
    if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItemTag):
        GameWorld.ErrLog("¹ºÂòÉ̳ÇÎïÆ··ÅÈë±³°üÒì³£: itemID=%s,buyCnt=%s,GUID=%s" % (itemID, buyCnt, GUID))
        return
    
    # È«·þ¹ã²¥
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money:
        playerName = curPlayer.GetPlayerName()
        shopItemBuyNotify = eval(ReadChConfig.GetChConfig('ShopItemBuyNotify'))
        if itemID in shopItemBuyNotify:
            notifyMark, paramList = shopItemBuyNotify[itemID]
            PlayerControl.WorldNotify(0, notifyMark, paramList)
    
    # ¼ÇÂ¼Íæ¼ÒÉ̳ǹºÂòÎïÆ·
    DataRecordPack.DR_PlayerSupermarket(curPlayer, itemID, buyCnt, GUID)
    #мÓÏêϸ¼Ç¼
    curPlayer.Interface_GoldRec(itemID, buyCnt, itemName, useGold, useGoldPaper)
 
    #É̳ǽ»Ò׼Ǽ
    NoteLargeTrade(curPlayer, priceType, storeItemPrice, itemID, buyCnt)
    
    #¹ºÂò³É¹¦µÄ¼Ç¼
    curPlayer.Sync_StoreItemRecord(timeStr, itemID, buyCnt, priceType, 
                                   storeItemPrice, 'GoldShop_Shoping_Success')
    return
   
#---------------------------------------------------------------------
##É̳ǽ»Ò׼Ǽ
#@param curPlayer Íæ¼ÒʵÀý
#@param priceType ½ðÇ®ÀàÐÍ
#@param storeItemPrice ½ð¶î
#@param itemIDByBuy ÎïÆ·ID
#@param itemCount  ÊýÁ¿
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ×Ô¶¨Ò庯Êý, É̳ǽ»Ò׼Ǽ
def NoteLargeTrade(curPlayer, priceType, storeItemPrice, itemIDByBuy, itemCount):
    playerID = curPlayer.GetPlayerID()
    haveGold = curPlayer.GetGold()
    haveSilver = PlayerControl.GetSilver(curPlayer)
    
    #É̳ǽð×Ó¹ºÎï
    if priceType == IPY_GameWorld.TYPE_Price_Gold_Money:
        
        #²»³¬¹ý½ð×Ó50Á½²»¼Ç¼
        if storeItemPrice < ChConfig.Def_LargeTrade_Gold:
            return
        GameWorld.NoteDownLargeTrade(
                                     tradeGold = storeItemPrice, 
                                     tradeItemID = itemIDByBuy, 
                                     tradeItemCount = itemCount, 
                                     receiverID = playerID, 
                                     receiverGold = haveGold, 
                                     receiverSilver = haveSilver
                                     )
    
#    #É̳ÇÒø×Ó¹ºÎï
#    elif priceType == IPY_GameWorld.TYPE_Price_Silver_Money:
#        
#        #²»³¬¹ýÒø×Ó1000Á½²»¼Ç¼
#        if storeItemPrice < ChConfig.Def_LargeTrade_Silver:
#            return 
#
#        GameWorld.NoteDownLargeTrade(tradeSilver = storeItemPrice, 
#                           tradeItemID = itemIDByBuy, tradeItemCount = itemCount, 
#                           receiverID = playerID, receiverGold = haveGold, receiverSilver = haveSilver)
 
 
##É̳ǹºÎïÌí¼Ó¼Ò×å»îÔ¾¶È
#@param curPlayer Íæ¼ÒʵÀý
#@param priceType »õ±ÒÀàÐÍ
#@param priceValue »õ±ÒÖµ
#@return ¼Ò×å»îÔ¾¶ÈÔö¼ÓÖµ
#@remarks É̳ǹºÎïÌí¼Ó¼Ò×å»îÔ¾¶È
def SMShoppingByGoldAddFamilyVale(curPlayer, priceType, priceValue):
    #20102-04-12 jiang ÒÆÖÁ¸¶¿îÒÔºóÌí¼Ó
    return 0
 
#    addFamilyValue = 0  # ¼Ò×å»îÔ¾¶ÈÔö¼ÓÖµ
#    
#    if curPlayer.GetFamilyID() == 0:
#        #ÎÞ¼Ò×å²»¿¼ÂÇ
#        return addFamilyValue
#    
#    #Ö»ÓÐÔª±¦¹ºÂò²ÅÌí¼Ó¼Ò×å»îÔ¾¶È
#    if priceType != IPY_GameWorld.TYPE_Price_Gold_Money:
#        return addFamilyValue
#    
#    addFamilyValue = int(eval(ReadChConfig.GetChConfig('SM_FamilyActiveValue')))
#        
#    #Ìí¼Ó¼Ò×å»îÔ¾¶È
#    PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addFamilyValue, True, PlayerFamily.Def_AddFAVReason_GoldShop)
#    PlayerControl.NotifyCode(curPlayer, "GeRen_admin_425673", [addFamilyValue])
#    
#    return addFamilyValue
    
    
#---------------------------------------------------------------------
#===============================================================================
# //01 0F È¡µÃµãȯÊýÄ¿#tagCGetCoin
# tagCGetCoin       *   GettagCGetCoin();
# class   IPY_CGetCoin
# {
# public:
#    //ÎÞÒâÒå
#    int      GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //01 0F È¡µÃµãȯÊýÄ¿#tagCGetCoin
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //01 0F È¡µÃµãȯÊýÄ¿#tagCGetCoin
def GetCoinReq(index, tick):
    #===========================================================================
    # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    # 
    # if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_QueryCoinCount) \
    #        <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_QueryCoinCount]:
    #    #²éÑ¯Íæ¼ÒµãȯÊýÄ¿30ÃëÒ»´Î
    #    return
    # 
    # if not curPlayer.GetMapLoadOK():
    #    return
    # 
    # curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_QueryCoinCount, tick)
    # #²éѯµ±Ç°Íæ¼ÒµãȯÊýÄ¿
    # curPlayer.DataServer_GetCoinReq()
    #===========================================================================
    return
#---------------------------------------------------------------------
#===============================================================================
# //01 10 ¶Ò»»µãȯ#tagCCoinChange
# tagCCoinChange       *   GettagCCoinChange();
# class   IPY_CCoinChange
# {
# public:
#    int      GetCoinCnt();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //01 10 ¶Ò»»µãȯ#tagCCoinChange
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //01 10 ¶Ò»»µãȯ#tagCCoinChange
def CoinChangeReq(index, tick):
 
    return
 
#//07 3E ÁìÈ¡ÌùÐĸ£´ü±£Ö¤Îï#tagCReceiveGoodyBagGuarantees
#
#struct tagCReceiveGoodyBagGuarantees
#{
#        tagHead Head;
#        BYTE   Index; //±£Ö¤ÎïË÷Òý
#};
##07 3E ÁìÈ¡ÌùÐĸ£´ü±£Ö¤Îï
#@param index Íæ¼ÒË÷Òý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks 07 3E ÁìÈ¡ÌùÐĸ£´ü±£Ö¤Îï
def GetGuaranteeGift(index, tick):
    
    return