YAPOG  0.0.1
Yet Another Pokemon Online Game
PokemonTable.cpp
Go to the documentation of this file.
2 #include "Pokemon/Pokemon.hpp"
3 
4 namespace yse
5 {
13  const yap::PokemonStatus PokemonTable::DEFAULT_STATUS =
15  const bool PokemonTable::DEFAULT_SHINY = false;
23 
25  : accountID_ (DEFAULT_ACCOUNT_ID)
26  , id_ (DEFAULT_ID)
27  , staticID_ (DEFAULT_STATIC_ID)
28  , experience_ (DEFAULT_EXPERIENCE)
29  , hp_ (DEFAULT_HP)
30  , gender_ (DEFAULT_GENDER)
31  , nickname_ (DEFAULT_NICKNAME)
32  , status_ (DEFAULT_STATUS)
33  , shiny_ (DEFAULT_SHINY)
34  , loyalty_ (DEFAULT_LOYALTY)
35  , nature_ (DEFAULT_NATURE)
36  , tradingNumber_ (DEFAULT_TRADING_NUMBER)
37  , traderAccountID_ (DEFAULT_TRADER_ACCOUNT_ID)
38  , boxNumber_ (DEFAULT_BOX_NUMBER)
39  , boxIndex_ (DEFAULT_BOX_INDEX)
40  , catchDate_ (DEFAULT_CATCH_DATE)
41  {
42  }
43 
44  void PokemonTable::LoadFromPokemon (const Pokemon& pokemon)
45  {
46  id_ = pokemon.uniqueID_;
47  staticID_ = pokemon.staticID_;
48  experience_ = pokemon.exp_->GetValue ();
49  hp_ = pokemon.GetCurrentHP ();
50  gender_ = pokemon.gender_;
51  nickname_ = pokemon.nickname_;
52  status_ = pokemon.status_;
53  shiny_ = pokemon.shiny_;
54  loyalty_ = pokemon.loyalty_;
55  nature_ = pokemon.nature_->GetID ();
58  boxNumber_ = pokemon.boxNumber_;
59  boxIndex_ = pokemon.boxIndex_;
60  catchDate_ = pokemon.catchDate_;
61  }
62 
64  const yap::String& trainerName,
65  const yap::PokemonStat& stats,
66  const yap::PokemonMoveSet& moveSet)
67  {
68  Pokemon* pokemon = new Pokemon (
69  id_,
70  staticID_,
71  trainerName,
72  nickname_,
73  stats,
74  gender_,
75  status_,
76  shiny_,
77  loyalty_,
78  moveSet,
79  nature_,
81  boxNumber_,
82  boxIndex_,
83  catchDate_);
84 
85  return pokemon;
86  }
87 
88 } // namespace yse