Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/main/java/com/pokegoapi/api/map/pokemon/CatchablePokemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class CatchablePokemon {

/**
* Instantiates a new Catchable pokemon.
*
*
* @param api
* the api
* @param proto
Expand All @@ -85,7 +85,7 @@ public CatchablePokemon(PokemonGo api, MapPokemon proto) {

/**
* Instantiates a new Catchable pokemon.
*
*
* @param api
* the api
* @param proto
Expand All @@ -103,7 +103,7 @@ public CatchablePokemon(PokemonGo api, WildPokemon proto) {

/**
* Instantiates a new Catchable pokemon.
*
*
* @param api
* the api
* @param proto
Expand All @@ -126,7 +126,7 @@ public CatchablePokemon(PokemonGo api, FortData proto) {

/**
* Encounter pokemon encounter result.
*
*
* @return the encounter result
* @throws LoginFailedException
* the login failed exception
Expand Down Expand Up @@ -187,7 +187,7 @@ public CatchResult catchPokemonWithRazzBerry() throws LoginFailedException,
/**
* Tries to catch a pokemon (will attempt to use a pokeball, if you have
* none will use greatball etc).
*
*
* @return CatchResult
* @throws LoginFailedException
* if failed to login
Expand Down Expand Up @@ -216,7 +216,7 @@ public CatchResult catchPokemon() throws LoginFailedException,

/**
* Tries to catch a pokeball with the given type.
*
*
* @param pokeball
* Type of pokeball
* @return CatchResult
Expand All @@ -232,7 +232,7 @@ public CatchResult catchPokemon(Pokeball pokeball)

/**
* Tried to catch a pokemon with given pokeball and max number of pokeballs.
*
*
* @param pokeball
* Type of pokeball
* @param amount
Expand Down Expand Up @@ -299,7 +299,7 @@ public CatchResult catchPokemon(double normalizedHitPosition,

/**
* Tries to catch a pokemon.
*
*
* @param normalizedHitPosition
* the normalized hit position
* @param normalizedReticleSize
Expand All @@ -320,8 +320,8 @@ public CatchResult catchPokemon(double normalizedHitPosition,
* if the server failed to respond
*/
public CatchResult catchPokemon(double normalizedHitPosition,
double normalizedReticleSize, double spinModifier, Pokeball type,
int amount, int razberriesLimit) throws LoginFailedException, RemoteServerException {
double normalizedReticleSize, double spinModifier, Pokeball type,
int amount, int razberriesLimit) throws LoginFailedException, RemoteServerException {
if (!isEncountered()) {
return new CatchResult();
}
Expand Down Expand Up @@ -383,7 +383,7 @@ public CatchItemResult useItem(ItemId item) throws LoginFailedException, RemoteS
UseItemCaptureMessage reqMsg = UseItemCaptureMessage
.newBuilder()
.setEncounterId(this.getEncounterId())
.setSpawnPointId(this.getSpawnPointId())
.setSpawnPointGuid(this.getSpawnPointId())
.setItemId(item)
.build();

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/pokegoapi/api/pokemon/MovementType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.pokegoapi.api.pokemon;


public enum MovementType {
PSYCHIC,
FLYING,
ELETRIC,
NORMAL,
HOVERING,
JUMP, ELECTRIC;
}
15 changes: 10 additions & 5 deletions src/main/java/com/pokegoapi/api/pokemon/Pokemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ public EvolutionResult evolve() throws LoginFailedException, RemoteServerExcepti
return result;
}

private PokemonMeta getMeta() {
/**
* Get the meta info for a pokemon.
*
* @return PokemonMeta
*/
public PokemonMeta getMeta() {
if (meta == null) {
meta = PokemonMetaRegistry.getMeta(this.getPokemonId());
}
Expand All @@ -222,7 +227,7 @@ public int getCandy() {
}

public PokemonFamilyId getPokemonFamily() {
return PokemonMetaRegistry.getFamily(this.getPokemonId());
return getMeta().getFamily();
}

public boolean equals(Pokemon other) {
Expand Down Expand Up @@ -364,22 +369,22 @@ public void debug() {


public int getBaseStam() {
return getMeta().getBaseStam();
return getMeta().getBaseStamina();
}

public double getBaseCaptureRate() {
return getMeta().getBaseCaptureRate();
}

public int getCandiesToEvolve() {
return getMeta().getCandiesToEvolve();
return getMeta().getCandyToEvolve();
}

public double getBaseFleeRate() {
return getMeta().getBaseFleeRate();
}

public PokemonIdOuterClass.PokemonId getParent() {
return getMeta().getParent();
return getMeta().getParentId();
}
}
13 changes: 13 additions & 0 deletions src/main/java/com/pokegoapi/api/pokemon/PokemonClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.pokegoapi.api.pokemon;

public enum PokemonClass {
NONE,
VERY_COMMON,
COMMON,
UNCOMMON,
RARE,
VERY_RARE,
EPIC,
LEGENDARY,
MYTHIC;
}
127 changes: 94 additions & 33 deletions src/main/java/com/pokegoapi/api/pokemon/PokemonMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,109 @@

package com.pokegoapi.api.pokemon;

import POGOProtos.Enums.PokemonFamilyIdOuterClass;
import POGOProtos.Enums.PokemonFamilyIdOuterClass.PokemonFamilyId;
import POGOProtos.Enums.PokemonIdOuterClass;
import POGOProtos.Enums.PokemonIdOuterClass.PokemonId;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

public class PokemonMeta {
@Getter
private int baseStam;
@Setter
private String templateId;
@Getter
private double baseCaptureRate;
@Setter
private PokemonFamilyId family;
@Getter
@Setter
private PokemonClass pokemonClass;
@Getter
@Setter
private PokemonType type2;
@Getter
@Setter
private double pokedexHeightM;
@Getter
private int candiesToEvolve;
@Setter
private double heightStdDev;
@Getter
@Setter
private int baseStamina;
@Getter
@Setter
private double cylRadiusM;
@Getter
@Setter
private double baseFleeRate;
@Getter
private PokemonIdOuterClass.PokemonId parent;
@Setter
private int baseAttack;
@Getter
@Setter
private double diskRadiusM;
@Getter
@Setter
private double collisionRadiusM;
@Getter
@Setter
private double pokedexWeightKg;
@Getter
@Setter
private MovementType movementType;
@Getter
@Setter
private PokemonType type1;
@Getter
@Setter
private double collisionHeadRadiusM;
@Getter
@Setter
private double movementTimerS;
@Getter
@Setter
private double jumpTimeS;
@Getter
@Setter
private double modelScale;
@Getter
@Setter
private String uniqueId;
@Getter
@Setter
private int baseDefense;
@Getter
@Setter
private int attackTimerS;
@Getter
@Setter
private double weightStdDev;
@Getter
@Setter
private double cylHeightM;
@Getter
@Setter
private int candyToEvolve;
@Getter
@Setter
private double collisionHeightM;
@Getter
@Setter
private double shoulderModeScale;
@Getter
@Setter
private double baseCaptureRate;
@Getter
@Setter
private PokemonId parentId;
@Getter
@Setter
private double cylGroundM;
@Getter
@Setter
private int number;



/**
* Instantiates a meta pokemon data.
*
* @param baseStam
* autogenerated
* @param baseCaptureRate
* autogenerated
* @param candiesToEvolve
* autogenerated
* @param baseFleeRate
* autogenerated
* @param pokedexHeight
* autogenerated
* @param parent
* autogenerated
*/
public PokemonMeta( int baseStam,
double baseCaptureRate,
int candiesToEvolve,
double baseFleeRate,
double pokedexHeight,
PokemonIdOuterClass.PokemonId parent) {
// did not mean to include pokedex height in output
this.baseStam = baseStam;
this.baseCaptureRate = baseCaptureRate;
this.candiesToEvolve = candiesToEvolve;
this.baseFleeRate = baseFleeRate;
this.parent = parent;
}
}
Loading