本文整理汇总了Python中pirates.economy.EconomyGlobals.getItemCost方法的典型用法代码示例。如果您正苦于以下问题:Python EconomyGlobals.getItemCost方法的具体用法?Python EconomyGlobals.getItemCost怎么用?Python EconomyGlobals.getItemCost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.economy.EconomyGlobals
的用法示例。
在下文中一共展示了EconomyGlobals.getItemCost方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendRequestSellShip
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def sendRequestSellShip(self, shipId, choice):
shipOV = self.cr.getOwnerView(shipId)
if not shipOV:
if self.pickShipGUI:
self.pickShipGUI.hide()
return None
modelType = ShipGlobals.getModelClass(shipOV.shipClass)
cost = EconomyGlobals.getItemCost(modelType) / 2
if choice == 1:
inventory = base.localAvatar.getInventory()
if inventory:
if cost > 0 and inventory.getGoldInPocket() + cost > InventoryGlobals.GOLD_CAP:
r = Functor(self.sendRequestSellShipGoldOverflow, shipId)
if self.confirmDialog:
self.confirmDialog.destroy()
self.confirmDialog = None
self.confirmDialog = PDialog.PDialog(text = PLocalizer.ExcessGoldLost, style = OTPDialog.YesNo, command = r)
return None
self.sendUpdate('requestSellShip', [
shipId])
if self.pickShipGUI:
self.pickShipGUI.hide()
self.finishShopping()
示例2: __init__
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def __init__(self, uid):
SimpleItem.__init__(self, uid)
self.itemClass = EconomyGlobals.getItemCategory(uid)
self.itemType = EconomyGlobals.getItemType(uid)
self.cost = EconomyGlobals.getItemCost(uid)
if not self.cost:
self.cost = ItemGlobals.getGoldCost(uid)
示例3: loadData
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def loadData(self):
itemId = self.data[0]
(item, quantity) = self.data
self.quantity = quantity
itemType = EconomyGlobals.getItemType(itemId)
if itemType <= ItemType.WAND:
itemTypeName = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
else:
itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
if itemType <= ItemType.WAND or itemType == ItemType.POTION:
name = PLocalizer.getItemName(itemId)
self.price = ItemGlobals.getGoldCost(itemId)
else:
name = PLocalizer.InventoryTypeNames.get(item)
self.price = EconomyGlobals.getItemCost(item)
if self.sell:
self.price /= 2
if self.buy:
if itemType > ItemType.WAND and itemType != ItemType.POTION:
self.quantity = EconomyGlobals.getItemQuantity(itemId)
self.price *= self.quantity
self.price = int(self.price)
self.name = PLocalizer.makeHeadingString(name, 2)
self.itemType = itemTypeName
if itemType != ItemType.FISHING_LURE:
if itemType != ItemType.POTION:
self.minLvl = ItemGlobals.getWeaponRequirement(itemId)
else:
self.minLvl = 0
else:
self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
示例4: createGui
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def createGui(self):
(item, quantity) = self.data
name = PLocalizer.InventoryTypeNames[item]
self.price = EconomyGlobals.getItemCost(item)
repId = InventoryType.SailingRep
itemTypeName = PLocalizer.InventoryTypeNames.get(repId)
self.itemType = itemTypeName
if self.sell:
self.price /= 2
card = loader.loadModel("models/textureCards/shipCatalog")
renderName = self.shipImageDict.get(item, "Catalog_War_Brig")
myTexCard = card.find("**/%s*" % renderName)
myTex = myTexCard.findAllTextures()[0]
card.removeNode()
del card
self.minLvl = EconomyGlobals.getItemMinLevel(item)
self.miscText = None
self.picture = DirectFrame(
parent=self,
relief=None,
state=DGG.DISABLED,
image=myTex,
image_scale=(0.070000000000000007, 1.0, 0.059999999999999998),
)
self.picture.setPos(0.10000000000000001, 0, 0.080000000000000002)
self.picture.setTransparency(1)
self.nameTag = DirectLabel(
parent=self,
state=DGG.DISABLED,
relief=None,
text=name,
text_scale=PiratesGuiGlobals.TextScaleMed * PLocalizer.getHeadingScale(2),
text_align=TextNode.ALeft,
text_fg=PiratesGuiGlobals.TextFG1,
text_shadow=PiratesGuiGlobals.TextShadow,
textMayChange=0,
)
self.nameTag.setPos(0.20000000000000001, 0, 0.10000000000000001)
self.costText = DirectLabel(
parent=self,
relief=None,
state=DGG.DISABLED,
geom=self.coinImage,
geom_scale=0.12,
geom_pos=Vec3(-0.01, 0, 0.01),
text=str(self.price),
text_scale=PiratesGuiGlobals.TextScaleSmall,
text_align=TextNode.ARight,
text_fg=PiratesGuiGlobals.TextFG2,
text_shadow=PiratesGuiGlobals.TextShadow,
text_wordwrap=11,
text_pos=(-0.029999999999999999, 0, 0),
text_font=PiratesGlobals.getInterfaceFont(),
)
self.costText.setPos(0.47999999999999998, 0, 0.040000000000000001)
示例5: confirmOverhaulShip
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def confirmOverhaulShip(self, shipId = None):
if not shipId:
return None
shipOV = self.cr.getOwnerView(shipId)
if not shipOV:
return None
if shipOV.state != 'Off':
base.localAvatar.guiMgr.createWarning(PLocalizer.ShipNotInBottleWarning, PiratesGuiGlobals.TextFG6)
return None
shipClass = shipOV.getShipClass()
cost = EconomyGlobals.getItemCost(shipClass) * EconomyGlobals.OVERHAUL_COST_PERCENTAGE
if self.confirmDialog:
self.confirmDialog.destroy()
self.confirmDialog = None
self.confirmDialog = PDialog.PDialog(text = PLocalizer.OverhaulConfirmDialog % {
'gold': cost }, style = OTPDialog.YesNo, command = self.sendRequestOverhaulShip, extraArgs = [
shipId])
示例6: confirmSellShip
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def confirmSellShip(self, shipId = None):
if not shipId:
return None
shipOV = self.cr.getOwnerView(shipId)
if not shipOV:
return None
if shipOV.state != 'Off':
base.localAvatar.guiMgr.createWarning(PLocalizer.ShipNotInBottleWarning, PiratesGuiGlobals.TextFG6)
return None
modelType = ShipGlobals.getModelClass(shipOV.shipClass)
cost = EconomyGlobals.getItemCost(modelType) / 2
r = Functor(self.doubleConfirmSellShip, shipId)
if self.confirmDialog:
self.confirmDialog.destroy()
self.confirmDialog = None
self.confirmDialog = PDialog.PDialog(text = PLocalizer.SellShipConfirmDialog % {
'gold': cost }, style = OTPDialog.YesNo, command = r)
示例7: updateBalance
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def updateBalance(self, extraArgs = None):
self.balance = 0
for item in self.purchaseInventory:
self.balance += EconomyGlobals.getItemCost(item[0])
if self.balance > 0:
self.balanceTitle['text'] = PLocalizer.Cost
self.balanceValue['text'] = str(abs(self.balance))
elif self.balance < 0:
self.balanceTitle['text'] = PLocalizer.Gain
self.balanceValue['text'] = str(abs(self.balance))
else:
self.balanceTitle['text'] = PLocalizer.Cost
self.balanceValue['text'] = str(abs(self.balance))
inventory = base.localAvatar.getInventory()
if inventory:
if inventory.getGoldInPocket() < self.balance:
self.commitButton['frameColor'] = PiratesGuiGlobals.ButtonColor3
elif len(inventory.getShipDoIdList()) >= inventory.getCategoryLimit(InventoryCategory.SHIPS):
self.commitButton['frameColor'] = PiratesGuiGlobals.ButtonColor3
else:
self.commitButton['frameColor'] = PiratesGuiGlobals.ButtonColor4
示例8: sendRequestOverhaulShip
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def sendRequestOverhaulShip(self, choice, extraArgs):
if self.pickShipGUI:
self.pickShipGUI.hide()
shipId = extraArgs[0]
shipOV = self.cr.getOwnerView(shipId)
if not shipOV:
return None
shipClass = shipOV.getShipClass()
cost = EconomyGlobals.getItemCost(shipClass) * EconomyGlobals.OVERHAUL_COST_PERCENTAGE
if choice == 1:
inventory = base.localAvatar.getInventory()
if inventory:
if inventory.getGoldInPocket() < cost:
base.localAvatar.guiMgr.createWarning(PLocalizer.NotEnoughMoneyWarning, PiratesGuiGlobals.TextFG6)
return None
self.sendUpdate('requestPurchaseOverhaul', [
shipId])
self.finishShopping()
示例9: createGui
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemCost [as 别名]
def createGui(self):
(item, quantity) = self.data
name = PLocalizer.InventoryTypeNames[item]
self.price = EconomyGlobals.getItemCost(item)
repId = InventoryType.SailingRep
itemTypeName = PLocalizer.InventoryTypeNames.get(repId)
self.itemType = itemTypeName
if self.sell:
self.price /= 2
card = loader.loadModel('models/textureCards/shipRenders')
if item in [
ItemId.INTERCEPTOR_L1,
ItemId.INTERCEPTOR_L2,
ItemId.INTERCEPTOR_L3]:
myTexCard = card.find('**/Interceptor_Render*')
elif item in [
ItemId.MERCHANT_L1,
ItemId.MERCHANT_L2,
ItemId.MERCHANT_L3]:
myTexCard = card.find('**/Merchant_Render*')
elif item in [
ItemId.WARSHIP_L1,
ItemId.WARSHIP_L2,
ItemId.WARSHIP_L3]:
myTexCard = card.find('**/Warship_Render*')
else:
myTexCard = card.find('**/Warship_Render*')
myTex = myTexCard.findAllTextures()[0]
card.removeNode()
del card
self.minLvl = EconomyGlobals.getItemMinLevel(item)
self.miscText = None
self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, image = myTex, image_scale = 0.059999999999999998, pos = (0.085000000000000006, 0, 0.074999999999999997))
self.picture.setTransparency(1)
self.nameTag = DirectLabel(parent = self, state = DGG.DISABLED, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleMed * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.16, 0, 0.105), textMayChange = 0)
self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = self.coinImage, geom_scale = 0.12, geom_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())