mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-22 06:06:01 +00:00
Implemented usage of GameData::Item
This commit is contained in:
@@ -77,6 +77,8 @@ def pbSetUpSystem
|
||||
begin
|
||||
consts = pbSafeLoad("Data/Constants.rxdata")
|
||||
consts = [] if !consts
|
||||
GameData::Ability.load
|
||||
GameData::Item.load
|
||||
rescue
|
||||
consts = []
|
||||
end
|
||||
|
||||
@@ -259,18 +259,17 @@ end
|
||||
|
||||
#===============================================================================
|
||||
# Load item icons
|
||||
# TODO: Put these methods into GameData::Item.
|
||||
#===============================================================================
|
||||
def pbItemIconFile(item)
|
||||
return nil if !item
|
||||
bitmapFileName = nil
|
||||
if item==0
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemBack")
|
||||
else
|
||||
bitmapFileName = sprintf("Graphics/Icons/item%s",getConstantName(PBItems,item)) rescue nil
|
||||
if item
|
||||
itm = GameData::Item.get(item)
|
||||
bitmapFileName = sprintf("Graphics/Icons/item%s",itm.id.to_s) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Icons/item%03d",item)
|
||||
if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item)
|
||||
move = pbGetMachine(item)
|
||||
bitmapFileName = sprintf("Graphics/Icons/item%03d",itm.id_number)
|
||||
if !pbResolveBitmap(bitmapFileName) && itm.is_machine?
|
||||
move = itm.move
|
||||
type = pbGetMoveData(move,MoveData::TYPE)
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",getConstantName(PBTypes,type)) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
@@ -279,14 +278,16 @@ def pbItemIconFile(item)
|
||||
end
|
||||
bitmapFileName = "Graphics/Icons/item000" if !pbResolveBitmap(bitmapFileName)
|
||||
end
|
||||
else
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemBack")
|
||||
end
|
||||
return bitmapFileName
|
||||
end
|
||||
|
||||
def pbHeldItemIconFile(item) # Used in the party screen
|
||||
return nil if !item || item==0
|
||||
namebase = (pbIsMail?(item)) ? "mail" : "item"
|
||||
bitmapFileName = sprintf("Graphics/Pictures/Party/icon_%s_%s",namebase,getConstantName(PBItems,item)) rescue nil
|
||||
namebase = (GameData::Item.get(item).is_mail?) ? "mail" : "item"
|
||||
bitmapFileName = sprintf("Graphics/Pictures/Party/icon_%s_%s",namebase,GameData::Item.get(item).id.to_s) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Pictures/Party/icon_%s_%03d",namebase,item)
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
@@ -303,7 +304,7 @@ end
|
||||
#===============================================================================
|
||||
def pbMailBackFile(item)
|
||||
return nil if !item
|
||||
bitmapFileName = sprintf("Graphics/Pictures/Mail/mail_%s",getConstantName(PBItems,item)) rescue nil
|
||||
bitmapFileName = sprintf("Graphics/Pictures/Mail/mail_%s",GameData::Item.get(item).id.to_s) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Pictures/Mail/mail_%03d",item)
|
||||
end
|
||||
|
||||
@@ -495,7 +495,7 @@ def pbHasEgg?(species)
|
||||
return false if compat.include?(getConst(PBEggGroups,:Ditto))
|
||||
baby = pbGetBabySpecies(species)
|
||||
return true if species==baby # Is a basic species
|
||||
baby = pbGetBabySpecies(species,0,0)
|
||||
baby = pbGetBabySpecies(species,true)
|
||||
return true if species==baby # Is an egg species without incense
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -1064,22 +1064,21 @@ def pbChooseMove(pokemon,variableNumber,nameVarNumber)
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
|
||||
def pbConvertItemToItem(variable,array)
|
||||
item = pbGet(variable)
|
||||
pbSet(variable,0)
|
||||
def pbConvertItemToItem(variable, array)
|
||||
item = GameData::Item.get(pbGet(variable))
|
||||
pbSet(variable, nil)
|
||||
for i in 0...(array.length/2)
|
||||
if isConst?(item,PBItems,array[2*i])
|
||||
pbSet(variable,getID(PBItems,array[2*i+1]))
|
||||
return
|
||||
end
|
||||
next if item != array[2 * i]
|
||||
pbSet(variable, array[2 * i + 1])
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def pbConvertItemToPokemon(variable,array)
|
||||
item = pbGet(variable)
|
||||
pbSet(variable,0)
|
||||
item = GameData::Item.get(pbGet(variable))
|
||||
pbSet(variable, 0)
|
||||
for i in 0...(array.length/2)
|
||||
next if !isConst?(item,PBItems,array[2*i])
|
||||
next if item != array[2 * i]
|
||||
pbSet(variable,getID(PBSpecies,array[2*i+1]))
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user