This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/Beta-Build'
- Loading branch information
Showing
7 changed files
with
665 additions
and
287 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
using POGOProtos.Data; | ||
using POGOProtos.Enums; | ||
using POGOProtos.Networking.Responses; | ||
using System.Collections.Generic; | ||
|
||
namespace PokemonGo.RocketAPI.Window | ||
{ | ||
public class PokemonObject | ||
{ | ||
private static bool initialized; | ||
public static Dictionary<PokemonId, int> candyToEvolveDict = new Dictionary<PokemonId, int>(); | ||
|
||
public PokemonObject(PokemonData pokemonData) | ||
{ | ||
PokemonData = pokemonData; | ||
} | ||
|
||
public PokemonData PokemonData { get; } | ||
|
||
public ulong Id | ||
{ | ||
get { return PokemonData.Id; } | ||
} | ||
|
||
public PokemonId PokemonId | ||
{ | ||
get { return PokemonData.PokemonId; } | ||
} | ||
|
||
public int Cp | ||
{ | ||
get { return PokemonData.Cp; } | ||
} | ||
|
||
public int IndividualAttack | ||
{ | ||
get { return PokemonData.IndividualAttack; } | ||
} | ||
|
||
public int IndividualDefense | ||
{ | ||
get { return PokemonData.IndividualDefense; } | ||
} | ||
|
||
public int IndividualStamina | ||
{ | ||
get { return PokemonData.IndividualStamina; } | ||
} | ||
|
||
public float GetIV | ||
{ | ||
get { return (IndividualAttack + IndividualDefense + IndividualStamina) / 45f; } | ||
} | ||
|
||
public string Nickname { | ||
get { return PokemonData.Nickname; } | ||
} | ||
|
||
public int Candy { get; set; } = 0; | ||
|
||
public int CandyToEvolve | ||
{ | ||
get | ||
{ | ||
if (candyToEvolveDict.ContainsKey(PokemonData.PokemonId)) | ||
{ | ||
return candyToEvolveDict[PokemonData.PokemonId]; | ||
} | ||
return 0; | ||
} | ||
} | ||
|
||
public int EvolveTimes | ||
{ | ||
get | ||
{ | ||
if (CandyToEvolve > 0) | ||
{ | ||
return Candy/CandyToEvolve; | ||
} | ||
return 0; | ||
} | ||
} | ||
|
||
public bool CanEvolve | ||
{ | ||
get { return EvolveTimes > 0; } | ||
} | ||
|
||
public static void Initilize(DownloadItemTemplatesResponse itemtemplates) | ||
{ | ||
if (!initialized) | ||
{ | ||
foreach (var t in itemtemplates.ItemTemplates) | ||
{ | ||
if (t != null) | ||
{ | ||
if (t.PokemonSettings != null) | ||
{ | ||
candyToEvolveDict.Add(t.PokemonSettings.PokemonId, t.PokemonSettings.CandyToEvolve); | ||
} | ||
} | ||
} | ||
initialized = true; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.