Fixed error in evolution data saved to pokemon.txt

This commit is contained in:
Maruno17
2020-09-16 17:56:51 +01:00
parent 0f61f3f5ae
commit 36e492a3fe
5 changed files with 27 additions and 14 deletions

View File

@@ -839,11 +839,14 @@ def pbSavePokemonData
pokedata.write(",") if count>0 pokedata.write(",") if count>0
pokedata.write(sprintf("%s,%s,",cnew_species,evoname)) pokedata.write(sprintf("%s,%s,",cnew_species,evoname))
param_type = PBEvolution.getFunction(method, "parameterType") param_type = PBEvolution.getFunction(method, "parameterType")
if param_type has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
cparameter = getConstantName(param_type,parameter) rescue "" if has_param
pokedata.write("#{cparameter}") if param_type
else cparameter = (getConstantName(param_type, parameter) rescue parameter)
pokedata.write("#{parameter}") pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
end
end end
count += 1 count += 1
end end
@@ -1299,11 +1302,14 @@ def pbSavePokemonFormsData
next if !cnew_species || cnew_species=="" next if !cnew_species || cnew_species==""
pokedata.write(sprintf("%s,%s,",cnew_species,evoname)) pokedata.write(sprintf("%s,%s,",cnew_species,evoname))
param_type = PBEvolution.getFunction(method, "parameterType") param_type = PBEvolution.getFunction(method, "parameterType")
if param_type has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
cparameter = getConstantName(param_type,parameter) rescue "" if has_param
pokedata.write("#{cparameter}") if param_type
else cparameter = (getConstantName(param_type, parameter) rescue parameter)
pokedata.write("#{parameter}") pokedata.write("#{cparameter}")
else
pokedata.write("#{parameter}")
end
end end
pokedata.write(",") if k<evos.length-1 pokedata.write(",") if k<evos.length-1
end end

View File

@@ -793,6 +793,7 @@ end
def pbGetConst(mod,item,err) def pbGetConst(mod,item,err)
isDef = false isDef = false
begin begin
mod = Object.const_get(mod) if mod.is_a?(Symbol)
isDef = mod.const_defined?(item.to_sym) isDef = mod.const_defined?(item.to_sym)
rescue rescue
raise sprintf(err,item) raise sprintf(err,item)
@@ -802,6 +803,7 @@ def pbGetConst(mod,item,err)
end end
def getConstantName(mod,value) def getConstantName(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants for c in mod.constants
return c if mod.const_get(c.to_sym)==value return c if mod.const_get(c.to_sym)==value
end end
@@ -809,6 +811,7 @@ def getConstantName(mod,value)
end end
def getConstantNameOrValue(mod,value) def getConstantNameOrValue(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants for c in mod.constants
return c if mod.const_get(c.to_sym)==value return c if mod.const_get(c.to_sym)==value
end end
@@ -816,6 +819,7 @@ def getConstantNameOrValue(mod,value)
end end
def setConstantName(mod,value,name) def setConstantName(mod,value,name)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants for c in mod.constants
mod.send(:remove_const,c.to_sym) if mod.const_get(c.to_sym)==value mod.send(:remove_const,c.to_sym) if mod.const_get(c.to_sym)==value
end end
@@ -823,6 +827,7 @@ def setConstantName(mod,value,name)
end end
def removeConstantValue(mod,value) def removeConstantValue(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants for c in mod.constants
mod.send(:remove_const,c.to_sym) if mod.const_get(c.to_sym)==value mod.send(:remove_const,c.to_sym) if mod.const_get(c.to_sym)==value
end end

View File

@@ -815,7 +815,7 @@ Habitat = Forest
RegionalNumbers = 25,22 RegionalNumbers = 25,22
Kind = Mouse Kind = Mouse
Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt. Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt.
WildItemuNCOMMON = LIGHTBALL WildItemUncommon = LIGHTBALL
BattlerPlayerX = -5 BattlerPlayerX = -5
BattlerPlayerY = 0 BattlerPlayerY = 0
BattlerEnemyX = 4 BattlerEnemyX = 4
@@ -9618,7 +9618,7 @@ BattlerEnemyX = -1
BattlerEnemyY = 29 BattlerEnemyY = 29
BattlerShadowX = 0 BattlerShadowX = 0
BattlerShadowSize = 2 BattlerShadowSize = 2
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,20 Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,
#------------------------------- #-------------------------------
[291] [291]
Name = Ninjask Name = Ninjask

View File

@@ -816,6 +816,7 @@ Habitat = Forest
RegionalNumbers = 25,22 RegionalNumbers = 25,22
Kind = Mouse Kind = Mouse
Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt. Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt.
WildItemUncommon = LIGHTBALL
BattlerPlayerX = -5 BattlerPlayerX = -5
BattlerPlayerY = 0 BattlerPlayerY = 0
BattlerEnemyX = 4 BattlerEnemyX = 4
@@ -9617,7 +9618,7 @@ BattlerEnemyX = -1
BattlerEnemyY = 29 BattlerEnemyY = 29
BattlerShadowX = 0 BattlerShadowX = 0
BattlerShadowSize = 2 BattlerShadowSize = 2
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,20 Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,
#------------------------------- #-------------------------------
[291] [291]
Name = Ninjask Name = Ninjask

View File

@@ -816,6 +816,7 @@ Habitat = Forest
RegionalNumbers = 25,22 RegionalNumbers = 25,22
Kind = Mouse Kind = Mouse
Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt. Pokedex = It stores electricity in the electric sacs on its cheeks. When it releases pent-up energy in a burst, the electric power is equal to a lightning bolt.
WildItemUncommon = LIGHTBALL
BattlerPlayerX = -5 BattlerPlayerX = -5
BattlerPlayerY = 0 BattlerPlayerY = 0
BattlerEnemyX = 4 BattlerEnemyX = 4
@@ -9617,7 +9618,7 @@ BattlerEnemyX = -1
BattlerEnemyY = 29 BattlerEnemyY = 29
BattlerShadowX = 0 BattlerShadowX = 0
BattlerShadowSize = 2 BattlerShadowSize = 2
Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,20 Evolutions = NINJASK,Ninjask,20,SHEDINJA,Shedinja,
#------------------------------- #-------------------------------
[291] [291]
Name = Ninjask Name = Ninjask