Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmdUse=-1
- cmdRegister=-1
- cmdGive=-1
- cmdToss=-1
- cmdRead=-1
- commands=[]
- # Generate command list
- commands[cmdRead=commands.length]=_INTL("Read") if pbIsMail?(item)
- commands[cmdUse=commands.length]=_INTL("Use") if ItemHandlers.hasOutHandler(item) || (pbIsMachine?(item) && $Trainer.party.length>0)
- commands[cmdGive=commands.length]=_INTL("Give") if $Trainer.party.length>0 && !pbIsImportantItem?(item)
- commands[cmdToss=commands.length]=_INTL("Toss") if !pbIsImportantItem?(item) || $DEBUG
- if @bag.registeredItem==item
- commands[cmdRegister=commands.length]=_INTL("Deselect")
- elsif pbIsKeyItem?(item) && ItemHandlers.hasKeyItemHandler(item)
- commands[cmdRegister=commands.length]=_INTL("Register")
- end
- commands[cmdMysteryGift=commands.length]=_INTL("Make Mystery Gift") if $DEBUG
- commands[commands.length]=_INTL("Cancel")
- # Show commands generated above
- itemname=PBItems.getName(item) # Get item name
- command=@scene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
- if cmdUse>=0 && command==cmdUse # Use item
- ret=pbUseItem(@bag,item,@scene)
- # 0=Item wasn't used; 1=Item used; 2=Close Bag to use in field
- break if ret==2 # End screen
- @scene.pbRefresh
- next
- elsif cmdRead>=0 && command==cmdRead # Read mail
- pbFadeOutIn(99999){
- pbDisplayMail(PokemonMail.new(item,"",""))
- }
- elsif cmdRegister>=0 && command==cmdRegister # Register key item
- @bag.pbRegisterKeyItem(item)
- @scene.pbRefresh
- elsif cmdGive>=0 && command==cmdGive # Give item to Pokémon
- if $Trainer.pokemonCount==0
- @scene.pbDisplay(_INTL("There is no Pokémon."))
- elsif pbIsImportantItem?(item)
- @scene.pbDisplay(_INTL("The {1} can't be held.",itemname))
- else
- # Give item to a Pokémon
- pbFadeOutIn(99999){
- sscene=PokemonScreen_Scene.new
- sscreen=PokemonScreen.new(sscene,$Trainer.party)
- sscreen.pbPokemonGiveScreen(item)
- @scene.pbRefresh
- }
- end
- elsif cmdToss>=0 && command==cmdToss # Toss item
- qty=@bag.pbQuantity(item)
- helptext=_INTL("Toss out how many {1}(s)?",itemname)
- qty=@scene.pbChooseNumber(helptext,qty)
- if qty>0
- if pbConfirm(_INTL("Is it OK to throw away {1} {2}(s)?",qty,itemname))
- pbDisplay(_INTL("Threw away {1} {2}(s).",qty,itemname))
- qty.times { @bag.pbDeleteItem(item) }
- end
- end
- elsif cmdMysteryGift>=0 && command==cmdMysteryGift # Export to Mystery Gift
- pbCreateMysteryGift(1,item)
- end
- end
- @scene.pbEndScene
- return item
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement