mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-23 14:56:00 +00:00
Refactoring and tidying
This commit is contained in:
@@ -108,110 +108,6 @@ def pbMapTree
|
||||
return retarray
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Make up internal names for things based on their actual names
|
||||
#===============================================================================
|
||||
module MakeshiftConsts
|
||||
@@consts = []
|
||||
|
||||
def self.get(c,i,modname=nil)
|
||||
@@consts[c] = [] if !@@consts[c]
|
||||
return @@consts[c][i] if @@consts[c][i]
|
||||
if modname
|
||||
v = getConstantName(modname,i) rescue nil
|
||||
if v
|
||||
@@consts[c][i] = v
|
||||
return v
|
||||
end
|
||||
end
|
||||
trname = pbGetMessage(c,i)
|
||||
trconst = trname.gsub(/é/,"e")
|
||||
trconst = trconst.upcase
|
||||
trconst = trconst.gsub(/♀/,"fE")
|
||||
trconst = trconst.gsub(/♂/,"mA")
|
||||
trconst = trconst.gsub(/[^A-Za-z0-9_]/,"")
|
||||
if trconst.length==0
|
||||
return nil if trname.length==0
|
||||
trconst = sprintf("T_%03d",i)
|
||||
elsif !trconst[0,1][/[A-Z]/]
|
||||
trconst = "T_"+trconst
|
||||
end
|
||||
while @@consts[c].include?(trconst)
|
||||
trconst = sprintf("%s_%03d",trconst,i)
|
||||
end
|
||||
@@consts[c][i] = trconst
|
||||
return trconst
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbGetEvolutionConst(i)
|
||||
ret = MakeshiftConsts.get(50,i,PBEvolution)
|
||||
if !ret
|
||||
ret = ["None",
|
||||
"Happiness","HappinessDay","HappinessNight","Level","Trade",
|
||||
"TradeItem","Item","AttackGreater","AtkDefEqual","DefenseGreater",
|
||||
"Silcoon","Cascoon","Ninjask","Shedinja","Beauty",
|
||||
"ItemMale","ItemFemale","DayHoldItem","NightHoldItem","HasMove",
|
||||
"HasInParty","LevelMale","LevelFemale","Location","TradeSpecies",
|
||||
"Custom1","Custom2","Custom3","Custom4","Custom5"]
|
||||
i = 0 if i>=ret.length || i<0
|
||||
ret = ret[i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetEggGroupConst(i)
|
||||
ret = MakeshiftConsts.get(51,i,PBEggGroups)
|
||||
if !ret
|
||||
ret = ["Undiscovered",
|
||||
"Monster","Water1","Bug","Flying","Field",
|
||||
"Fairy","Grass","Humanlike","Water3","Mineral",
|
||||
"Amorphous","Water2","Ditto","Dragon"][i]
|
||||
i = 0 if i>=ret.length || i<0
|
||||
ret = ret[i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetColorConst(i)
|
||||
ret = MakeshiftConsts.get(52,i,PBColors)
|
||||
if !ret
|
||||
ret = ["Red","Blue","Yellow","Green","Black","Brown","Purple","Gray","White","Pink"]
|
||||
i = 0 if i>=ret.length || i<0
|
||||
ret = ret[i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetGenderConst(i)
|
||||
ret = MakeshiftConsts.get(53,i,PBGenderRates)
|
||||
if !ret
|
||||
ret = ["Genderless","AlwaysMale","FemaleOneEighth","Female25Percent",
|
||||
"Female50Percent","Female75Percent","FemaleSevenEighths",
|
||||
"AlwaysFemale"]
|
||||
i = 0 if i>=ret.length || i<0
|
||||
ret = ret[i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetHabitatConst(i)
|
||||
ret = MakeshiftConsts.get(54,i,PBHabitats)
|
||||
if !ret
|
||||
ret = ["","Grassland","Forest","WatersEdge","Sea","Cave","Mountain",
|
||||
"RoughTerrain","Urban","Rare"]
|
||||
i = 0 if i>=ret.length || i<0
|
||||
ret = ret[i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# List all members of a class
|
||||
#===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user