#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#---------------------------------------------------------------------
|
#
|
#---------------------------------------------------------------------
|
##@package PlayerShopItem
|
# @todo: Íæ¼Ò°Ú̯Âß¼´¦Àí
|
#
|
# @author: panwei
|
# @date 2010-04-28
|
# @version 1.9
|
#
|
# @note: Íæ¼Ò°Ú̯Âß¼´¦Àí
|
#---------------------------------------------------------------------
|
# @change: "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ
|
# @change: "2010-06-21 15:54" panwei »Ö¸´°Ú̯¹¦ÄÜ
|
# @change: "2010-07-16 09:45" panwei °Ú̯ÐÂÔöÑéÖ¤, ÒÆ¶¯Öв»ÄܰÚ̯
|
# @change: "2011-09-15 16:00" chenxuewei ɾ³ýÎïÆ·Á÷Ïò¼Ç¼Ôö¼ÓÎïÆ·ÊÇ·ñ°ó¶¨
|
# @change: "2012-06-27 15:30" whx Ôö¼ÓsetCount´íÎóoss¼Ç¼
|
# @change: "2012-08-10 15:00" zhangxi ÐÞ¸ÄOSS¼Ç¼
|
# @change: "2013-11-27 20:30" hxp ÐÞ¸ÄÆæ¼£°Ú̯
|
# @change: "2013-12-10 14:00" hxp Ôö¼ÓÍ˳ö²é¿´°Ú̯Âß¼
|
# @change: "2015-07-03 16:00" zqx È¥³ýGMÏÞÖÆ
|
#---------------------------------------------------------------------
|
"""Version = 2015-07-03 16:00"""
|
#------------------------------------------------------------------------------
|
import IPY_GameWorld
|
import GameWorld
|
import ChConfig
|
import PlayerControl
|
import ItemControler
|
import PlayerTrade
|
import ItemCommon
|
import ReadChConfig
|
import EventShell
|
#---------------------------------------------------------------------
|
|
#---------------------------------------------------------------------
|
## 14 01 ¿ªÊ¼°Ú̯#tagCBeginShop
|
## ·â°ü´¥·¢ ¿ªÊ¼°Ú̯
|
# @param index Íæ¼ÒË÷Òý
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def BeginShopItem(index, tick):
|
#===============================================================================
|
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
#
|
# #¼ì²âÍæ¼Ò״̬
|
# if not __CheckBeginShopItemPlayerState(curPlayer):
|
# #PlayerShop_Lost ¶Ô²»Æð,µ±Ç°×´Ì¬ÎÞ·¨°Ú̯,²Ù×÷ÎÞЧ
|
# PlayerControl.NotifyCode(curPlayer , "PlayerShop_Lost")
|
# return
|
#
|
# #GMÎÞ·¨°Ú̯
|
# # if GameWorld.IsGM(curPlayer):
|
# # PlayerControl.NotifyCode(curPlayer, "GeRen_admin_59724")
|
# # return
|
#
|
# playerShop = curPlayer.GetPlayerShop()
|
#
|
# if playerShop.GetIsStartShop():
|
# #GameWorld.Log("ÒѾÔÚ°Ú̯״̬ÖÐ,Çë½áÊøºóÔÚ¿ªÊ¼")
|
# return
|
#
|
# # if not curPlayer.GetMapBuff().FindBuff(ChConfig.Def_SkillID_ShopItem):
|
# # PlayerControl.NotifyCode(curPlayer, "PlayerShop_Lost_AreaError")
|
# # #GameWorld.Log("ÎÞ°Ú̯Buff,°Ú̯¿ªÊ¼Ê§°Ü")
|
# # return
|
#
|
# # °Ú̯µØÍ¼ÅжÏ
|
# mapID = GameWorld.GetGameWorld().GetMapID()
|
# if mapID not in [10000]:
|
# PlayerControl.NotifyCode(curPlayer, "GeRen_admin_840854")
|
# return
|
#
|
# # ÅжϰÚ̯µÈ¼¶
|
# if not __CheckShopPlayerLV(curPlayer):
|
# return
|
#
|
# sendPack = IPY_GameWorld.IPY_CBeginShop()
|
# shopLV = sendPack.GetShopLV()
|
# shopName = sendPack.GetShopName()
|
#
|
# if shopName == '':
|
# GameWorld.ErrLog("°Ú̯Ãû×ÖΪ¿Õ" , curPlayer.GetPlayerID())
|
# return
|
#
|
# # Ææ¼£²»ÐèÒª°Ú̯ʯ
|
# # #»ñµÃÍæ¼Ò×°±¸µÄ
|
# itemManager = curPlayer.GetItemManager()
|
# # equipPack = itemManager.GetPack(IPY_GameWorld.rptEquip)
|
# # shopItem = equipPack.GetAt(IPY_GameWorld.retShopping)
|
# # #Èç¹û°Ú̯µÈ¼¶²»Îª1,ÐèÒªÅжÏÊÇ·ñÓаÚ̯ÔöÖµÎïÆ·
|
# # if not __CheckShopItem(curPlayer, shopItem, shopLV):
|
# # return
|
#
|
# # Ææ¼£²»ÐèÒª°Ú̯µÈ¼¶ÏÞÖÆ°Ú̯¸öÊý
|
# # #µ±Ç°Ì¯Î»¿ÉÒÔ°Ú̯µÄ×î´óÊýÁ¿
|
# # canShopItemMaxCount = 0
|
# # #¼ì²é°Ú̯µÈ¼¶
|
# # if ChConfig.Def_ShopItem_Count.has_key(shopLV):
|
# # #¿ÉÒÔ°Ú̯µÄÊýÁ¿
|
# # canShopItemMaxCount = ChConfig.Def_ShopItem_Count.get(shopLV)
|
# # else:
|
# # GameWorld.ErrLog("°Ú̯µÈ¼¶´íÎó,shopLV = %s" % (shopLV) , curPlayer.GetPlayerID())
|
# # return
|
#
|
# canShopItemMaxCount = 12 # Ôݶ¨12¸ñ£¬ÏÈдËÀ
|
# #»ñµÃ°Ú̯ÎïÆ·µÄÏúÊÛÊýÁ¿
|
# shopItemCount = sendPack.GetSellCount()
|
#
|
# if shopItemCount <= 0 or shopItemCount > canShopItemMaxCount:
|
# GameWorld.ErrLog("°Ú̯ÊýÁ¿,·â°üÒì³£ = %s,maxCount = %s" % (shopItemCount, canShopItemMaxCount) , curPlayer.GetPlayerID())
|
# return
|
#
|
# #Íæ¼Ò±³°ü×î´óÊýÁ¿
|
# itemPack = itemManager.GetPack(IPY_GameWorld.rptItem)
|
# itemIndexList = []
|
#
|
# curItemDict = {}
|
# for i in range(shopItemCount):
|
# sendPackItem = sendPack.GetSellItemIndex(i)
|
#
|
# if sendPackItem == None:
|
# GameWorld.ErrLog("°Ú̯·â°üÎïÆ·Îª¿Õ,itemIndex = %s" % (i) , curPlayer.GetPlayerID())
|
# return
|
#
|
# itemIndex = sendPackItem.GetItemIndex()
|
# item = itemPack.GetAt(itemIndex)
|
#
|
# if not PlayerTrade.CheckTradeItem(curPlayer, item):
|
# GameWorld.ErrLog("°Ú̯ÎïÆ·´íÎó,itemIndex = %s" % (itemIndex) , curPlayer.GetPlayerID())
|
# return
|
#
|
# silver = sendPackItem.GetSilver()
|
#
|
# if silver < 1:
|
# GameWorld.ErrLog("°Ú̯ÎïÆ·ÊÛ¼Û, index = %s, silver = %s" % (itemIndex, silver) , curPlayer.GetPlayerID())
|
# return
|
#
|
# if curItemDict.has_key(itemIndex):
|
# GameWorld.ErrLog("°Ú̯ÎïÆ·´íÎó, ÓÐÖØ¸´ÎïÆ·, itemIndex = %s" % (itemIndex) , curPlayer.GetPlayerID())
|
# return
|
#
|
# curItemDict[itemIndex] = silver
|
# itemIndexList.append([itemIndex, silver])
|
#
|
# for i in range(len(itemIndexList)):
|
# # int itemIndex, DWORD Gold,DWORD GoldPaper, DWORD Silver,DWORD SilverPaper
|
# playerShop.AddSellItem(itemIndexList[i][0], 0, 0, itemIndexList[i][1], 0)
|
# #½«±³°üÖÐ,¶ÔÓ¦µÄÎïÆ·Ëø¶¨
|
# #GameWorld.Log('½«±³°üÖÐ,¶ÔÓ¦µÄÎïÆ·Ëø¶¨ %d'%itemIndexList[i][0])
|
# item = itemPack.GetAt(itemIndexList[i][0])
|
# item.SetIsEventLocked(True)
|
#
|
# #¿Û°Ú̯ʯÄ;Ã(¸ÄΪ½áÊøÊ±ºò¿ÛÄ;Ã)
|
# #__ReduceShopItem(curPlayer, shopItem, shopLV)
|
#
|
# playerShop.SetShopName(shopName)
|
# playerShop.SetShopLV(shopLV)
|
# playerShop.SetIsStartShop(True)
|
# #Ëø×¡Íæ¼Ò
|
# #curPlayer.BeginEvent()
|
# #¿ªÊ¼°Ú̯
|
# curPlayer.View_StartShop()
|
# #Âò¼ÒµêÆÌË¢ÐÂ
|
# curPlayer.Sync_ShopItem()
|
# PlayerControl.NotifyCode(curPlayer, "GeRen_admin_293296")
|
# GameWorld.Log("¿ªÊ¼°Ú̯³É¹¦" , curPlayer.GetPlayerID())
|
#===============================================================================
|
return
|
|
#---------------------------------------------------------------------
|
##¼ì²âÍæ¼Òµ±Ç°×´Ì¬ÊÇ·ñ¿ÉÒÔ°Ú̯
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @return ²¼¶ûÖµ
|
# @remarks ¼ì²âÍæ¼Òµ±Ç°×´Ì¬ÊÇ·ñ¿ÉÒÔ°Ú̯
|
def __CheckBeginShopItemPlayerState(curPlayer):
|
|
if curPlayer.GetPlayerAction() not in ChConfig.Def_ShopItem_PlayerState:
|
return False
|
|
# Ææ¼£Åܶ¯ÖлòÆï×øÆïÒà¿É°Ú̯
|
# if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull:
|
# return False
|
#
|
# if curPlayer.IsMoving():
|
# return False
|
|
return True
|
#---------------------------------------------------------------------
|
## ½áÊø°Ú̯
|
# @param index Íæ¼ÒË÷Òý
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def EndShop(index, tick):
|
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
#sendPack = IPY_GameWorld.IPY_CEndShop()
|
playerShop = curPlayer.GetPlayerShop()
|
|
if not playerShop.GetIsStartShop():
|
GameWorld.ErrLog("EndShop -> ²»ÔÚ°Ú̯״̬" , curPlayer.GetPlayerID())
|
return
|
|
DoExitShop(curPlayer , playerShop)
|
#Ö÷¶¯½áÊøÊ¼þ
|
curPlayer.ExitEvent()
|
#Çå¿ÕÒÆ¶¯´ÎÊý
|
GameWorld.ClearPlayerPosCount(curPlayer)
|
return
|
|
#---------------------------------------------------------------------
|
## 14 03 ²é¿´Ì¯Î»#tagCWatchShop
|
## ²é¿´Ì¯Î»
|
# @param index Íæ¼ÒË÷Òý
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def WatchShop(index, tick):
|
watchPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
watchPlayerShop = watchPlayer.GetPlayerShop()
|
|
# Ææ¼£ÈκÎʱºò¶¼Äܲ鿴̯λ
|
# if watchPlayer.GetPlayerAction() not in ChConfig.Def_ShopItem_PlayerState:
|
# #GameWorld.Log("Ö»ÓпÕÏÐ״̬²ÅÄܲ鿴")
|
# return
|
|
#GMÎÞ·¨¹ºÂòÎïÆ·
|
# if GameWorld.IsGM(watchPlayer):
|
# PlayerControl.NotifyCode(watchPlayer, "GeRen_admin_59724")
|
# return
|
|
sendPack = IPY_GameWorld.IPY_CWatchShop()
|
playerID = sendPack.GetPlayerID()
|
|
# Í˳ö²é¿´°Ú̯
|
if playerID <= 0:
|
EventShell.ExitWatchShopItem(watchPlayer)
|
return
|
|
openShopPlayer = GameWorld.GetObj(playerID, IPY_GameWorld.gotPlayer)
|
|
if openShopPlayer == None:
|
return
|
|
# ÅжÏÍæ¼Ò¼ä¾àÀë
|
if not __CheckShopItemDist(watchPlayer, openShopPlayer):
|
GameWorld.DebugLog("WatchShop dist error: shopPlayID=%s" % playerID, watchPlayer.GetPlayerID())
|
return
|
|
playerShop = openShopPlayer.GetPlayerShop()
|
|
if not __CheckopenShopPlayer(watchPlayer, openShopPlayer, playerShop):
|
return
|
|
#Ìí¼Ó²é¿´Õâ¸ö̯λµÄÍæ¼Ò
|
playerShop.AddWatchPlayer(watchPlayer)
|
#Ìí¼Ó²é¿´¶ÔÏó
|
watchPlayer.SetActionObj(openShopPlayer)
|
#Ëø×¡Íæ¼Ò
|
watchPlayer.BeginEvent()
|
#ÉèÖÃÍæ¼Òµ±Ç°×´Ì¬Îª²é¿´Ì¯Î»×´Ì¬
|
watchPlayerShop.SetIsWatchingShop(1)
|
#¸æËß̯λÐÅÏ¢
|
watchPlayer.Sync_WatchShop(openShopPlayer)
|
return
|
|
#---------------------------------------------------------------------
|
## 14 04 ¹ºÂòÎïÆ·#tagCBuyItem
|
## ¹ºÂòÎïÆ·
|
# @param index Íæ¼ÒË÷Òý
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def BuyItem(index, tick):
|
watchPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
|
# ÅжϹºÂòµÈ¼¶
|
if not __CheckShopPlayerLV(watchPlayer):
|
PlayerControl.NotifyCode(watchPlayer, "GeRen_chenxin_93493")
|
return
|
|
watchPlayerShop = watchPlayer.GetPlayerShop()
|
#²»Ôڲ鿴״̬
|
if not watchPlayerShop.GetIsWatchingShop():
|
GameWorld.Log("BuyItem error: watchPlayer is not in watch state!", watchPlayer.GetPlayerID())
|
return
|
|
if ItemControler.GetItemPackSpace(watchPlayer, IPY_GameWorld.rptItem) < 1:
|
#Task_WinLost_RoomLack02 ÄúµÄ±³°ü¿Õ¼ä²»×ã,ÇëÕûÀí±³°üºóÔÙÀ´
|
PlayerControl.NotifyCode(watchPlayer, "Task_WinLost_RoomLack02")
|
return
|
|
sendPack = IPY_GameWorld.IPY_CBuyItem()
|
shopItemIndex = sendPack.GetItemIndex()
|
openShopPlayer = watchPlayer.GetActionPlayer()
|
|
if openShopPlayer == None :
|
GameWorld.Log("BuyItem -> ÎÞ¶ÔÏó" , watchPlayer.GetPlayerID())
|
return
|
|
# ÅжÏÂòÂôË«·½¾àÀë
|
if not __CheckShopItemDist(watchPlayer, openShopPlayer):
|
GameWorld.Log("BuyItem dist error: shopPlayID=%s" % openShopPlayer.GetPlayerID(), watchPlayer.GetPlayerID())
|
return
|
|
playerShop = openShopPlayer.GetPlayerShop()
|
|
if not playerShop.GetIsStartShop():
|
GameWorld.Log("BuyItem ->Ä¿±ê²»ÔÚ°Ú̯״̬" , watchPlayer.GetPlayerID())
|
return
|
|
openShopPlayerPack = openShopPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
|
shopItem = playerShop.GetSellItemAt(shopItemIndex)
|
|
if shopItem == None:
|
GameWorld.Log("BuyItem ->Î޴˰Ú̯ÎïÆ· = %s" % (shopItemIndex) , watchPlayer.GetPlayerID())
|
return
|
|
buyItem = openShopPlayerPack.GetAt(shopItem.GetItemIndex())
|
|
buyCount = sendPack.GetItemCount()
|
|
buyItemMaxCount = buyItem.GetCount()
|
|
# ¼ì²é¹ºÂòÎïÆ·ÊýÁ¿
|
if not __CheckBuyItem(watchPlayer, buyItem, buyCount, buyItemMaxCount):
|
return
|
|
costMoney = shopItem.GetSilver() * buyCount
|
payType = IPY_GameWorld.TYPE_Price_Silver_Money
|
|
# Åж϶Է½½ðÇ®ÉÏÏÞ
|
if PlayerControl.GetSilver(openShopPlayer) + costMoney > ChConfig.Def_PlayerTotalMoney_Silver:
|
# ¶Ô²»Æð£¬ÄúЯ´øµÄ½ðÇ®ÒѾ´ïÉÏÏÞ,²Ù×÷ÎÞЧ
|
# PlayerControl.NotifyCode(openShopPlayer, "GeRen_chenxin_609765")
|
#GeRen_admin_917284 ¶Ô²»Æð£¬Ä¿±êÉíÉÏЯ´øµÄ½ðÇ®ÒѾ´ïÉÏÏÞ,²Ù×÷ÎÞЧ
|
PlayerControl.NotifyCode(watchPlayer, "GeRen_admin_917284")
|
return
|
|
#¸¶Ç®
|
infoDict = {ChConfig.Def_Cost_Reason_SonKey:buyItem.GetItemTypeID()}
|
if not PlayerControl.PayMoney(watchPlayer, payType, costMoney, ChConfig.Def_Cost_BuyStallItem, infoDict):
|
GameWorld.ErrLog("BuyItem money not enough!!" , watchPlayer.GetPlayerID())
|
return
|
|
#ÊÕÇ®
|
addDataDict = {ChConfig.Def_Give_Reason_SonKey:buyItem.GetItemTypeID()}
|
PlayerControl.GiveMoney(openShopPlayer, payType, costMoney, ChConfig.Def_GiveMoney_StallItem, addDataDict)
|
|
watchPlayerID = watchPlayer.GetPlayerID()
|
openShopPlayerID = openShopPlayer.GetPlayerID()
|
|
#-------------------------------¼ì²éÍê±Ï, Âß¼¿ªÊ¼, ÒѾ¸¶Ç®
|
#¹ã²¥²é¿´Õâ¸ö̯λµÄÍæ¼ÒÐÅÏ¢
|
openShopPlayer.View_BuyShopItemToAllShopBuyer(watchPlayer.GetPlayerID(),
|
shopItemIndex, buyCount)
|
|
watchPlayerIC = ItemControler.PlayerItemControler(watchPlayer)
|
buyItemTypeID = buyItem.GetItemTypeID()
|
|
#È«²¿Âò×ß
|
if buyCount == buyItemMaxCount:
|
#½«Ö÷½ÇÎïÆ·,ת»»Îªµ¥¶ÀÎïÆ·
|
singItem = buyItem.GetItem()
|
singItemID = singItem.GetItemTypeID()
|
singItemGUID = singItem.GetGUID()
|
singItemCount = singItem.GetCount()
|
|
#Ïêϸ¼Ç¼װ±¸ÐÅÏ¢
|
equipNote = ItemCommon.GetItemNoteDict(singItem)
|
|
#µêÆÌɾ³ýÕâ¸öÎïÆ·
|
playerShop.DeleteShopItem(shopItemIndex)
|
#ɾ³ýÍæ¼ÒÕâ¸ö¸ñ×ӵĶ«Î÷
|
buyItem.Wipe()
|
|
#Êä³öϵͳÌáʾ
|
#LostRes ÄúʧȥÁË<Info Type="Item" Name="Name" ID="{%S1%}"/>{%S2%}¸ö
|
PlayerControl.NotifyCode(openShopPlayer, "LostRes", [singItemID, buyCount])
|
#ObtainRes01 Äú»ñµÃÁË<Info Type="Item" Name="Name" ID="{%S1%}"/>{%S2%}¸ö
|
PlayerControl.NotifyCode(watchPlayer, "ObtainRes01", [singItemID, buyCount])
|
|
if not watchPlayerIC.PutInItem(IPY_GameWorld.rptItem, singItem):
|
GameWorld.Log("###Òì³£ÐÅÏ¢,·ÅÈëÍæ¼Ò±³°üʧ°Ü playerID = %s" % (watchPlayerID) , openShopPlayerID , watchPlayerID)
|
return False
|
|
#Âò²¿·Ö
|
else:
|
#´´½¨Ò»¸öÎïÆ··ÅÈë
|
newItem = ItemCommon.CreateSingleItem(buyItemTypeID)
|
|
if newItem == None:
|
GameWorld.Log("###Òì³£ÐÅÏ¢,Íæ¼Ò = %sÉÌµê ´´½¨ÎïÆ·Ê§°Ü = %s" % (openShopPlayerID , buyItemTypeID), openShopPlayerID , watchPlayerID)
|
return
|
|
ItemControler.SetItemCount(buyItem, buyItemMaxCount - buyCount,
|
openShopPlayer.GetPlayerID(), openShopPlayer.GetAccID(),
|
openShopPlayer.GetPlayerName())
|
singItem = buyItem.GetItem()
|
#Ïêϸװ±¸ÐÅÏ¢
|
newEquipNote = ItemCommon.GetItemNoteDict(newItem)
|
|
#Êä³öϵͳÌáʾ
|
#LostRes ÄúʧȥÁË<Info Type="Item" Name="Name" ID="{%S1%}"/>{%S2%}¸ö
|
PlayerControl.NotifyCode(openShopPlayer, "LostRes", [buyItemTypeID, buyCount])
|
#ObtainRes01 Äú»ñµÃÁË<Info Type="Item" Name="Name" ID="{%S1%}"/>{%S2%}¸ö
|
PlayerControl.NotifyCode(watchPlayer, "ObtainRes01", [buyItemTypeID, buyCount])
|
|
ItemControler.SetItemCount(newItem, buyCount,
|
watchPlayer.GetPlayerID(), watchPlayer.GetAccID(),
|
watchPlayer.GetPlayerName())
|
watchPlayerIC.PutInItem(IPY_GameWorld.rptItem, newItem)
|
|
PlayerControl.NotifyCode(openShopPlayer, "GeRen_admin_367906", [buyItemTypeID])
|
#Âò¼ÒµêÆÌË¢ÐÂ
|
openShopPlayer.Sync_ShopItem()
|
return
|
#---------------------------------------------------------------------
|
## ¼ì²éÊÇ·ñ¿ÉÒÔ¹ºÂò£¬ÊýÁ¿ÊÇ·ñÒì³£
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param sellItem ³öÊÛµÄÎïÆ·
|
# @param buyCount ¹ºÂòÊýÁ¿
|
# @param buyItemMaxCount ÄܹºÂò×î´óÊýÁ¿
|
# @return None or True
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def __CheckBuyItem(curPlayer, sellItem, buyCount, buyItemMaxCount):
|
if sellItem == None or sellItem.IsEmpty():
|
#GameWorld.Log("Î޴˹ºÂòÎïÆ·")
|
return
|
|
if buyCount <= 0 or buyCount > buyItemMaxCount:
|
#GeRen_admin_774664 <n color="255,255,0">¶Ô²»Æð,ÄúÐèÒª¹ºÂòÎïÊýÁ¿²»×ã,²Ù×÷ÎÞЧ£¡</n> 25 - -
|
PlayerControl.NotifyCode(curPlayer, "GeRen_admin_774664")
|
#GameWorld.Log("¹ºÂòÊýÁ¿Òì³£ count = %s"%buyCount)
|
return
|
|
return True
|
#---------------------------------------------------------------------
|
## ¼ì²âÊÇ·ñÓÐÕâ¸öÂô¼Ò
|
# @param watchPlayer ¹Û²ìÕߣ¨Ã»Óõ½£©
|
# @param openShopPlayer ³öÊÛÕß
|
# @param playerShop
|
# @return None or True
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def __CheckopenShopPlayer(watchPlayer, openShopPlayer , playerShop):
|
if openShopPlayer == None:
|
GameWorld.DebugLog("²éÎ޴˰ÚÌ¯Íæ¼Ò:shopPlayerID=%s" % openShopPlayer.GetPlayerID(), watchPlayer.GetPlayerID())
|
return
|
|
if not playerShop.GetIsStartShop():
|
GameWorld.DebugLog("°ÚÌ¯Íæ¼Òδ°Ú̯:shopPlayerID=%s" % openShopPlayer.GetPlayerID(), watchPlayer.GetPlayerID())
|
return
|
|
return True
|
|
#---------------------------------------------------------------------
|
## ¼ì²â°Ú̯ʯ»¹Äܲ»ÄÜÓÃ
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param shopItem °Ú̯ʯ
|
# @param shopLV É̵êµÈ¼¶
|
# @return None or True
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def __CheckShopItem(curPlayer, shopItem, shopLV):
|
if shopLV == 1:
|
return True
|
|
if shopItem.IsEmpty():
|
#GameWorld.Log("ÎÞ°Ú̯ʯ")
|
return
|
|
#===========================================================================
|
# if shopItem.GetCurDurg() <= 0:
|
# #GameWorld.Log("°Ú̯ʯ,ÎÞÄ;Ã")
|
# return
|
#===========================================================================
|
|
effIndex = shopItem.GetEffectByIndex(0)
|
|
if effIndex.GetEffectID() != ChConfig.Def_Item_Effect_ShopItem or effIndex.GetEffectValue(0) != shopLV:
|
#GameWorld.Log("°Ú̯ʯ²»·ûºÏÒªÇó,µÈ¼¶´íÎó")
|
return
|
|
return True
|
#---------------------------------------------------------------------
|
## ÈËÎïµ½É̵êµÄ¾àÀë ÊÇ·ñÔڹ涨¾àÀëÄÚ
|
# @param curPlayer
|
# @param curTagPlayer
|
# @return True or False
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def __CheckShopItemDist(curPlayer, curTagPlayer):
|
dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(),
|
curTagPlayer.GetPosX(), curTagPlayer.GetPosY())
|
|
return ChConfig.Def_ShopItem_Dist > dist
|
#---------------------------------------------------------------------
|
## °Ú̯Õ߹رհÚ̯
|
# @param curPlayer °Ú̯Õß
|
# @param playerShop Íæ¼ÒµÄ̯λ
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def DoExitShop(curPlayer , playerShop):
|
#===============================================================================
|
# GameWorld.Log("DoExitShop -> ½áÊø°Ú̯" , curPlayer.GetPlayerID())
|
# itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
#
|
# #½«»¹ÔÚÏúÊÛÀ¸Öб³°ü¶ÔÓ¦µÄÎïÆ·½ÓËø
|
# for i in range(playerShop.GetSellCount()):
|
# sellItem = playerShop.GetSellItemAt(i)
|
#
|
# if sellItem == None:
|
# GameWorld.ErrLog("½áÊø°Ú̯Òì³£,Î޴˰Ú̯ÎïÆ· , index = %s" % i , curPlayer.GetPlayerID())
|
# continue
|
#
|
# roleItemIndex = sellItem.GetItemIndex()
|
# roleItem = itemPack.GetAt(roleItemIndex)
|
# #Ò»¶¨ÓÐÎïÆ·
|
# if roleItem == None or roleItem.IsEmpty():
|
# GameWorld.ErrLog("½áÊø°Ú̯Òì³£,Íæ¼Ò½âËøÎïÆ·±³°üindex = %s" % (roleItemIndex) , curPlayer.GetPlayerID())
|
# continue
|
#
|
# roleItem.SetIsEventLocked(False)
|
#
|
# #½â¿ª²é¿´µ±Ç°Ì¯Î»µÄÍæ¼Ò
|
# for i in range(playerShop.GetWatchPlayersCount()):
|
# watchPlayer = playerShop.GetWatchPlayersAt(i)
|
#
|
# if watchPlayer == None:
|
# GameWorld.ErrLog("½áÊø°Ú̯Òì³£,²é¿´°ÚÌ¯Íæ¼Ò,ÎÞ´ËÍæ¼Ò,index = %s" % i , curPlayer.GetPlayerID())
|
# continue
|
#
|
# watchPlayer.ExitEvent()
|
#
|
# # Ææ¼£²»ÐèÒª°Ú̯ʯ
|
# # shopItem = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip).GetAt(IPY_GameWorld.retShopping)
|
# # #°Ú̯ʯ¿ÛÄ;Ã
|
# # __ReduceShopItem(curPlayer, shopItem , playerShop.GetShopLV())
|
#
|
# #Íæ¼Ò¹ã²¥½áÊø°Ú̯
|
# curPlayer.View_CloseShop()
|
# #Çå¿Õ²é¿´Õâ¸ö̯λµÄÍæ¼ÒÐÅÏ¢
|
# playerShop.ClearWatchPlayer()
|
# #Çå¿ÕÉ̵ê
|
# playerShop.Clear()
|
#===============================================================================
|
return
|
|
#---------------------------------------------------------------------
|
## °Ú̯ʯ¼õÄ;Ã
|
# @param curPlayer Íæ¼Ò
|
# @param shopItem °Ú̯ʯ
|
# @param shopLV É̵êµÈ¼¶
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
#===============================================================================
|
# def __ReduceShopItem(curPlayer, shopItem , shopLV):
|
# if not __CheckShopItem(curPlayer, shopItem, shopLV):
|
# GameWorld.Log('###°Ú̯ʯ¿Û³ýÄ;Ãʧ°Ü,ÎÞ·¨²éÕÒ°Ú̯ʯ = %s' % (shopLV) , curPlayer.GetPlayerID())
|
# return
|
#
|
# shopItem.SetCurDurg(shopItem.GetCurDurg() - ChConfig.Def_Endure_Transform)
|
# if shopItem.GetCurDurg() == 0 and shopItem.GetNoEndureDisappear():
|
# shopItem.Clear()
|
#
|
# return
|
#===============================================================================
|
|
## ¼ì²é°Ú̯µÈ¼¶
|
# @param curPlayer Íæ¼Ò
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def __CheckShopPlayerLV(curPlayer):
|
tradeLVLimit = ReadChConfig.GetEvalChConfig("TradeLVLimit")
|
|
if curPlayer.GetLV() < tradeLVLimit:
|
return False
|
return True
|