| #!/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.SetItemIsBind(curItemTag, isBind)  | 
|     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.SetItemIsBind(curItemTag, isBind)  | 
|     ItemControler.SetItemCount(curItemTag, buyCnt, curPlayer.GetPlayerID(), curPlayer.GetAccID(), curPlayer.GetPlayerName())  | 
|     itemName = curItemTag.GetName()  | 
|     GUID = curItemTag.GetGUID()  | 
|       | 
|     if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItemTag, True, True):  | 
|         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  | 
|   |