Added method for buying a Game Corner prize item, made def _I able to replace text like _INTL

This commit is contained in:
Maruno17
2022-01-30 20:03:52 +00:00
parent 6698149083
commit 0465572ca0
2 changed files with 16 additions and 2 deletions

View File

@@ -758,8 +758,8 @@ def _ISPRINTF(*arg)
return string
end
def _I(str)
return _MAPINTL($game_map.map_id, str)
def _I(str, *arg)
return _MAPINTL($game_map.map_id, str, *arg)
end
def _MAPINTL(mapid, *arg)

View File

@@ -806,3 +806,17 @@ def pbReceiveItem(item, quantity = 1)
end
return false # Can't add the item
end
#===============================================================================
# Buying a prize item from the Game Corner
#===============================================================================
def pbBuyPrize(item, quantity = 1)
item = GameData::Item.get(item)
return false if !item || quantity < 1
item_name = (quantity > 1) ? item.name_plural : item.name
pocket = item.pocket
return false if !$bag.add(item, quantity)
pbMessage(_INTL("\\CNYou put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
item_name, pocket, PokemonBag.pocket_names[pocket - 1]))
return true
end