mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Adds support for shinies in online wondertrade
This commit is contained in:
Binary file not shown.
@@ -1,7 +1,4 @@
|
|||||||
class OnlineWondertrade
|
class OnlineWondertrade
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pbWonderTrade()
|
def pbWonderTrade()
|
||||||
givenPokemon = selectPokemonToGive
|
givenPokemon = selectPokemonToGive
|
||||||
return if givenPokemon == nil
|
return if givenPokemon == nil
|
||||||
@@ -11,6 +8,8 @@ class OnlineWondertrade
|
|||||||
if response[:status] == 200
|
if response[:status] == 200
|
||||||
body = HTTPLite::JSON.parse(response[:body])
|
body = HTTPLite::JSON.parse(response[:body])
|
||||||
doTrade(body)
|
doTrade(body)
|
||||||
|
else
|
||||||
|
pbMessage("Could not find a trading partner...")
|
||||||
end
|
end
|
||||||
rescue MKXPError
|
rescue MKXPError
|
||||||
pbMessage("There was an error while sending your Pokémon...")
|
pbMessage("There was an error while sending your Pokémon...")
|
||||||
@@ -26,16 +25,37 @@ class OnlineWondertrade
|
|||||||
receivedPokemonTrainerName = receivedData["trainer_name"]
|
receivedPokemonTrainerName = receivedData["trainer_name"]
|
||||||
receivedPokemonTrainerGender = receivedData["trainer_gender"].to_i
|
receivedPokemonTrainerGender = receivedData["trainer_gender"].to_i
|
||||||
|
|
||||||
|
is_head_shiny = receivedData["head_shiny"]
|
||||||
|
is_body_shiny = receivedData["body_shiny"]
|
||||||
|
is_debug_shiny = receivedData["debug_shiny"]
|
||||||
|
|
||||||
newpoke = pbStartTrade(pbGet(1), receivedPokemonSpecies, receivedPokemonName, receivedPokemonTrainerName, receivedPokemonTrainerGender, true) # Starts the trade
|
newpoke = pbStartTrade(pbGet(1), receivedPokemonSpecies, receivedPokemonName, receivedPokemonTrainerName, receivedPokemonTrainerGender, true) # Starts the trade
|
||||||
newpoke.owner=Pokemon::Owner.new(receivedPokemonTrainerId.to_i,receivedPokemonOT,2,2)
|
newpoke.owner=Pokemon::Owner.new(receivedPokemonTrainerId.to_i,receivedPokemonOT,2,2)
|
||||||
newpoke.level=receivedPokemonLevel
|
newpoke.level=receivedPokemonLevel
|
||||||
|
|
||||||
|
if is_head_shiny || is_body_shiny
|
||||||
|
newpoke.shiny=true
|
||||||
|
newpoke.head_shiny=is_head_shiny
|
||||||
|
newpoke.body_shiny = is_body_shiny
|
||||||
|
if is_debug_shiny
|
||||||
|
newpoke.debug_shiny=false
|
||||||
|
newpoke.natural_shiny=true
|
||||||
|
else
|
||||||
|
newpoke.debug_shiny=true
|
||||||
|
newpoke.natural_shiny=false
|
||||||
|
end
|
||||||
|
end
|
||||||
newpoke.calc_stats
|
newpoke.calc_stats
|
||||||
end
|
end
|
||||||
|
|
||||||
def selectPokemonToGive
|
def selectPokemonToGive
|
||||||
pbChoosePokemon(1, 2, # Choose eligable pokemon
|
pbChoosePokemon(1, 2, # Choose eligable pokemon
|
||||||
proc {
|
proc {
|
||||||
|poke| !poke.egg? && !(poke.isShadow?)
|
|poke| !poke.egg? &&
|
||||||
|
!(poke.isShadow?) &&
|
||||||
|
poke.isFusion? &&
|
||||||
|
customSpriteExists(poke.species) #&&
|
||||||
|
# !poke.debug_shiny
|
||||||
})
|
})
|
||||||
poke = $Trainer.party[pbGet(1)]
|
poke = $Trainer.party[pbGet(1)]
|
||||||
|
|
||||||
@@ -48,6 +68,7 @@ class OnlineWondertrade
|
|||||||
|
|
||||||
# @param [Pokemon] givenPokemon
|
# @param [Pokemon] givenPokemon
|
||||||
def buildWondertradeQueryJson(givenPokemon)
|
def buildWondertradeQueryJson(givenPokemon)
|
||||||
|
isDebugShiny = givenPokemon.debug_shiny || !givenPokemon.natural_shiny
|
||||||
postData = {
|
postData = {
|
||||||
"trainer_name" => $Trainer.name,
|
"trainer_name" => $Trainer.name,
|
||||||
"trainer_gender" => $Trainer.gender,
|
"trainer_gender" => $Trainer.gender,
|
||||||
@@ -58,6 +79,11 @@ class OnlineWondertrade
|
|||||||
"nickname" => givenPokemon.name,
|
"nickname" => givenPokemon.name,
|
||||||
"original_trainer_name" => givenPokemon.owner.name,
|
"original_trainer_name" => givenPokemon.owner.name,
|
||||||
"original_trainer_id" => givenPokemon.owner.id.to_s,
|
"original_trainer_id" => givenPokemon.owner.id.to_s,
|
||||||
|
"body_shiny" => givenPokemon.body_shiny == nil ? false : givenPokemon.body_shiny,
|
||||||
|
"head_shiny" => givenPokemon.head_shiny == nil ? false : givenPokemon.head_shiny,
|
||||||
|
"debug_shiny" => isDebugShiny,
|
||||||
|
"original_trainer_id" => givenPokemon.owner.id.to_s,
|
||||||
|
|
||||||
}
|
}
|
||||||
return HTTPLite::JSON.stringify(postData)
|
return HTTPLite::JSON.stringify(postData)
|
||||||
end
|
end
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user