Created
June 19, 2011 20:36
-
-
Save hugopeixoto/1034715 to your computer and use it in GitHub Desktop.
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
packet :PartyPokemonDetail do | |
uint64 :trainer_id | |
byte :party_index | |
int16 :species_id | |
bool :female | |
int32 :level | |
byte :status | |
uint32 :current_hp | |
uint32 :current_xp | |
byte :pokerus | |
int32 :hit_points | |
int32 :attack | |
int32 :defense | |
int32 :speed | |
int32 :special_attack | |
int32 :special_defense | |
string :nickname | |
end |
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
class PartyPokemonDetail : Ekaiyo.Networking.Packet { | |
public override int DecodingSize { get { return 51; } } | |
public override int EncodingSize { get { return 51 + nickname.Length; } } | |
public UInt64 trainer_id; | |
public byte party_index; | |
public Int16 species_id; | |
public bool female; | |
public Int32 level; | |
public byte status; | |
public UInt32 current_hp; | |
public UInt32 current_xp; | |
public byte pokerus; | |
public Int32 hit_points; | |
public Int32 attack; | |
public Int32 defense; | |
public Int32 speed; | |
public Int32 special_attack; | |
public Int32 special_defense; | |
public string nickname; | |
public PartyPokemonDetail (UInt64 a_trainer_id, byte a_party_index, Int16 a_species_id, bool a_female, Int32 a_level, byte a_status, UInt32 a_current_hp, UInt32 a_current_xp, byte a_pokerus, Int32 a_hit_points, Int32 a_attack, Int32 a_defense, Int32 a_speed, Int32 a_special_attack, Int32 a_special_defense, string a_nickname) | |
: base(PacketType.PartyPokemonDetail) { | |
this.trainer_id = a_trainer_id | |
this.party_index = a_party_index | |
this.species_id = a_species_id | |
this.female = a_female | |
this.level = a_level | |
this.status = a_status | |
this.current_hp = a_current_hp | |
this.current_xp = a_current_xp | |
this.pokerus = a_pokerus | |
this.hit_points = a_hit_points | |
this.attack = a_attack | |
this.defense = a_defense | |
this.speed = a_speed | |
this.special_attack = a_special_attack | |
this.special_defense = a_special_defense | |
this.nickname = a_nickname | |
} | |
public PartyPokemonDetail (byte[] a_buffer, int a_offset, int a_end) | |
: base(PacketType.PartyPokemonDetail) { | |
++offset; | |
offset += Ekaiyo.Networking.Decoder.ToUInt64(buffer, offset, ref this.trainer_id); | |
offset += Ekaiyo.Networking.Decoder.Tobyte(buffer, offset, ref this.party_index); | |
offset += Ekaiyo.Networking.Decoder.ToInt16(buffer, offset, ref this.species_id); | |
offset += Ekaiyo.Networking.Decoder.Tobool(buffer, offset, ref this.female); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.level); | |
offset += Ekaiyo.Networking.Decoder.Tobyte(buffer, offset, ref this.status); | |
offset += Ekaiyo.Networking.Decoder.ToUInt32(buffer, offset, ref this.current_hp); | |
offset += Ekaiyo.Networking.Decoder.ToUInt32(buffer, offset, ref this.current_xp); | |
offset += Ekaiyo.Networking.Decoder.Tobyte(buffer, offset, ref this.pokerus); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.hit_points); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.attack); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.defense); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.speed); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.special_attack); | |
offset += Ekaiyo.Networking.Decoder.ToInt32(buffer, offset, ref this.special_defense); | |
offset += Ekaiyo.Networking.Decoder.Tostring(buffer, offset, ref this.nickname); | |
} | |
public override byte[] GetBytes () { | |
byte[] buffer = new byte[EncodingSize]; | |
int offset = 0; | |
offset += Ekaiyo.Networking.Encoder.Frombyte(buffer, offset, (byte)type); | |
offset += Ekaiyo.Networking.Encoder.FromUInt64(buffer, offset, this.trainer_id); | |
offset += Ekaiyo.Networking.Encoder.Frombyte(buffer, offset, this.party_index); | |
offset += Ekaiyo.Networking.Encoder.FromInt16(buffer, offset, this.species_id); | |
offset += Ekaiyo.Networking.Encoder.Frombool(buffer, offset, this.female); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.level); | |
offset += Ekaiyo.Networking.Encoder.Frombyte(buffer, offset, this.status); | |
offset += Ekaiyo.Networking.Encoder.FromUInt32(buffer, offset, this.current_hp); | |
offset += Ekaiyo.Networking.Encoder.FromUInt32(buffer, offset, this.current_xp); | |
offset += Ekaiyo.Networking.Encoder.Frombyte(buffer, offset, this.pokerus); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.hit_points); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.attack); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.defense); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.speed); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.special_attack); | |
offset += Ekaiyo.Networking.Encoder.FromInt32(buffer, offset, this.special_defense); | |
offset += Ekaiyo.Networking.Encoder.Fromstring(buffer, offset, this.nickname); | |
return buffer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment