Advertisement
User12345678910

Untitled

Nov 11th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PROProtocol
  8. {
  9.     public class ChatPokemon
  10.     {
  11.         public int Id { get; private set; }
  12.         public string Name => PokemonNamesManager.Instance.Names[Id];
  13.         public int Level { get; private set; }
  14.         public int Health { get; private set; }
  15.  
  16.         public bool IsShiny { get; private set; }
  17.         public string Gender { get; private set; }
  18.         public PokemonNature Nature { get; private set; }
  19.         public PokemonAbility Ability { get; private set; }
  20.         public int Happiness { get; private set; }
  21.         public PokemonStats Stats { get; private set; }
  22.         public PokemonStats IV { get; private set; }
  23.         public int Form { get; private set; }
  24.         public PokemonType Type1 { get; private set; }
  25.         public PokemonType Type2 { get; private set; }
  26.  
  27.         public string Types
  28.         {
  29.             get
  30.             {
  31.                 if (Type2 == PokemonType.None)
  32.                     return Type1.ToString();
  33.  
  34.                 return Type1 + "/" + Type2;
  35.             }
  36.         }
  37.  
  38.         //id,level,shiny[0|1],iv_hp,iv_atk,iv_def,iv_spd,iv_spatk,iv_spdef,atk,def,spd,spatk,spdef,hp,[F|M|?],Ability,Nature,happiness,form
  39.         public ChatPokemon(string[] data)
  40.         {
  41.             if(data[0].Contains("."))
  42.             {
  43.                 string[] st = data[0].Split('.');
  44.                 Id = Convert.ToInt32(st[st.Length - 1]);
  45.             }          
  46.             else
  47.             {
  48.                 Id = Convert.ToInt32(data[0]);
  49.             }
  50.             Level = Convert.ToInt32(data[1]);
  51.             Health = Convert.ToInt32(data[14]);
  52.  
  53.             IsShiny = data[2] == "1";
  54.             Gender = data[15];
  55.  
  56.             Form = Convert.ToInt32(data[19]);
  57.             Nature = new PokemonNature(Convert.ToInt32(data[17]));
  58.             Ability = new PokemonAbility(Convert.ToInt32(data[16]));
  59.             Happiness = Convert.ToInt32(data[18]);
  60.  
  61.             Stats = new PokemonStats(data, 9, Health);
  62.             IV = new PokemonStats(data, 3);
  63.  
  64.             Type1 = TypesManager.Instance.Type1[Id];
  65.             Type2 = TypesManager.Instance.Type2[Id];
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement