diff options
37 files changed, 5585 insertions, 219 deletions
diff --git a/src/ints/little.cpp b/src/ints/little.cpp new file mode 100644 index 0000000..2f81954 --- /dev/null +++ b/src/ints/little.cpp @@ -0,0 +1,21 @@ +#include "little.hpp" +// little.cpp - integers of known endianness +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" diff --git a/src/ints/little.hpp b/src/ints/little.hpp new file mode 100644 index 0000000..d7d57ff --- /dev/null +++ b/src/ints/little.hpp @@ -0,0 +1,131 @@ +#ifndef TMWA_INTS_LITTLE_HPP +#define TMWA_INTS_LITTLE_HPP +// little.hpp - integers of known endianness +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +# include "fwd.hpp" + +# include <endian.h> + +# include <cstdint> + +// We implement our own actual swapping, because glibc emits assembly +// instead of letting the *compiler* do what it does best. +# if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN +# error "broken endians" +# endif + +namespace ints +{ + // TODO hoist this to byte.hpp and also implement big.hpp + struct Byte + { + uint8_t value; + }; + + struct Little16 + { + uint8_t data[2]; + }; + + struct Little32 + { + uint8_t data[4]; + }; + + struct Little64 + { + uint8_t data[8]; + }; + + inline __attribute__((warn_unused_result)) + bool native_to_network(Byte *net, uint8_t nat) + { + net->value = nat; + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little16 *net, uint16_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap16(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little32 *net, uint32_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap32(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little64 *net, uint64_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap64(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + + inline __attribute__((warn_unused_result)) + bool network_to_native(uint8_t *nat, Byte net) + { + *nat = net.value; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(uint16_t *nat, Little16 net) + { + uint16_t tmp; + __builtin_memcpy(&tmp, &net, 2); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap16(tmp); + *nat = tmp; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(uint32_t *nat, Little32 net) + { + uint32_t tmp; + __builtin_memcpy(&tmp, &net, 4); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap32(tmp); + *nat = tmp; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(uint64_t *nat, Little64 net) + { + uint64_t tmp; + __builtin_memcpy(&tmp, &net, 8); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap64(tmp); + *nat = tmp; + return true; + } +} // namespace ints + +using ints::Byte; +using ints::Little16; +using ints::Little32; +using ints::Little64; + +#endif // TMWA_INTS_LITTLE_HPP diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp index 10aeb75..e40befa 100644 --- a/src/map/map.t.hpp +++ b/src/map/map.t.hpp @@ -590,7 +590,6 @@ struct NpcName : VString<23> {}; struct ScriptLabel : VString<23> {}; struct ItemName : VString<23> {}; -class BlockId : public Wrapped<uint32_t> { public: BlockId() : Wrapped<uint32_t>() {} protected: constexpr explicit BlockId(uint32_t a) : Wrapped<uint32_t>(a) {} }; inline BlockId account_to_block(AccountId a) { return wrap<BlockId>(unwrap<AccountId>(a)); } inline diff --git a/src/mmo/enums.cpp b/src/mmo/enums.cpp new file mode 100644 index 0000000..fe01c5d --- /dev/null +++ b/src/mmo/enums.cpp @@ -0,0 +1,21 @@ +#include "enums.hpp" +// enums.cpp - Common enumerated types +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp new file mode 100644 index 0000000..a7dcc89 --- /dev/null +++ b/src/mmo/enums.hpp @@ -0,0 +1,148 @@ +#ifndef TMWA_MMO_ENUMS_HPP +#define TMWA_MMO_ENUMS_HPP +// enums.hpp - Common enumerated types +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +# include "fwd.hpp" + +# include <cstdint> + +# include "../generic/enum.hpp" + +enum class SkillID : uint16_t; +constexpr SkillID MAX_SKILL = SkillID(474); // not 450 +constexpr SkillID get_enum_min_value(SkillID) { return SkillID(); } +constexpr SkillID get_enum_max_value(SkillID) { return MAX_SKILL; } + +namespace e +{ +enum class EPOS : uint16_t +{ + ZERO = 0x0000, + + LEGS = 0x0001, + WEAPON = 0x0002, + GLOVES = 0x0004, + CAPE = 0x0008, + MISC1 = 0x0010, + SHIELD = 0x0020, + SHOES = 0x0040, + MISC2 = 0x0080, + HAT = 0x0100, + TORSO = 0x0200, + + ARROW = 0x8000, +}; +ENUM_BITWISE_OPERATORS(EPOS) + +constexpr EPOS get_enum_min_value(EPOS) { return EPOS(0x0000); } +constexpr EPOS get_enum_max_value(EPOS) { return EPOS(0xffff); } +} +using e::EPOS; + +namespace e +{ +enum class SkillFlags : uint16_t; +} +using e::SkillFlags; + +// Option and Opt1..3 in map.hpp +namespace e +{ +enum class Option : uint16_t; +constexpr Option get_enum_min_value(Option) { return Option(0x0000); } +constexpr Option get_enum_max_value(Option) { return Option(0xffff); } +} +using e::Option; + +enum class ATTR +{ + STR = 0, + AGI = 1, + VIT = 2, + INT = 3, + DEX = 4, + LUK = 5, + + COUNT = 6, +}; + +constexpr ATTR ATTRs[6] = +{ + ATTR::STR, + ATTR::AGI, + ATTR::VIT, + ATTR::INT, + ATTR::DEX, + ATTR::LUK, +}; + +enum class ItemLook : uint16_t +{ + NONE = 0, + BLADE = 1, // or some other common weapons + _2, + SETZER_AND_SCYTHE = 3, + _6, + STAFF = 10, + BOW = 11, + _13 = 13, + _14 = 14, + _16 = 16, + SINGLE_HANDED_COUNT = 17, + + DUAL_BLADE = 0x11, + DUAL_2 = 0x12, + DUAL_6 = 0x13, + DUAL_12 = 0x14, + DUAL_16 = 0x15, + DUAL_26 = 0x16, +}; + +enum class SEX : uint8_t +{ + FEMALE = 0, + MALE = 1, + // For items. This is also used as error, sometime. + NEUTRAL = 2, +}; +inline +char sex_to_char(SEX sex) +{ + switch (sex) + { + case SEX::FEMALE: return 'F'; + case SEX::MALE: return 'M'; + default: return '\0'; + } +} +inline +SEX sex_from_char(char c) +{ + switch (c) + { + case 'F': return SEX::FEMALE; + case 'M': return SEX::MALE; + default: return SEX::NEUTRAL; + } +} + +#endif // TMWA_MMO_ENUMS_HPP diff --git a/src/mmo/ids.hpp b/src/mmo/ids.hpp index 3c5b1ba..ed5ab58 100644 --- a/src/mmo/ids.hpp +++ b/src/mmo/ids.hpp @@ -21,6 +21,7 @@ # include "fwd.hpp" +# include "../ints/little.hpp" # include "../ints/wrap.hpp" # include "extract.hpp" @@ -33,6 +34,8 @@ class CharId : public Wrapped<uint32_t> { public: CharId() : Wrapped<uint32_t>() class PartyId : public Wrapped<uint32_t> { public: PartyId() : Wrapped<uint32_t>() {} protected: constexpr explicit PartyId(uint32_t a) : Wrapped<uint32_t>(a) {} }; class ItemNameId : public Wrapped<uint16_t> { public: ItemNameId() : Wrapped<uint16_t>() {} protected: constexpr explicit ItemNameId(uint16_t a) : Wrapped<uint16_t>(a) {} }; +class BlockId : public Wrapped<uint32_t> { public: BlockId() : Wrapped<uint32_t>() {} protected: constexpr explicit BlockId(uint32_t a) : Wrapped<uint32_t>(a) {} }; + class GmLevel { uint32_t bits; @@ -98,6 +101,30 @@ public: { return l.bits != r.bits; } + + friend + bool native_to_network(Byte *network, GmLevel native) + { + network->value = native.bits; + return true; // LIES. But this code is going away soon anyway + } + friend + bool network_to_native(GmLevel *native, Byte network) + { + native->bits = network.value; + return true; // LIES. But this code is going away soon anyway + } + + friend + bool native_to_network(Little32 *network, GmLevel native) + { + return native_to_network(network, native.bits); + } + friend + bool network_to_native(GmLevel *native, Little32 network) + { + return network_to_native(&native->bits, network); + } }; inline diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index c72d815..a0cee57 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -27,17 +27,13 @@ # include "../compat/memory.hpp" -# include "../strings/vstring.hpp" - # include "../generic/array.hpp" -# include "../generic/enum.hpp" # include "../net/timer.t.hpp" +# include "enums.hpp" # include "ids.hpp" - -// affects CharName -# define NAME_IGNORING_CASE 1 +# include "strs.hpp" constexpr int FIFOSIZE_SERVERLINK = 256 * 1024; @@ -47,11 +43,6 @@ constexpr int MAX_AMOUNT = 30000; constexpr int MAX_ZENY = 1000000000; // 1G zeny constexpr int TRADE_MAX = 10; -enum class SkillID : uint16_t; -constexpr SkillID MAX_SKILL = SkillID(474); // not 450 -constexpr SkillID get_enum_min_value(SkillID) { return SkillID(); } -constexpr SkillID get_enum_max_value(SkillID) { return MAX_SKILL; } - constexpr int GLOBAL_REG_NUM = 96; constexpr int ACCOUNT_REG_NUM = 16; constexpr int ACCOUNT_REG2_NUM = 16; @@ -68,126 +59,6 @@ constexpr int MAX_PARTY = 12; # define MIN_CLOTH_COLOR battle_config.min_cloth_color # define MAX_CLOTH_COLOR battle_config.max_cloth_color -struct AccountName : VString<23> {}; -struct AccountPass : VString<23> {}; -struct AccountCrypt : VString<39> {}; -struct AccountEmail : VString<39> {}; -struct ServerName : VString<19> {}; -struct PartyName : VString<23> {}; -struct VarName : VString<31> {}; - -# define DEFAULT_EMAIL stringish<AccountEmail>("a@a.com"_s) - -// It is decreed: a mapname shall not contain an extension -class MapName : public strings::_crtp_string<MapName, MapName, strings::ZPair> -{ - VString<15> _impl; -public: - MapName() = default; - MapName(VString<15> v) : _impl(v.xislice_h(std::find(v.begin(), v.end(), '.'))) {} - - iterator begin() const { return &*_impl.begin(); } - iterator end() const { return &*_impl.end(); } - const char *c_str() const { return _impl.c_str(); } - - operator RString() const { return _impl; } - operator AString() const { return _impl; } - operator TString() const { return _impl; } - operator SString() const { return _impl; } - operator ZString() const { return _impl; } - operator XString() const { return _impl; } -}; -template<> -inline -MapName stringish<MapName>(VString<15> iv) -{ - return iv; -} -inline -const char *decay_for_printf(const MapName& vs) { return vs.c_str(); } - -// It is decreed: a charname is sometimes case sensitive -struct CharName -{ -private: - VString<23> _impl; -public: - CharName() = default; - explicit CharName(VString<23> name) - : _impl(name) - {} - - VString<23> to__actual() const - { - return _impl; - } - VString<23> to__lower() const - { - return _impl.to_lower(); - } - VString<23> to__upper() const - { - return _impl.to_upper(); - } - VString<23> to__canonical() const - { -# if NAME_IGNORING_CASE == 0 - return to__actual(); -# endif -# if NAME_IGNORING_CASE == 1 - return to__lower(); -# endif - } - - friend bool operator == (const CharName& l, const CharName& r) - { return l.to__canonical() == r.to__canonical(); } - friend bool operator != (const CharName& l, const CharName& r) - { return l.to__canonical() != r.to__canonical(); } - friend bool operator < (const CharName& l, const CharName& r) - { return l.to__canonical() < r.to__canonical(); } - friend bool operator <= (const CharName& l, const CharName& r) - { return l.to__canonical() <= r.to__canonical(); } - friend bool operator > (const CharName& l, const CharName& r) - { return l.to__canonical() > r.to__canonical(); } - friend bool operator >= (const CharName& l, const CharName& r) - { return l.to__canonical() >= r.to__canonical(); } - - friend - VString<23> convert_for_printf(const CharName& vs) { return vs.to__actual(); } -}; -template<> -inline -CharName stringish<CharName>(VString<23> iv) -{ - return CharName(iv); -} - -namespace e -{ -enum class EPOS : uint16_t -{ - ZERO = 0x0000, - - LEGS = 0x0001, - WEAPON = 0x0002, - GLOVES = 0x0004, - CAPE = 0x0008, - MISC1 = 0x0010, - SHIELD = 0x0020, - SHOES = 0x0040, - MISC2 = 0x0080, - HAT = 0x0100, - TORSO = 0x0200, - - ARROW = 0x8000, -}; -ENUM_BITWISE_OPERATORS(EPOS) - -constexpr EPOS get_enum_min_value(EPOS) { return EPOS(0x0000); } -constexpr EPOS get_enum_max_value(EPOS) { return EPOS(0xffff); } -} -using e::EPOS; - struct item { ItemNameId nameid; @@ -201,12 +72,6 @@ struct point short x, y; }; -namespace e -{ -enum class SkillFlags : uint16_t; -} -using e::SkillFlags; - struct skill_value { unsigned short lv; @@ -228,87 +93,6 @@ struct global_reg int value; }; -// Option and Opt1..3 in map.hpp -namespace e -{ -enum class Option : uint16_t; -constexpr Option get_enum_min_value(Option) { return Option(0x0000); } -constexpr Option get_enum_max_value(Option) { return Option(0xffff); } -} -using e::Option; - -enum class ATTR -{ - STR = 0, - AGI = 1, - VIT = 2, - INT = 3, - DEX = 4, - LUK = 5, - - COUNT = 6, -}; - -constexpr ATTR ATTRs[6] = -{ - ATTR::STR, - ATTR::AGI, - ATTR::VIT, - ATTR::INT, - ATTR::DEX, - ATTR::LUK, -}; - -enum class ItemLook : uint16_t -{ - NONE = 0, - BLADE = 1, // or some other common weapons - _2, - SETZER_AND_SCYTHE = 3, - _6, - STAFF = 10, - BOW = 11, - _13 = 13, - _14 = 14, - _16 = 16, - SINGLE_HANDED_COUNT = 17, - - DUAL_BLADE = 0x11, - DUAL_2 = 0x12, - DUAL_6 = 0x13, - DUAL_12 = 0x14, - DUAL_16 = 0x15, - DUAL_26 = 0x16, -}; - -enum class SEX : uint8_t -{ - FEMALE = 0, - MALE = 1, - // For items. This is also used as error, sometime. - NEUTRAL = 2, -}; -inline -char sex_to_char(SEX sex) -{ - switch (sex) - { - case SEX::FEMALE: return 'F'; - case SEX::MALE: return 'M'; - default: return '\0'; - } -} -inline -SEX sex_from_char(char c) -{ - switch (c) - { - case 'F': return SEX::FEMALE; - case 'M': return SEX::MALE; - default: return SEX::NEUTRAL; - } -} - struct CharKey { CharName name; diff --git a/src/mmo/strs.cpp b/src/mmo/strs.cpp new file mode 100644 index 0000000..979d6ac --- /dev/null +++ b/src/mmo/strs.cpp @@ -0,0 +1,21 @@ +#include "strs.hpp" +// strs.cpp - common string types +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" diff --git a/src/mmo/strs.hpp b/src/mmo/strs.hpp new file mode 100644 index 0000000..ad2a1b5 --- /dev/null +++ b/src/mmo/strs.hpp @@ -0,0 +1,125 @@ +#ifndef TMWA_MMO_STRS_HPP +#define TMWA_MMO_STRS_HPP +// strs.hpp - common string types +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +# include "fwd.hpp" + +# include "../strings/vstring.hpp" + +// affects CharName +# define NAME_IGNORING_CASE 1 + +struct AccountName : VString<23> {}; +struct AccountPass : VString<23> {}; +struct AccountCrypt : VString<39> {}; +struct AccountEmail : VString<39> {}; +struct ServerName : VString<19> {}; +struct PartyName : VString<23> {}; +struct VarName : VString<31> {}; + +# define DEFAULT_EMAIL stringish<AccountEmail>("a@a.com"_s) + +// It is decreed: a mapname shall not contain an extension +class MapName : public strings::_crtp_string<MapName, MapName, strings::ZPair> +{ + VString<15> _impl; +public: + MapName() = default; + MapName(VString<15> v) : _impl(v.xislice_h(std::find(v.begin(), v.end(), '.'))) {} + + iterator begin() const { return &*_impl.begin(); } + iterator end() const { return &*_impl.end(); } + const char *c_str() const { return _impl.c_str(); } + + operator RString() const { return _impl; } + operator AString() const { return _impl; } + operator TString() const { return _impl; } + operator SString() const { return _impl; } + operator ZString() const { return _impl; } + operator XString() const { return _impl; } +}; +template<> +inline +MapName stringish<MapName>(VString<15> iv) +{ + return iv; +} +inline +const char *decay_for_printf(const MapName& vs) { return vs.c_str(); } + +// It is decreed: a charname is sometimes case sensitive +struct CharName +{ +private: + VString<23> _impl; +public: + CharName() = default; + explicit CharName(VString<23> name) + : _impl(name) + {} + + VString<23> to__actual() const + { + return _impl; + } + VString<23> to__lower() const + { + return _impl.to_lower(); + } + VString<23> to__upper() const + { + return _impl.to_upper(); + } + VString<23> to__canonical() const + { +# if NAME_IGNORING_CASE == 0 + return to__actual(); +# endif +# if NAME_IGNORING_CASE == 1 + return to__lower(); +# endif + } + + friend bool operator == (const CharName& l, const CharName& r) + { return l.to__canonical() == r.to__canonical(); } + friend bool operator != (const CharName& l, const CharName& r) + { return l.to__canonical() != r.to__canonical(); } + friend bool operator < (const CharName& l, const CharName& r) + { return l.to__canonical() < r.to__canonical(); } + friend bool operator <= (const CharName& l, const CharName& r) + { return l.to__canonical() <= r.to__canonical(); } + friend bool operator > (const CharName& l, const CharName& r) + { return l.to__canonical() > r.to__canonical(); } + friend bool operator >= (const CharName& l, const CharName& r) + { return l.to__canonical() >= r.to__canonical(); } + + friend + VString<23> convert_for_printf(const CharName& vs) { return vs.to__actual(); } +}; +template<> +inline +CharName stringish<CharName>(VString<23> iv) +{ + return CharName(iv); +} + +#endif // TMWA_MMO_STRS_HPP diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp index 9837358..ddfbca6 100644 --- a/src/mmo/utils.hpp +++ b/src/mmo/utils.hpp @@ -27,6 +27,8 @@ # include <type_traits> +# include "../ints/little.hpp" + # include "../strings/fwd.hpp" # include "../strings/vstring.hpp" @@ -107,6 +109,40 @@ long long& convert_for_scanf(TimeT& t) return t.value; } +// 2038 problem +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *net, TimeT nat) +{ + time_t tmp = nat; + return native_to_network(net, static_cast<uint32_t>(tmp)); +} + +inline __attribute__((warn_unused_result)) +bool network_to_native(TimeT *nat, Little32 net) +{ + uint32_t tmp; + bool rv = network_to_native(&tmp, net); + *nat = static_cast<time_t>(tmp); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(Little64 *net, TimeT nat) +{ + time_t tmp = nat; + return native_to_network(net, static_cast<uint64_t>(tmp)); +} + +inline __attribute__((warn_unused_result)) +bool network_to_native(TimeT *nat, Little64 net) +{ + uint64_t tmp; + bool rv = network_to_native(&tmp, net); + *nat = static_cast<time_t>(tmp); + return rv; +} + + struct timestamp_seconds_buffer : VString<19> {}; struct timestamp_milliseconds_buffer : VString<23> {}; void stamp_time(timestamp_seconds_buffer&, const TimeT *t=nullptr); diff --git a/src/proto2/any-user.hpp b/src/proto2/any-user.hpp new file mode 100644 index 0000000..f2847ef --- /dev/null +++ b/src/proto2/any-user.hpp @@ -0,0 +1,111 @@ +#ifndef TMWA_PROTO2_ANY_USER_HPP +#define TMWA_PROTO2_ANY_USER_HPP +// any-user.hpp - TMWA network protocol: any/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + +struct RPacket0x7530_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7530_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7530_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7530_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7530_Fixed) == 2, "sizeof(NetRPacket0x7530_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7530_Fixed *network, RPacket0x7530_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7530_Fixed *native, NetRPacket0x7530_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct SPacket0x7531_Fixed +{ + uint16_t packet_id; + Version version; +}; +struct NetSPacket0x7531_Fixed +{ + Little16 packet_id; + NetVersion version; +}; +static_assert(offsetof(NetSPacket0x7531_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7531_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7531_Fixed, version) == 2, "offsetof(NetSPacket0x7531_Fixed, version) == 2"); +static_assert(sizeof(NetSPacket0x7531_Fixed) == 10, "sizeof(NetSPacket0x7531_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7531_Fixed *network, SPacket0x7531_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->version, native.version); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7531_Fixed *native, NetSPacket0x7531_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->version, network.version); + return rv; +} + +struct RPacket0x7532_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7532_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7532_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7532_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7532_Fixed) == 2, "sizeof(NetRPacket0x7532_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7532_Fixed *network, RPacket0x7532_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7532_Fixed *native, NetRPacket0x7532_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + + +#endif // TMWA_PROTO2_ANY_USER_HPP diff --git a/src/proto2/any-user_test.cpp b/src/proto2/any-user_test.cpp new file mode 100644 index 0000000..5096d24 --- /dev/null +++ b/src/proto2/any-user_test.cpp @@ -0,0 +1,23 @@ +#include "any-user.hpp" +// any-user_test.cpp - TMWA network protocol: any/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/char-map.hpp b/src/proto2/char-map.hpp new file mode 100644 index 0000000..3caa2df --- /dev/null +++ b/src/proto2/char-map.hpp @@ -0,0 +1,31 @@ +#ifndef TMWA_PROTO2_CHAR_MAP_HPP +#define TMWA_PROTO2_CHAR_MAP_HPP +// char-map.hpp - TMWA network protocol: char/map +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is an internal protocol, and can be changed without notice + + +#endif // TMWA_PROTO2_CHAR_MAP_HPP diff --git a/src/proto2/char-map_test.cpp b/src/proto2/char-map_test.cpp new file mode 100644 index 0000000..1b6ccb1 --- /dev/null +++ b/src/proto2/char-map_test.cpp @@ -0,0 +1,23 @@ +#include "char-map.hpp" +// char-map_test.cpp - TMWA network protocol: char/map +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/char-user.hpp b/src/proto2/char-user.hpp new file mode 100644 index 0000000..d85d768 --- /dev/null +++ b/src/proto2/char-user.hpp @@ -0,0 +1,31 @@ +#ifndef TMWA_PROTO2_CHAR_USER_HPP +#define TMWA_PROTO2_CHAR_USER_HPP +// char-user.hpp - TMWA network protocol: char/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + + +#endif // TMWA_PROTO2_CHAR_USER_HPP diff --git a/src/proto2/char-user_test.cpp b/src/proto2/char-user_test.cpp new file mode 100644 index 0000000..952d196 --- /dev/null +++ b/src/proto2/char-user_test.cpp @@ -0,0 +1,23 @@ +#include "char-user.hpp" +// char-user_test.cpp - TMWA network protocol: char/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/fwd.hpp b/src/proto2/fwd.hpp new file mode 100644 index 0000000..023ebe5 --- /dev/null +++ b/src/proto2/fwd.hpp @@ -0,0 +1,26 @@ +#ifndef TMWA_PROTO2_FWD_HPP +#define TMWA_PROTO2_FWD_HPP +// proto2/fwd.hpp - Forward declarations of network packets +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +# include "../sanity.hpp" + +// TODO put stuff here + +#endif // TMWA_PROTO2_FWD_HPP diff --git a/src/proto2/include_cstdint_test.cpp b/src/proto2/include_cstdint_test.cpp new file mode 100644 index 0000000..a067574 --- /dev/null +++ b/src/proto2/include_cstdint_test.cpp @@ -0,0 +1,26 @@ +#include <cstdint> +// include_cstdint_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_uint8_t = uint8_t; +using Test_uint16_t = uint16_t; +using Test_uint32_t = uint32_t; +using Test_uint64_t = uint64_t; diff --git a/src/proto2/include_enums_test.cpp b/src/proto2/include_enums_test.cpp new file mode 100644 index 0000000..a335c81 --- /dev/null +++ b/src/proto2/include_enums_test.cpp @@ -0,0 +1,23 @@ +#include "../mmo/enums.hpp" +// include_enums_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_SEX = SEX; diff --git a/src/proto2/include_human_time_diff_test.cpp b/src/proto2/include_human_time_diff_test.cpp new file mode 100644 index 0000000..25a111d --- /dev/null +++ b/src/proto2/include_human_time_diff_test.cpp @@ -0,0 +1,23 @@ +#include "../mmo/human_time_diff.hpp" +// include_human_time_diff_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_HumanTimeDiff = HumanTimeDiff; diff --git a/src/proto2/include_ids_test.cpp b/src/proto2/include_ids_test.cpp new file mode 100644 index 0000000..63e1753 --- /dev/null +++ b/src/proto2/include_ids_test.cpp @@ -0,0 +1,29 @@ +#include "../mmo/ids.hpp" +// include_ids_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_Species = Species; +using Test_AccountId = AccountId; +using Test_CharId = CharId; +using Test_PartyId = PartyId; +using Test_ItemNameId = ItemNameId; +using Test_BlockId = BlockId; +using Test_GmLevel = GmLevel; diff --git a/src/proto2/include_ip_test.cpp b/src/proto2/include_ip_test.cpp new file mode 100644 index 0000000..bae7c3a --- /dev/null +++ b/src/proto2/include_ip_test.cpp @@ -0,0 +1,23 @@ +#include "../net/ip.hpp" +// include_ip_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_IP4Address = IP4Address; diff --git a/src/proto2/include_little_test.cpp b/src/proto2/include_little_test.cpp new file mode 100644 index 0000000..70cb5d2 --- /dev/null +++ b/src/proto2/include_little_test.cpp @@ -0,0 +1,26 @@ +#include "../ints/little.hpp" +// include_little_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_Byte = Byte; +using Test_Little16 = Little16; +using Test_Little32 = Little32; +using Test_Little64 = Little64; diff --git a/src/proto2/include_strs_test.cpp b/src/proto2/include_strs_test.cpp new file mode 100644 index 0000000..1087f3a --- /dev/null +++ b/src/proto2/include_strs_test.cpp @@ -0,0 +1,27 @@ +#include "../mmo/strs.hpp" +// include_strs_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_AccountName = AccountName; +using Test_AccountPass = AccountPass; +using Test_AccountEmail = AccountEmail; +using Test_ServerName = ServerName; +using Test_VarName = VarName; diff --git a/src/proto2/include_utils_test.cpp b/src/proto2/include_utils_test.cpp new file mode 100644 index 0000000..840ed5f --- /dev/null +++ b/src/proto2/include_utils_test.cpp @@ -0,0 +1,25 @@ +#include "../mmo/utils.hpp" +// include_utils_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_TimeT = TimeT; +using Test_timestamp_seconds_buffer = timestamp_seconds_buffer; +using Test_timestamp_milliseconds_buffer = timestamp_milliseconds_buffer; diff --git a/src/proto2/include_version_test.cpp b/src/proto2/include_version_test.cpp new file mode 100644 index 0000000..d635efc --- /dev/null +++ b/src/proto2/include_version_test.cpp @@ -0,0 +1,23 @@ +#include "../mmo/version.hpp" +// include_version_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_Version = Version; diff --git a/src/proto2/include_vstring_test.cpp b/src/proto2/include_vstring_test.cpp new file mode 100644 index 0000000..f415127 --- /dev/null +++ b/src/proto2/include_vstring_test.cpp @@ -0,0 +1,27 @@ +#include "../strings/vstring.hpp" +// include_vstring_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_VString_15_ = VString<15>; +using Test_VString_19_ = VString<19>; +using Test_VString_23_ = VString<23>; +using Test_VString_31_ = VString<31>; +using Test_VString_39_ = VString<39>; diff --git a/src/proto2/login-admin.hpp b/src/proto2/login-admin.hpp new file mode 100644 index 0000000..635ed44 --- /dev/null +++ b/src/proto2/login-admin.hpp @@ -0,0 +1,1781 @@ +#ifndef TMWA_PROTO2_LOGIN_ADMIN_HPP +#define TMWA_PROTO2_LOGIN_ADMIN_HPP +// login-admin.hpp - TMWA network protocol: login/admin +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is an internal protocol, and can be changed without notice + +struct RPacket0x2726_Head +{ + uint16_t packet_id; + uint16_t unused; + uint32_t string_length; +}; +struct NetRPacket0x2726_Head +{ + Little16 packet_id; + Little16 unused; + Little32 string_length; +}; +static_assert(offsetof(NetRPacket0x2726_Head, packet_id) == 0, "offsetof(NetRPacket0x2726_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2726_Head, unused) == 2, "offsetof(NetRPacket0x2726_Head, unused) == 2"); +static_assert(offsetof(NetRPacket0x2726_Head, string_length) == 4, "offsetof(NetRPacket0x2726_Head, string_length) == 4"); +static_assert(sizeof(NetRPacket0x2726_Head) == 8, "sizeof(NetRPacket0x2726_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2726_Head *network, RPacket0x2726_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->unused, native.unused); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2726_Head *native, NetRPacket0x2726_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->unused, network.unused); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct RPacket0x2726_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x2726_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x2726_Repeat, c) == 0, "offsetof(NetRPacket0x2726_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x2726_Repeat) == 1, "sizeof(NetRPacket0x2726_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2726_Repeat *network, RPacket0x2726_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2726_Repeat *native, NetRPacket0x2726_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct RPacket0x7920_Head +{ + uint16_t packet_id; + uint32_t start_account_id; + uint32_t end_account_id; +}; +struct NetRPacket0x7920_Head +{ + Little16 packet_id; + Little32 start_account_id; + Little32 end_account_id; +}; +static_assert(offsetof(NetRPacket0x7920_Head, packet_id) == 0, "offsetof(NetRPacket0x7920_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7920_Head, start_account_id) == 2, "offsetof(NetRPacket0x7920_Head, start_account_id) == 2"); +static_assert(offsetof(NetRPacket0x7920_Head, end_account_id) == 6, "offsetof(NetRPacket0x7920_Head, end_account_id) == 6"); +static_assert(sizeof(NetRPacket0x7920_Head) == 10, "sizeof(NetRPacket0x7920_Head) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7920_Head *network, RPacket0x7920_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->start_account_id, native.start_account_id); + rv &= native_to_network(&network->end_account_id, native.end_account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7920_Head *native, NetRPacket0x7920_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->start_account_id, network.start_account_id); + rv &= network_to_native(&native->end_account_id, network.end_account_id); + return rv; +} + +struct RPacket0x7920_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x7920_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x7920_Repeat, c) == 0, "offsetof(NetRPacket0x7920_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x7920_Repeat) == 1, "sizeof(NetRPacket0x7920_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7920_Repeat *network, RPacket0x7920_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7920_Repeat *native, NetRPacket0x7920_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x7921_Head +{ + uint16_t packet_id; + uint16_t packet_length; +}; +struct NetSPacket0x7921_Head +{ + Little16 packet_id; + Little16 packet_length; +}; +static_assert(offsetof(NetSPacket0x7921_Head, packet_id) == 0, "offsetof(NetSPacket0x7921_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7921_Head, packet_length) == 2, "offsetof(NetSPacket0x7921_Head, packet_length) == 2"); +static_assert(sizeof(NetSPacket0x7921_Head) == 4, "sizeof(NetSPacket0x7921_Head) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7921_Head *network, SPacket0x7921_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7921_Head *native, NetSPacket0x7921_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + return rv; +} + +struct SPacket0x7921_Repeat +{ + uint32_t account_id; + GmLevel gm_level; + AccountName account_name; + SEX sex; + uint32_t login_count; + uint32_t status; +}; +struct NetSPacket0x7921_Repeat +{ + Little32 account_id; + Byte gm_level; + NetString<sizeof(AccountName)> account_name; + Byte sex; + Little32 login_count; + Little32 status; +}; +static_assert(offsetof(NetSPacket0x7921_Repeat, account_id) == 0, "offsetof(NetSPacket0x7921_Repeat, account_id) == 0"); +static_assert(offsetof(NetSPacket0x7921_Repeat, gm_level) == 4, "offsetof(NetSPacket0x7921_Repeat, gm_level) == 4"); +static_assert(offsetof(NetSPacket0x7921_Repeat, account_name) == 5, "offsetof(NetSPacket0x7921_Repeat, account_name) == 5"); +static_assert(offsetof(NetSPacket0x7921_Repeat, sex) == 29, "offsetof(NetSPacket0x7921_Repeat, sex) == 29"); +static_assert(offsetof(NetSPacket0x7921_Repeat, login_count) == 30, "offsetof(NetSPacket0x7921_Repeat, login_count) == 30"); +static_assert(offsetof(NetSPacket0x7921_Repeat, status) == 34, "offsetof(NetSPacket0x7921_Repeat, status) == 34"); +static_assert(sizeof(NetSPacket0x7921_Repeat) == 38, "sizeof(NetSPacket0x7921_Repeat) == 38"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7921_Repeat *network, SPacket0x7921_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->sex, native.sex); + rv &= native_to_network(&network->login_count, native.login_count); + rv &= native_to_network(&network->status, native.status); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7921_Repeat *native, NetSPacket0x7921_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->sex, network.sex); + rv &= network_to_native(&native->login_count, network.login_count); + rv &= network_to_native(&native->status, network.status); + return rv; +} + +struct RPacket0x7924_Fixed +{ + uint16_t packet_id; + uint32_t source_item_id; + uint32_t dest_item_id; +}; +struct NetRPacket0x7924_Fixed +{ + Little16 packet_id; + Little32 source_item_id; + Little32 dest_item_id; +}; +static_assert(offsetof(NetRPacket0x7924_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7924_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7924_Fixed, source_item_id) == 2, "offsetof(NetRPacket0x7924_Fixed, source_item_id) == 2"); +static_assert(offsetof(NetRPacket0x7924_Fixed, dest_item_id) == 6, "offsetof(NetRPacket0x7924_Fixed, dest_item_id) == 6"); +static_assert(sizeof(NetRPacket0x7924_Fixed) == 10, "sizeof(NetRPacket0x7924_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7924_Fixed *network, RPacket0x7924_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->source_item_id, native.source_item_id); + rv &= native_to_network(&network->dest_item_id, native.dest_item_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7924_Fixed *native, NetRPacket0x7924_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->source_item_id, network.source_item_id); + rv &= network_to_native(&native->dest_item_id, network.dest_item_id); + return rv; +} + +struct SPacket0x7925_Fixed +{ + uint16_t packet_id; +}; +struct NetSPacket0x7925_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetSPacket0x7925_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7925_Fixed, packet_id) == 0"); +static_assert(sizeof(NetSPacket0x7925_Fixed) == 2, "sizeof(NetSPacket0x7925_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7925_Fixed *network, SPacket0x7925_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7925_Fixed *native, NetSPacket0x7925_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct RPacket0x7930_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountPass password; + SEX sex; + AccountEmail email; +}; +struct NetRPacket0x7930_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + NetString<sizeof(AccountPass)> password; + Byte sex; + NetString<sizeof(AccountEmail)> email; +}; +static_assert(offsetof(NetRPacket0x7930_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7930_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7930_Fixed, account_name) == 2, "offsetof(NetRPacket0x7930_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7930_Fixed, password) == 26, "offsetof(NetRPacket0x7930_Fixed, password) == 26"); +static_assert(offsetof(NetRPacket0x7930_Fixed, sex) == 50, "offsetof(NetRPacket0x7930_Fixed, sex) == 50"); +static_assert(offsetof(NetRPacket0x7930_Fixed, email) == 51, "offsetof(NetRPacket0x7930_Fixed, email) == 51"); +static_assert(sizeof(NetRPacket0x7930_Fixed) == 91, "sizeof(NetRPacket0x7930_Fixed) == 91"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7930_Fixed *network, RPacket0x7930_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->password, native.password); + rv &= native_to_network(&network->sex, native.sex); + rv &= native_to_network(&network->email, native.email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7930_Fixed *native, NetRPacket0x7930_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->password, network.password); + rv &= network_to_native(&native->sex, network.sex); + rv &= network_to_native(&native->email, network.email); + return rv; +} + +struct SPacket0x7931_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7931_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7931_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7931_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7931_Fixed, account_id) == 2, "offsetof(NetSPacket0x7931_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7931_Fixed, account_name) == 6, "offsetof(NetSPacket0x7931_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7931_Fixed) == 30, "sizeof(NetSPacket0x7931_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7931_Fixed *network, SPacket0x7931_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7931_Fixed *native, NetSPacket0x7931_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7932_Fixed +{ + uint16_t packet_id; + AccountName account_name; +}; +struct NetRPacket0x7932_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetRPacket0x7932_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7932_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7932_Fixed, account_name) == 2, "offsetof(NetRPacket0x7932_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket0x7932_Fixed) == 26, "sizeof(NetRPacket0x7932_Fixed) == 26"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7932_Fixed *network, RPacket0x7932_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7932_Fixed *native, NetRPacket0x7932_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct SPacket0x7933_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7933_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7933_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7933_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7933_Fixed, account_id) == 2, "offsetof(NetSPacket0x7933_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7933_Fixed, account_name) == 6, "offsetof(NetSPacket0x7933_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7933_Fixed) == 30, "sizeof(NetSPacket0x7933_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7933_Fixed *network, SPacket0x7933_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7933_Fixed *native, NetSPacket0x7933_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7934_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountPass password; +}; +struct NetRPacket0x7934_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + NetString<sizeof(AccountPass)> password; +}; +static_assert(offsetof(NetRPacket0x7934_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7934_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7934_Fixed, account_name) == 2, "offsetof(NetRPacket0x7934_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7934_Fixed, password) == 26, "offsetof(NetRPacket0x7934_Fixed, password) == 26"); +static_assert(sizeof(NetRPacket0x7934_Fixed) == 50, "sizeof(NetRPacket0x7934_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7934_Fixed *network, RPacket0x7934_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->password, native.password); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7934_Fixed *native, NetRPacket0x7934_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->password, network.password); + return rv; +} + +struct SPacket0x7935_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7935_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7935_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7935_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7935_Fixed, account_id) == 2, "offsetof(NetSPacket0x7935_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7935_Fixed, account_name) == 6, "offsetof(NetSPacket0x7935_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7935_Fixed) == 30, "sizeof(NetSPacket0x7935_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7935_Fixed *network, SPacket0x7935_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7935_Fixed *native, NetSPacket0x7935_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7936_Fixed +{ + uint16_t packet_id; + AccountName account_name; + uint32_t status; + timestamp_seconds_buffer error_message; +}; +struct NetRPacket0x7936_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + Little32 status; + NetString<sizeof(timestamp_seconds_buffer)> error_message; +}; +static_assert(offsetof(NetRPacket0x7936_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7936_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7936_Fixed, account_name) == 2, "offsetof(NetRPacket0x7936_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7936_Fixed, status) == 26, "offsetof(NetRPacket0x7936_Fixed, status) == 26"); +static_assert(offsetof(NetRPacket0x7936_Fixed, error_message) == 30, "offsetof(NetRPacket0x7936_Fixed, error_message) == 30"); +static_assert(sizeof(NetRPacket0x7936_Fixed) == 50, "sizeof(NetRPacket0x7936_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7936_Fixed *network, RPacket0x7936_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->status, native.status); + rv &= native_to_network(&network->error_message, native.error_message); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7936_Fixed *native, NetRPacket0x7936_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->status, network.status); + rv &= network_to_native(&native->error_message, network.error_message); + return rv; +} + +struct SPacket0x7937_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7937_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7937_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7937_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7937_Fixed, account_id) == 2, "offsetof(NetSPacket0x7937_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7937_Fixed, account_name) == 6, "offsetof(NetSPacket0x7937_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7937_Fixed) == 30, "sizeof(NetSPacket0x7937_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7937_Fixed *network, SPacket0x7937_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7937_Fixed *native, NetSPacket0x7937_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7938_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7938_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7938_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7938_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7938_Fixed) == 2, "sizeof(NetRPacket0x7938_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7938_Fixed *network, RPacket0x7938_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7938_Fixed *native, NetRPacket0x7938_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct SPacket0x7939_Head +{ + uint16_t packet_id; + uint16_t packet_length; +}; +struct NetSPacket0x7939_Head +{ + Little16 packet_id; + Little16 packet_length; +}; +static_assert(offsetof(NetSPacket0x7939_Head, packet_id) == 0, "offsetof(NetSPacket0x7939_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7939_Head, packet_length) == 2, "offsetof(NetSPacket0x7939_Head, packet_length) == 2"); +static_assert(sizeof(NetSPacket0x7939_Head) == 4, "sizeof(NetSPacket0x7939_Head) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7939_Head *network, SPacket0x7939_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7939_Head *native, NetSPacket0x7939_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + return rv; +} + +struct SPacket0x7939_Repeat +{ + IP4Address ip; + uint16_t port; + ServerName name; + uint16_t users; + uint16_t maintenance; + uint16_t is_new; +}; +struct NetSPacket0x7939_Repeat +{ + IP4Address ip; + Little16 port; + NetString<sizeof(ServerName)> name; + Little16 users; + Little16 maintenance; + Little16 is_new; +}; +static_assert(offsetof(NetSPacket0x7939_Repeat, ip) == 0, "offsetof(NetSPacket0x7939_Repeat, ip) == 0"); +static_assert(offsetof(NetSPacket0x7939_Repeat, port) == 4, "offsetof(NetSPacket0x7939_Repeat, port) == 4"); +static_assert(offsetof(NetSPacket0x7939_Repeat, name) == 6, "offsetof(NetSPacket0x7939_Repeat, name) == 6"); +static_assert(offsetof(NetSPacket0x7939_Repeat, users) == 26, "offsetof(NetSPacket0x7939_Repeat, users) == 26"); +static_assert(offsetof(NetSPacket0x7939_Repeat, maintenance) == 28, "offsetof(NetSPacket0x7939_Repeat, maintenance) == 28"); +static_assert(offsetof(NetSPacket0x7939_Repeat, is_new) == 30, "offsetof(NetSPacket0x7939_Repeat, is_new) == 30"); +static_assert(sizeof(NetSPacket0x7939_Repeat) == 32, "sizeof(NetSPacket0x7939_Repeat) == 32"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7939_Repeat *network, SPacket0x7939_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->ip, native.ip); + rv &= native_to_network(&network->port, native.port); + rv &= native_to_network(&network->name, native.name); + rv &= native_to_network(&network->users, native.users); + rv &= native_to_network(&network->maintenance, native.maintenance); + rv &= native_to_network(&network->is_new, native.is_new); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7939_Repeat *native, NetSPacket0x7939_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->ip, network.ip); + rv &= network_to_native(&native->port, network.port); + rv &= network_to_native(&native->name, network.name); + rv &= network_to_native(&native->users, network.users); + rv &= network_to_native(&native->maintenance, network.maintenance); + rv &= network_to_native(&native->is_new, network.is_new); + return rv; +} + +struct RPacket0x793a_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountPass password; +}; +struct NetRPacket0x793a_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + NetString<sizeof(AccountPass)> password; +}; +static_assert(offsetof(NetRPacket0x793a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793a_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x793a_Fixed, account_name) == 2, "offsetof(NetRPacket0x793a_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x793a_Fixed, password) == 26, "offsetof(NetRPacket0x793a_Fixed, password) == 26"); +static_assert(sizeof(NetRPacket0x793a_Fixed) == 50, "sizeof(NetRPacket0x793a_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x793a_Fixed *network, RPacket0x793a_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->password, native.password); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x793a_Fixed *native, NetRPacket0x793a_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->password, network.password); + return rv; +} + +struct SPacket0x793b_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x793b_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x793b_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793b_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x793b_Fixed, account_id) == 2, "offsetof(NetSPacket0x793b_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x793b_Fixed, account_name) == 6, "offsetof(NetSPacket0x793b_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x793b_Fixed) == 30, "sizeof(NetSPacket0x793b_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x793b_Fixed *network, SPacket0x793b_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x793b_Fixed *native, NetSPacket0x793b_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x793c_Fixed +{ + uint16_t packet_id; + AccountName account_name; + SEX sex; +}; +struct NetRPacket0x793c_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + Byte sex; +}; +static_assert(offsetof(NetRPacket0x793c_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793c_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x793c_Fixed, account_name) == 2, "offsetof(NetRPacket0x793c_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x793c_Fixed, sex) == 26, "offsetof(NetRPacket0x793c_Fixed, sex) == 26"); +static_assert(sizeof(NetRPacket0x793c_Fixed) == 27, "sizeof(NetRPacket0x793c_Fixed) == 27"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x793c_Fixed *network, RPacket0x793c_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->sex, native.sex); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x793c_Fixed *native, NetRPacket0x793c_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->sex, network.sex); + return rv; +} + +struct SPacket0x793d_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x793d_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x793d_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793d_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x793d_Fixed, account_id) == 2, "offsetof(NetSPacket0x793d_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x793d_Fixed, account_name) == 6, "offsetof(NetSPacket0x793d_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x793d_Fixed) == 30, "sizeof(NetSPacket0x793d_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x793d_Fixed *network, SPacket0x793d_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x793d_Fixed *native, NetSPacket0x793d_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x793e_Fixed +{ + uint16_t packet_id; + AccountName account_name; + GmLevel gm_level; +}; +struct NetRPacket0x793e_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + Byte gm_level; +}; +static_assert(offsetof(NetRPacket0x793e_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793e_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x793e_Fixed, account_name) == 2, "offsetof(NetRPacket0x793e_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x793e_Fixed, gm_level) == 26, "offsetof(NetRPacket0x793e_Fixed, gm_level) == 26"); +static_assert(sizeof(NetRPacket0x793e_Fixed) == 27, "sizeof(NetRPacket0x793e_Fixed) == 27"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x793e_Fixed *network, RPacket0x793e_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->gm_level, native.gm_level); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x793e_Fixed *native, NetRPacket0x793e_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->gm_level, network.gm_level); + return rv; +} + +struct SPacket0x793f_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x793f_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x793f_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793f_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x793f_Fixed, account_id) == 2, "offsetof(NetSPacket0x793f_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x793f_Fixed, account_name) == 6, "offsetof(NetSPacket0x793f_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x793f_Fixed) == 30, "sizeof(NetSPacket0x793f_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x793f_Fixed *network, SPacket0x793f_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x793f_Fixed *native, NetSPacket0x793f_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7940_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountEmail email; +}; +struct NetRPacket0x7940_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + NetString<sizeof(AccountEmail)> email; +}; +static_assert(offsetof(NetRPacket0x7940_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7940_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7940_Fixed, account_name) == 2, "offsetof(NetRPacket0x7940_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7940_Fixed, email) == 26, "offsetof(NetRPacket0x7940_Fixed, email) == 26"); +static_assert(sizeof(NetRPacket0x7940_Fixed) == 66, "sizeof(NetRPacket0x7940_Fixed) == 66"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7940_Fixed *network, RPacket0x7940_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->email, native.email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7940_Fixed *native, NetRPacket0x7940_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->email, network.email); + return rv; +} + +struct SPacket0x7941_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7941_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7941_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7941_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7941_Fixed, account_id) == 2, "offsetof(NetSPacket0x7941_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7941_Fixed, account_name) == 6, "offsetof(NetSPacket0x7941_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7941_Fixed) == 30, "sizeof(NetSPacket0x7941_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7941_Fixed *network, SPacket0x7941_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7941_Fixed *native, NetSPacket0x7941_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7942_Head +{ + uint16_t packet_id; + AccountName account_name; + uint16_t string_length; +}; +struct NetRPacket0x7942_Head +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + Little16 string_length; +}; +static_assert(offsetof(NetRPacket0x7942_Head, packet_id) == 0, "offsetof(NetRPacket0x7942_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7942_Head, account_name) == 2, "offsetof(NetRPacket0x7942_Head, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7942_Head, string_length) == 26, "offsetof(NetRPacket0x7942_Head, string_length) == 26"); +static_assert(sizeof(NetRPacket0x7942_Head) == 28, "sizeof(NetRPacket0x7942_Head) == 28"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7942_Head *network, RPacket0x7942_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7942_Head *native, NetRPacket0x7942_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct RPacket0x7942_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x7942_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x7942_Repeat, c) == 0, "offsetof(NetRPacket0x7942_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x7942_Repeat) == 1, "sizeof(NetRPacket0x7942_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7942_Repeat *network, RPacket0x7942_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7942_Repeat *native, NetRPacket0x7942_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x7943_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7943_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7943_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7943_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7943_Fixed, account_id) == 2, "offsetof(NetSPacket0x7943_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7943_Fixed, account_name) == 6, "offsetof(NetSPacket0x7943_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7943_Fixed) == 30, "sizeof(NetSPacket0x7943_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7943_Fixed *network, SPacket0x7943_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7943_Fixed *native, NetSPacket0x7943_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7944_Fixed +{ + uint16_t packet_id; + AccountName account_name; +}; +struct NetRPacket0x7944_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetRPacket0x7944_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7944_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7944_Fixed, account_name) == 2, "offsetof(NetRPacket0x7944_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket0x7944_Fixed) == 26, "sizeof(NetRPacket0x7944_Fixed) == 26"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7944_Fixed *network, RPacket0x7944_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7944_Fixed *native, NetRPacket0x7944_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct SPacket0x7945_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7945_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7945_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7945_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7945_Fixed, account_id) == 2, "offsetof(NetSPacket0x7945_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7945_Fixed, account_name) == 6, "offsetof(NetSPacket0x7945_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7945_Fixed) == 30, "sizeof(NetSPacket0x7945_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7945_Fixed *network, SPacket0x7945_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7945_Fixed *native, NetSPacket0x7945_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7946_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x7946_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x7946_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7946_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7946_Fixed, account_id) == 2, "offsetof(NetRPacket0x7946_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x7946_Fixed) == 6, "sizeof(NetRPacket0x7946_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7946_Fixed *network, RPacket0x7946_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7946_Fixed *native, NetRPacket0x7946_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x7947_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7947_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetSPacket0x7947_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7947_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7947_Fixed, account_id) == 2, "offsetof(NetSPacket0x7947_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7947_Fixed, account_name) == 6, "offsetof(NetSPacket0x7947_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7947_Fixed) == 30, "sizeof(NetSPacket0x7947_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7947_Fixed *network, SPacket0x7947_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7947_Fixed *native, NetSPacket0x7947_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7948_Fixed +{ + uint16_t packet_id; + AccountName account_name; + TimeT valid_until; +}; +struct NetRPacket0x7948_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetRPacket0x7948_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7948_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7948_Fixed, account_name) == 2, "offsetof(NetRPacket0x7948_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7948_Fixed, valid_until) == 26, "offsetof(NetRPacket0x7948_Fixed, valid_until) == 26"); +static_assert(sizeof(NetRPacket0x7948_Fixed) == 30, "sizeof(NetRPacket0x7948_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7948_Fixed *network, RPacket0x7948_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_until, native.valid_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7948_Fixed *native, NetRPacket0x7948_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_until, network.valid_until); + return rv; +} + +struct SPacket0x7949_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT valid_until; +}; +struct NetSPacket0x7949_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetSPacket0x7949_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7949_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7949_Fixed, account_id) == 2, "offsetof(NetSPacket0x7949_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7949_Fixed, account_name) == 6, "offsetof(NetSPacket0x7949_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x7949_Fixed, valid_until) == 30, "offsetof(NetSPacket0x7949_Fixed, valid_until) == 30"); +static_assert(sizeof(NetSPacket0x7949_Fixed) == 34, "sizeof(NetSPacket0x7949_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7949_Fixed *network, SPacket0x7949_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_until, native.valid_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7949_Fixed *native, NetSPacket0x7949_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_until, network.valid_until); + return rv; +} + +struct RPacket0x794a_Fixed +{ + uint16_t packet_id; + AccountName account_name; + TimeT ban_until; +}; +struct NetRPacket0x794a_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetRPacket0x794a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x794a_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x794a_Fixed, account_name) == 2, "offsetof(NetRPacket0x794a_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x794a_Fixed, ban_until) == 26, "offsetof(NetRPacket0x794a_Fixed, ban_until) == 26"); +static_assert(sizeof(NetRPacket0x794a_Fixed) == 30, "sizeof(NetRPacket0x794a_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794a_Fixed *network, RPacket0x794a_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_until, native.ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794a_Fixed *native, NetRPacket0x794a_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_until, network.ban_until); + return rv; +} + +struct SPacket0x794b_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT ban_until; +}; +struct NetSPacket0x794b_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetSPacket0x794b_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794b_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x794b_Fixed, account_id) == 2, "offsetof(NetSPacket0x794b_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x794b_Fixed, account_name) == 6, "offsetof(NetSPacket0x794b_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x794b_Fixed, ban_until) == 30, "offsetof(NetSPacket0x794b_Fixed, ban_until) == 30"); +static_assert(sizeof(NetSPacket0x794b_Fixed) == 34, "sizeof(NetSPacket0x794b_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x794b_Fixed *network, SPacket0x794b_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_until, native.ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x794b_Fixed *native, NetSPacket0x794b_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_until, network.ban_until); + return rv; +} + +struct RPacket0x794c_Fixed +{ + uint16_t packet_id; + AccountName account_name; + HumanTimeDiff ban_add; +}; +struct NetRPacket0x794c_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + NetHumanTimeDiff ban_add; +}; +static_assert(offsetof(NetRPacket0x794c_Fixed, packet_id) == 0, "offsetof(NetRPacket0x794c_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x794c_Fixed, account_name) == 2, "offsetof(NetRPacket0x794c_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x794c_Fixed, ban_add) == 26, "offsetof(NetRPacket0x794c_Fixed, ban_add) == 26"); +static_assert(sizeof(NetRPacket0x794c_Fixed) == 38, "sizeof(NetRPacket0x794c_Fixed) == 38"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794c_Fixed *network, RPacket0x794c_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_add, native.ban_add); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794c_Fixed *native, NetRPacket0x794c_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_add, network.ban_add); + return rv; +} + +struct SPacket0x794d_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT ban_until; +}; +struct NetSPacket0x794d_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetSPacket0x794d_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794d_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x794d_Fixed, account_id) == 2, "offsetof(NetSPacket0x794d_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x794d_Fixed, account_name) == 6, "offsetof(NetSPacket0x794d_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x794d_Fixed, ban_until) == 30, "offsetof(NetSPacket0x794d_Fixed, ban_until) == 30"); +static_assert(sizeof(NetSPacket0x794d_Fixed) == 34, "sizeof(NetSPacket0x794d_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x794d_Fixed *network, SPacket0x794d_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_until, native.ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x794d_Fixed *native, NetSPacket0x794d_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_until, network.ban_until); + return rv; +} + +struct RPacket0x794e_Head +{ + uint16_t packet_id; + uint16_t unused; + uint32_t string_length; +}; +struct NetRPacket0x794e_Head +{ + Little16 packet_id; + Little16 unused; + Little32 string_length; +}; +static_assert(offsetof(NetRPacket0x794e_Head, packet_id) == 0, "offsetof(NetRPacket0x794e_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x794e_Head, unused) == 2, "offsetof(NetRPacket0x794e_Head, unused) == 2"); +static_assert(offsetof(NetRPacket0x794e_Head, string_length) == 4, "offsetof(NetRPacket0x794e_Head, string_length) == 4"); +static_assert(sizeof(NetRPacket0x794e_Head) == 8, "sizeof(NetRPacket0x794e_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794e_Head *network, RPacket0x794e_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->unused, native.unused); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794e_Head *native, NetRPacket0x794e_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->unused, network.unused); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct RPacket0x794e_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x794e_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x794e_Repeat, c) == 0, "offsetof(NetRPacket0x794e_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x794e_Repeat) == 1, "sizeof(NetRPacket0x794e_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794e_Repeat *network, RPacket0x794e_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794e_Repeat *native, NetRPacket0x794e_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x794f_Fixed +{ + uint16_t packet_id; + uint16_t error; +}; +struct NetSPacket0x794f_Fixed +{ + Little16 packet_id; + Little16 error; +}; +static_assert(offsetof(NetSPacket0x794f_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794f_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x794f_Fixed, error) == 2, "offsetof(NetSPacket0x794f_Fixed, error) == 2"); +static_assert(sizeof(NetSPacket0x794f_Fixed) == 4, "sizeof(NetSPacket0x794f_Fixed) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x794f_Fixed *network, SPacket0x794f_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->error, native.error); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x794f_Fixed *native, NetSPacket0x794f_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->error, network.error); + return rv; +} + +struct RPacket0x7950_Fixed +{ + uint16_t packet_id; + AccountName account_name; + HumanTimeDiff valid_add; +}; +struct NetRPacket0x7950_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; + NetHumanTimeDiff valid_add; +}; +static_assert(offsetof(NetRPacket0x7950_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7950_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7950_Fixed, account_name) == 2, "offsetof(NetRPacket0x7950_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7950_Fixed, valid_add) == 26, "offsetof(NetRPacket0x7950_Fixed, valid_add) == 26"); +static_assert(sizeof(NetRPacket0x7950_Fixed) == 38, "sizeof(NetRPacket0x7950_Fixed) == 38"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7950_Fixed *network, RPacket0x7950_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_add, native.valid_add); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7950_Fixed *native, NetRPacket0x7950_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_add, network.valid_add); + return rv; +} + +struct SPacket0x7951_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT valid_until; +}; +struct NetSPacket0x7951_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountName)> account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetSPacket0x7951_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7951_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7951_Fixed, account_id) == 2, "offsetof(NetSPacket0x7951_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7951_Fixed, account_name) == 6, "offsetof(NetSPacket0x7951_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x7951_Fixed, valid_until) == 30, "offsetof(NetSPacket0x7951_Fixed, valid_until) == 30"); +static_assert(sizeof(NetSPacket0x7951_Fixed) == 34, "sizeof(NetSPacket0x7951_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7951_Fixed *network, SPacket0x7951_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_until, native.valid_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7951_Fixed *native, NetSPacket0x7951_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_until, network.valid_until); + return rv; +} + +struct RPacket0x7952_Fixed +{ + uint16_t packet_id; + AccountName account_name; +}; +struct NetRPacket0x7952_Fixed +{ + Little16 packet_id; + NetString<sizeof(AccountName)> account_name; +}; +static_assert(offsetof(NetRPacket0x7952_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7952_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7952_Fixed, account_name) == 2, "offsetof(NetRPacket0x7952_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket0x7952_Fixed) == 26, "sizeof(NetRPacket0x7952_Fixed) == 26"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7952_Fixed *network, RPacket0x7952_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7952_Fixed *native, NetRPacket0x7952_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct SPacket0x7953_Head +{ + uint16_t packet_id; + uint32_t account_id; + GmLevel gm_level; + AccountName account_name; + SEX id; + uint32_t login_count; + uint32_t state; + timestamp_seconds_buffer error_message; + timestamp_milliseconds_buffer last_login_string; + VString<15> ip_string; + AccountEmail email; + TimeT connect_until; + TimeT ban_until; + uint16_t string_length; +}; +struct NetSPacket0x7953_Head +{ + Little16 packet_id; + Little32 account_id; + Byte gm_level; + NetString<sizeof(AccountName)> account_name; + Byte id; + Little32 login_count; + Little32 state; + NetString<sizeof(timestamp_seconds_buffer)> error_message; + NetString<sizeof(timestamp_milliseconds_buffer)> last_login_string; + NetString<sizeof(VString<15>)> ip_string; + NetString<sizeof(AccountEmail)> email; + Little32 connect_until; + Little32 ban_until; + Little16 string_length; +}; +static_assert(offsetof(NetSPacket0x7953_Head, packet_id) == 0, "offsetof(NetSPacket0x7953_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7953_Head, account_id) == 2, "offsetof(NetSPacket0x7953_Head, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7953_Head, gm_level) == 6, "offsetof(NetSPacket0x7953_Head, gm_level) == 6"); +static_assert(offsetof(NetSPacket0x7953_Head, account_name) == 7, "offsetof(NetSPacket0x7953_Head, account_name) == 7"); +static_assert(offsetof(NetSPacket0x7953_Head, id) == 31, "offsetof(NetSPacket0x7953_Head, id) == 31"); +static_assert(offsetof(NetSPacket0x7953_Head, login_count) == 32, "offsetof(NetSPacket0x7953_Head, login_count) == 32"); +static_assert(offsetof(NetSPacket0x7953_Head, state) == 36, "offsetof(NetSPacket0x7953_Head, state) == 36"); +static_assert(offsetof(NetSPacket0x7953_Head, error_message) == 40, "offsetof(NetSPacket0x7953_Head, error_message) == 40"); +static_assert(offsetof(NetSPacket0x7953_Head, last_login_string) == 60, "offsetof(NetSPacket0x7953_Head, last_login_string) == 60"); +static_assert(offsetof(NetSPacket0x7953_Head, ip_string) == 84, "offsetof(NetSPacket0x7953_Head, ip_string) == 84"); +static_assert(offsetof(NetSPacket0x7953_Head, email) == 100, "offsetof(NetSPacket0x7953_Head, email) == 100"); +static_assert(offsetof(NetSPacket0x7953_Head, connect_until) == 140, "offsetof(NetSPacket0x7953_Head, connect_until) == 140"); +static_assert(offsetof(NetSPacket0x7953_Head, ban_until) == 144, "offsetof(NetSPacket0x7953_Head, ban_until) == 144"); +static_assert(offsetof(NetSPacket0x7953_Head, string_length) == 148, "offsetof(NetSPacket0x7953_Head, string_length) == 148"); +static_assert(sizeof(NetSPacket0x7953_Head) == 150, "sizeof(NetSPacket0x7953_Head) == 150"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7953_Head *network, SPacket0x7953_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->id, native.id); + rv &= native_to_network(&network->login_count, native.login_count); + rv &= native_to_network(&network->state, native.state); + rv &= native_to_network(&network->error_message, native.error_message); + rv &= native_to_network(&network->last_login_string, native.last_login_string); + rv &= native_to_network(&network->ip_string, native.ip_string); + rv &= native_to_network(&network->email, native.email); + rv &= native_to_network(&network->connect_until, native.connect_until); + rv &= native_to_network(&network->ban_until, native.ban_until); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7953_Head *native, NetSPacket0x7953_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->id, network.id); + rv &= network_to_native(&native->login_count, network.login_count); + rv &= network_to_native(&native->state, network.state); + rv &= network_to_native(&native->error_message, network.error_message); + rv &= network_to_native(&native->last_login_string, network.last_login_string); + rv &= network_to_native(&native->ip_string, network.ip_string); + rv &= network_to_native(&native->email, network.email); + rv &= network_to_native(&native->connect_until, network.connect_until); + rv &= network_to_native(&native->ban_until, network.ban_until); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct SPacket0x7953_Repeat +{ + uint8_t c; +}; +struct NetSPacket0x7953_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetSPacket0x7953_Repeat, c) == 0, "offsetof(NetSPacket0x7953_Repeat, c) == 0"); +static_assert(sizeof(NetSPacket0x7953_Repeat) == 1, "sizeof(NetSPacket0x7953_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7953_Repeat *network, SPacket0x7953_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7953_Repeat *native, NetSPacket0x7953_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct RPacket0x7954_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x7954_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x7954_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7954_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7954_Fixed, account_id) == 2, "offsetof(NetRPacket0x7954_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x7954_Fixed) == 6, "sizeof(NetRPacket0x7954_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7954_Fixed *network, RPacket0x7954_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7954_Fixed *native, NetRPacket0x7954_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x7955_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7955_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7955_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7955_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7955_Fixed) == 2, "sizeof(NetRPacket0x7955_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7955_Fixed *network, RPacket0x7955_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7955_Fixed *native, NetRPacket0x7955_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + + +#endif // TMWA_PROTO2_LOGIN_ADMIN_HPP diff --git a/src/proto2/login-admin_test.cpp b/src/proto2/login-admin_test.cpp new file mode 100644 index 0000000..5bd9566 --- /dev/null +++ b/src/proto2/login-admin_test.cpp @@ -0,0 +1,23 @@ +#include "login-admin.hpp" +// login-admin_test.cpp - TMWA network protocol: login/admin +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/login-char.hpp b/src/proto2/login-char.hpp new file mode 100644 index 0000000..a594207 --- /dev/null +++ b/src/proto2/login-char.hpp @@ -0,0 +1,941 @@ +#ifndef TMWA_PROTO2_LOGIN_CHAR_HPP +#define TMWA_PROTO2_LOGIN_CHAR_HPP +// login-char.hpp - TMWA network protocol: login/char +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is an internal protocol, and can be changed without notice + +struct RPacket0x2709_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x2709_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x2709_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2709_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x2709_Fixed) == 2, "sizeof(NetRPacket0x2709_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2709_Fixed *network, RPacket0x2709_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2709_Fixed *native, NetRPacket0x2709_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct RPacket0x2712_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint32_t login_id1; + uint32_t login_id2; + SEX sex; + IP4Address ip; +}; +struct NetRPacket0x2712_Fixed +{ + Little16 packet_id; + Little32 account_id; + Little32 login_id1; + Little32 login_id2; + Byte sex; + IP4Address ip; +}; +static_assert(offsetof(NetRPacket0x2712_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2712_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2712_Fixed, account_id) == 2, "offsetof(NetRPacket0x2712_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2712_Fixed, login_id1) == 6, "offsetof(NetRPacket0x2712_Fixed, login_id1) == 6"); +static_assert(offsetof(NetRPacket0x2712_Fixed, login_id2) == 10, "offsetof(NetRPacket0x2712_Fixed, login_id2) == 10"); +static_assert(offsetof(NetRPacket0x2712_Fixed, sex) == 14, "offsetof(NetRPacket0x2712_Fixed, sex) == 14"); +static_assert(offsetof(NetRPacket0x2712_Fixed, ip) == 15, "offsetof(NetRPacket0x2712_Fixed, ip) == 15"); +static_assert(sizeof(NetRPacket0x2712_Fixed) == 19, "sizeof(NetRPacket0x2712_Fixed) == 19"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2712_Fixed *network, RPacket0x2712_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->login_id1, native.login_id1); + rv &= native_to_network(&network->login_id2, native.login_id2); + rv &= native_to_network(&network->sex, native.sex); + rv &= native_to_network(&network->ip, native.ip); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2712_Fixed *native, NetRPacket0x2712_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->login_id1, network.login_id1); + rv &= network_to_native(&native->login_id2, network.login_id2); + rv &= network_to_native(&native->sex, network.sex); + rv &= network_to_native(&native->ip, network.ip); + return rv; +} + +struct SPacket0x2713_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint8_t invalid; + AccountEmail email; + TimeT connect_until; +}; +struct NetSPacket0x2713_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte invalid; + NetString<sizeof(AccountEmail)> email; + Little32 connect_until; +}; +static_assert(offsetof(NetSPacket0x2713_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2713_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2713_Fixed, account_id) == 2, "offsetof(NetSPacket0x2713_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2713_Fixed, invalid) == 6, "offsetof(NetSPacket0x2713_Fixed, invalid) == 6"); +static_assert(offsetof(NetSPacket0x2713_Fixed, email) == 7, "offsetof(NetSPacket0x2713_Fixed, email) == 7"); +static_assert(offsetof(NetSPacket0x2713_Fixed, connect_until) == 47, "offsetof(NetSPacket0x2713_Fixed, connect_until) == 47"); +static_assert(sizeof(NetSPacket0x2713_Fixed) == 51, "sizeof(NetSPacket0x2713_Fixed) == 51"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2713_Fixed *network, SPacket0x2713_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->invalid, native.invalid); + rv &= native_to_network(&network->email, native.email); + rv &= native_to_network(&network->connect_until, native.connect_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2713_Fixed *native, NetSPacket0x2713_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->invalid, network.invalid); + rv &= network_to_native(&native->email, network.email); + rv &= network_to_native(&native->connect_until, network.connect_until); + return rv; +} + +struct RPacket0x2714_Fixed +{ + uint16_t packet_id; + uint32_t users; +}; +struct NetRPacket0x2714_Fixed +{ + Little16 packet_id; + Little32 users; +}; +static_assert(offsetof(NetRPacket0x2714_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2714_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2714_Fixed, users) == 2, "offsetof(NetRPacket0x2714_Fixed, users) == 2"); +static_assert(sizeof(NetRPacket0x2714_Fixed) == 6, "sizeof(NetRPacket0x2714_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2714_Fixed *network, RPacket0x2714_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->users, native.users); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2714_Fixed *native, NetRPacket0x2714_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->users, network.users); + return rv; +} + +struct RPacket0x2715_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountEmail email; +}; +struct NetRPacket0x2715_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountEmail)> email; +}; +static_assert(offsetof(NetRPacket0x2715_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2715_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2715_Fixed, account_id) == 2, "offsetof(NetRPacket0x2715_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2715_Fixed, email) == 6, "offsetof(NetRPacket0x2715_Fixed, email) == 6"); +static_assert(sizeof(NetRPacket0x2715_Fixed) == 46, "sizeof(NetRPacket0x2715_Fixed) == 46"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2715_Fixed *network, RPacket0x2715_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->email, native.email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2715_Fixed *native, NetRPacket0x2715_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->email, network.email); + return rv; +} + +struct RPacket0x2716_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x2716_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2716_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2716_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2716_Fixed, account_id) == 2, "offsetof(NetRPacket0x2716_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x2716_Fixed) == 6, "sizeof(NetRPacket0x2716_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2716_Fixed *network, RPacket0x2716_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2716_Fixed *native, NetRPacket0x2716_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x2717_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountEmail email; + TimeT connect_until; +}; +struct NetSPacket0x2717_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountEmail)> email; + Little32 connect_until; +}; +static_assert(offsetof(NetSPacket0x2717_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2717_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2717_Fixed, account_id) == 2, "offsetof(NetSPacket0x2717_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2717_Fixed, email) == 6, "offsetof(NetSPacket0x2717_Fixed, email) == 6"); +static_assert(offsetof(NetSPacket0x2717_Fixed, connect_until) == 46, "offsetof(NetSPacket0x2717_Fixed, connect_until) == 46"); +static_assert(sizeof(NetSPacket0x2717_Fixed) == 50, "sizeof(NetSPacket0x2717_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2717_Fixed *network, SPacket0x2717_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->email, native.email); + rv &= native_to_network(&network->connect_until, native.connect_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2717_Fixed *native, NetSPacket0x2717_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->email, network.email); + rv &= network_to_native(&native->connect_until, network.connect_until); + return rv; +} + +struct RPacket0x2720_Head +{ + uint16_t packet_id; + uint16_t packet_length; + uint32_t account_id; +}; +struct NetRPacket0x2720_Head +{ + Little16 packet_id; + Little16 packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2720_Head, packet_id) == 0, "offsetof(NetRPacket0x2720_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2720_Head, packet_length) == 2, "offsetof(NetRPacket0x2720_Head, packet_length) == 2"); +static_assert(offsetof(NetRPacket0x2720_Head, account_id) == 4, "offsetof(NetRPacket0x2720_Head, account_id) == 4"); +static_assert(sizeof(NetRPacket0x2720_Head) == 8, "sizeof(NetRPacket0x2720_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2720_Head *network, RPacket0x2720_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2720_Head *native, NetRPacket0x2720_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x2720_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x2720_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x2720_Repeat, c) == 0, "offsetof(NetRPacket0x2720_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x2720_Repeat) == 1, "sizeof(NetRPacket0x2720_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2720_Repeat *network, RPacket0x2720_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2720_Repeat *native, NetRPacket0x2720_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x2721_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + GmLevel gm_level; +}; +struct NetSPacket0x2721_Fixed +{ + Little16 packet_id; + Little32 account_id; + Little32 gm_level; +}; +static_assert(offsetof(NetSPacket0x2721_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2721_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2721_Fixed, account_id) == 2, "offsetof(NetSPacket0x2721_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2721_Fixed, gm_level) == 6, "offsetof(NetSPacket0x2721_Fixed, gm_level) == 6"); +static_assert(sizeof(NetSPacket0x2721_Fixed) == 10, "sizeof(NetSPacket0x2721_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2721_Fixed *network, SPacket0x2721_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2721_Fixed *native, NetSPacket0x2721_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + return rv; +} + +struct RPacket0x2722_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountEmail old_email; + AccountEmail new_email; +}; +struct NetRPacket0x2722_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountEmail)> old_email; + NetString<sizeof(AccountEmail)> new_email; +}; +static_assert(offsetof(NetRPacket0x2722_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2722_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2722_Fixed, account_id) == 2, "offsetof(NetRPacket0x2722_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2722_Fixed, old_email) == 6, "offsetof(NetRPacket0x2722_Fixed, old_email) == 6"); +static_assert(offsetof(NetRPacket0x2722_Fixed, new_email) == 46, "offsetof(NetRPacket0x2722_Fixed, new_email) == 46"); +static_assert(sizeof(NetRPacket0x2722_Fixed) == 86, "sizeof(NetRPacket0x2722_Fixed) == 86"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2722_Fixed *network, RPacket0x2722_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->old_email, native.old_email); + rv &= native_to_network(&network->new_email, native.new_email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2722_Fixed *native, NetRPacket0x2722_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->old_email, network.old_email); + rv &= network_to_native(&native->new_email, network.new_email); + return rv; +} + +struct SPacket0x2723_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + SEX sex; +}; +struct NetSPacket0x2723_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte sex; +}; +static_assert(offsetof(NetSPacket0x2723_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2723_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2723_Fixed, account_id) == 2, "offsetof(NetSPacket0x2723_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2723_Fixed, sex) == 6, "offsetof(NetSPacket0x2723_Fixed, sex) == 6"); +static_assert(sizeof(NetSPacket0x2723_Fixed) == 7, "sizeof(NetSPacket0x2723_Fixed) == 7"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2723_Fixed *network, SPacket0x2723_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->sex, native.sex); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2723_Fixed *native, NetSPacket0x2723_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->sex, network.sex); + return rv; +} + +struct RPacket0x2724_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint32_t status; +}; +struct NetRPacket0x2724_Fixed +{ + Little16 packet_id; + Little32 account_id; + Little32 status; +}; +static_assert(offsetof(NetRPacket0x2724_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2724_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2724_Fixed, account_id) == 2, "offsetof(NetRPacket0x2724_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2724_Fixed, status) == 6, "offsetof(NetRPacket0x2724_Fixed, status) == 6"); +static_assert(sizeof(NetRPacket0x2724_Fixed) == 10, "sizeof(NetRPacket0x2724_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2724_Fixed *network, RPacket0x2724_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->status, native.status); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2724_Fixed *native, NetRPacket0x2724_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->status, network.status); + return rv; +} + +struct RPacket0x2725_Head +{ + uint16_t packet_id; + uint32_t account_id; + HumanTimeDiff deltas; +}; +struct NetRPacket0x2725_Head +{ + Little16 packet_id; + Little32 account_id; + NetHumanTimeDiff deltas; +}; +static_assert(offsetof(NetRPacket0x2725_Head, packet_id) == 0, "offsetof(NetRPacket0x2725_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2725_Head, account_id) == 2, "offsetof(NetRPacket0x2725_Head, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2725_Head, deltas) == 6, "offsetof(NetRPacket0x2725_Head, deltas) == 6"); +static_assert(sizeof(NetRPacket0x2725_Head) == 18, "sizeof(NetRPacket0x2725_Head) == 18"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2725_Head *network, RPacket0x2725_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->deltas, native.deltas); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2725_Head *native, NetRPacket0x2725_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->deltas, network.deltas); + return rv; +} + +struct RPacket0x2725_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x2725_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x2725_Repeat, c) == 0, "offsetof(NetRPacket0x2725_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x2725_Repeat) == 1, "sizeof(NetRPacket0x2725_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2725_Repeat *network, RPacket0x2725_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2725_Repeat *native, NetRPacket0x2725_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct RPacket0x2727_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x2727_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2727_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2727_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2727_Fixed, account_id) == 2, "offsetof(NetRPacket0x2727_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x2727_Fixed) == 6, "sizeof(NetRPacket0x2727_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2727_Fixed *network, RPacket0x2727_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2727_Fixed *native, NetRPacket0x2727_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x2728_Head +{ + uint16_t packet_id; + uint16_t packet_length; + uint32_t account_id; +}; +struct NetRPacket0x2728_Head +{ + Little16 packet_id; + Little16 packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2728_Head, packet_id) == 0, "offsetof(NetRPacket0x2728_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2728_Head, packet_length) == 2, "offsetof(NetRPacket0x2728_Head, packet_length) == 2"); +static_assert(offsetof(NetRPacket0x2728_Head, account_id) == 4, "offsetof(NetRPacket0x2728_Head, account_id) == 4"); +static_assert(sizeof(NetRPacket0x2728_Head) == 8, "sizeof(NetRPacket0x2728_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2728_Head *network, RPacket0x2728_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2728_Head *native, NetRPacket0x2728_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x2728_Repeat +{ + VarName name; + uint32_t value; +}; +struct NetRPacket0x2728_Repeat +{ + NetString<sizeof(VarName)> name; + Little32 value; +}; +static_assert(offsetof(NetRPacket0x2728_Repeat, name) == 0, "offsetof(NetRPacket0x2728_Repeat, name) == 0"); +static_assert(offsetof(NetRPacket0x2728_Repeat, value) == 32, "offsetof(NetRPacket0x2728_Repeat, value) == 32"); +static_assert(sizeof(NetRPacket0x2728_Repeat) == 36, "sizeof(NetRPacket0x2728_Repeat) == 36"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2728_Repeat *network, RPacket0x2728_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->name, native.name); + rv &= native_to_network(&network->value, native.value); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2728_Repeat *native, NetRPacket0x2728_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->name, network.name); + rv &= network_to_native(&native->value, network.value); + return rv; +} + +struct SPacket0x2729_Head +{ + uint16_t packet_id; + uint16_t packet_length; + uint32_t account_id; +}; +struct NetSPacket0x2729_Head +{ + Little16 packet_id; + Little16 packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetSPacket0x2729_Head, packet_id) == 0, "offsetof(NetSPacket0x2729_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2729_Head, packet_length) == 2, "offsetof(NetSPacket0x2729_Head, packet_length) == 2"); +static_assert(offsetof(NetSPacket0x2729_Head, account_id) == 4, "offsetof(NetSPacket0x2729_Head, account_id) == 4"); +static_assert(sizeof(NetSPacket0x2729_Head) == 8, "sizeof(NetSPacket0x2729_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2729_Head *network, SPacket0x2729_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2729_Head *native, NetSPacket0x2729_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x2729_Repeat +{ + VarName name; + uint32_t value; +}; +struct NetSPacket0x2729_Repeat +{ + NetString<sizeof(VarName)> name; + Little32 value; +}; +static_assert(offsetof(NetSPacket0x2729_Repeat, name) == 0, "offsetof(NetSPacket0x2729_Repeat, name) == 0"); +static_assert(offsetof(NetSPacket0x2729_Repeat, value) == 32, "offsetof(NetSPacket0x2729_Repeat, value) == 32"); +static_assert(sizeof(NetSPacket0x2729_Repeat) == 36, "sizeof(NetSPacket0x2729_Repeat) == 36"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2729_Repeat *network, SPacket0x2729_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->name, native.name); + rv &= native_to_network(&network->value, native.value); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2729_Repeat *native, NetSPacket0x2729_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->name, network.name); + rv &= network_to_native(&native->value, network.value); + return rv; +} + +struct RPacket0x272a_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x272a_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x272a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x272a_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x272a_Fixed, account_id) == 2, "offsetof(NetRPacket0x272a_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x272a_Fixed) == 6, "sizeof(NetRPacket0x272a_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x272a_Fixed *network, RPacket0x272a_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x272a_Fixed *native, NetRPacket0x272a_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x2730_Fixed +{ + uint16_t packet_id; +}; +struct NetSPacket0x2730_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetSPacket0x2730_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2730_Fixed, packet_id) == 0"); +static_assert(sizeof(NetSPacket0x2730_Fixed) == 2, "sizeof(NetSPacket0x2730_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2730_Fixed *network, SPacket0x2730_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2730_Fixed *native, NetSPacket0x2730_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct SPacket0x2731_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint8_t ban_not_status; + TimeT status_or_ban_until; +}; +struct NetSPacket0x2731_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte ban_not_status; + Little32 status_or_ban_until; +}; +static_assert(offsetof(NetSPacket0x2731_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2731_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2731_Fixed, account_id) == 2, "offsetof(NetSPacket0x2731_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2731_Fixed, ban_not_status) == 6, "offsetof(NetSPacket0x2731_Fixed, ban_not_status) == 6"); +static_assert(offsetof(NetSPacket0x2731_Fixed, status_or_ban_until) == 7, "offsetof(NetSPacket0x2731_Fixed, status_or_ban_until) == 7"); +static_assert(sizeof(NetSPacket0x2731_Fixed) == 11, "sizeof(NetSPacket0x2731_Fixed) == 11"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2731_Fixed *network, SPacket0x2731_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->ban_not_status, native.ban_not_status); + rv &= native_to_network(&network->status_or_ban_until, native.status_or_ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2731_Fixed *native, NetSPacket0x2731_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->ban_not_status, network.ban_not_status); + rv &= network_to_native(&native->status_or_ban_until, network.status_or_ban_until); + return rv; +} + +struct SPacket0x2732_Head +{ + uint16_t packet_id; + uint16_t packet_length; +}; +struct NetSPacket0x2732_Head +{ + Little16 packet_id; + Little16 packet_length; +}; +static_assert(offsetof(NetSPacket0x2732_Head, packet_id) == 0, "offsetof(NetSPacket0x2732_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2732_Head, packet_length) == 2, "offsetof(NetSPacket0x2732_Head, packet_length) == 2"); +static_assert(sizeof(NetSPacket0x2732_Head) == 4, "sizeof(NetSPacket0x2732_Head) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2732_Head *network, SPacket0x2732_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2732_Head *native, NetSPacket0x2732_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + return rv; +} + +struct SPacket0x2732_Repeat +{ + uint32_t account_id; + GmLevel gm_level; +}; +struct NetSPacket0x2732_Repeat +{ + Little32 account_id; + Byte gm_level; +}; +static_assert(offsetof(NetSPacket0x2732_Repeat, account_id) == 0, "offsetof(NetSPacket0x2732_Repeat, account_id) == 0"); +static_assert(offsetof(NetSPacket0x2732_Repeat, gm_level) == 4, "offsetof(NetSPacket0x2732_Repeat, gm_level) == 4"); +static_assert(sizeof(NetSPacket0x2732_Repeat) == 5, "sizeof(NetSPacket0x2732_Repeat) == 5"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2732_Repeat *network, SPacket0x2732_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2732_Repeat *native, NetSPacket0x2732_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + return rv; +} + +struct RPacket0x2740_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountPass old_pass; + AccountPass new_pass; +}; +struct NetRPacket0x2740_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString<sizeof(AccountPass)> old_pass; + NetString<sizeof(AccountPass)> new_pass; +}; +static_assert(offsetof(NetRPacket0x2740_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2740_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2740_Fixed, account_id) == 2, "offsetof(NetRPacket0x2740_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2740_Fixed, old_pass) == 6, "offsetof(NetRPacket0x2740_Fixed, old_pass) == 6"); +static_assert(offsetof(NetRPacket0x2740_Fixed, new_pass) == 30, "offsetof(NetRPacket0x2740_Fixed, new_pass) == 30"); +static_assert(sizeof(NetRPacket0x2740_Fixed) == 54, "sizeof(NetRPacket0x2740_Fixed) == 54"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2740_Fixed *network, RPacket0x2740_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->old_pass, native.old_pass); + rv &= native_to_network(&network->new_pass, native.new_pass); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2740_Fixed *native, NetRPacket0x2740_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->old_pass, network.old_pass); + rv &= network_to_native(&native->new_pass, network.new_pass); + return rv; +} + +struct SPacket0x2741_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint8_t status; +}; +struct NetSPacket0x2741_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte status; +}; +static_assert(offsetof(NetSPacket0x2741_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2741_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2741_Fixed, account_id) == 2, "offsetof(NetSPacket0x2741_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2741_Fixed, status) == 6, "offsetof(NetSPacket0x2741_Fixed, status) == 6"); +static_assert(sizeof(NetSPacket0x2741_Fixed) == 7, "sizeof(NetSPacket0x2741_Fixed) == 7"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2741_Fixed *network, SPacket0x2741_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->status, native.status); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2741_Fixed *native, NetSPacket0x2741_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->status, network.status); + return rv; +} + + +#endif // TMWA_PROTO2_LOGIN_CHAR_HPP diff --git a/src/proto2/login-char_test.cpp b/src/proto2/login-char_test.cpp new file mode 100644 index 0000000..9ae0f5a --- /dev/null +++ b/src/proto2/login-char_test.cpp @@ -0,0 +1,23 @@ +#include "login-char.hpp" +// login-char_test.cpp - TMWA network protocol: login/char +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/login-user.hpp b/src/proto2/login-user.hpp new file mode 100644 index 0000000..4c71e8a --- /dev/null +++ b/src/proto2/login-user.hpp @@ -0,0 +1,31 @@ +#ifndef TMWA_PROTO2_LOGIN_USER_HPP +#define TMWA_PROTO2_LOGIN_USER_HPP +// login-user.hpp - TMWA network protocol: login/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + + +#endif // TMWA_PROTO2_LOGIN_USER_HPP diff --git a/src/proto2/login-user_test.cpp b/src/proto2/login-user_test.cpp new file mode 100644 index 0000000..3b623b6 --- /dev/null +++ b/src/proto2/login-user_test.cpp @@ -0,0 +1,23 @@ +#include "login-user.hpp" +// login-user_test.cpp - TMWA network protocol: login/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/map-user.hpp b/src/proto2/map-user.hpp new file mode 100644 index 0000000..da59c40 --- /dev/null +++ b/src/proto2/map-user.hpp @@ -0,0 +1,81 @@ +#ifndef TMWA_PROTO2_MAP_USER_HPP +#define TMWA_PROTO2_MAP_USER_HPP +// map-user.hpp - TMWA network protocol: map/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + +struct SPacket0x0212_Fixed +{ + uint16_t packet_id; + BlockId npc_id; + uint16_t command; + BlockId id; + uint16_t x; + uint16_t y; +}; +struct NetSPacket0x0212_Fixed +{ + Little16 packet_id; + Little32 npc_id; + Little16 command; + Little32 id; + Little16 x; + Little16 y; +}; +static_assert(offsetof(NetSPacket0x0212_Fixed, packet_id) == 0, "offsetof(NetSPacket0x0212_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x0212_Fixed, npc_id) == 2, "offsetof(NetSPacket0x0212_Fixed, npc_id) == 2"); +static_assert(offsetof(NetSPacket0x0212_Fixed, command) == 6, "offsetof(NetSPacket0x0212_Fixed, command) == 6"); +static_assert(offsetof(NetSPacket0x0212_Fixed, id) == 8, "offsetof(NetSPacket0x0212_Fixed, id) == 8"); +static_assert(offsetof(NetSPacket0x0212_Fixed, x) == 12, "offsetof(NetSPacket0x0212_Fixed, x) == 12"); +static_assert(offsetof(NetSPacket0x0212_Fixed, y) == 14, "offsetof(NetSPacket0x0212_Fixed, y) == 14"); +static_assert(sizeof(NetSPacket0x0212_Fixed) == 16, "sizeof(NetSPacket0x0212_Fixed) == 16"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x0212_Fixed *network, SPacket0x0212_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->npc_id, native.npc_id); + rv &= native_to_network(&network->command, native.command); + rv &= native_to_network(&network->id, native.id); + rv &= native_to_network(&network->x, native.x); + rv &= native_to_network(&network->y, native.y); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x0212_Fixed *native, NetSPacket0x0212_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->npc_id, network.npc_id); + rv &= network_to_native(&native->command, network.command); + rv &= network_to_native(&native->id, network.id); + rv &= network_to_native(&native->x, network.x); + rv &= network_to_native(&native->y, network.y); + return rv; +} + + +#endif // TMWA_PROTO2_MAP_USER_HPP diff --git a/src/proto2/map-user_test.cpp b/src/proto2/map-user_test.cpp new file mode 100644 index 0000000..adbdf6f --- /dev/null +++ b/src/proto2/map-user_test.cpp @@ -0,0 +1,23 @@ +#include "map-user.hpp" +// map-user_test.cpp - TMWA network protocol: map/user +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp new file mode 100644 index 0000000..f69d943 --- /dev/null +++ b/src/proto2/types.hpp @@ -0,0 +1,264 @@ +#ifndef TMWA_PROTO2_TYPES_HPP +#define TMWA_PROTO2_TYPES_HPP +// proto2/types.hpp - Forward declarations of packet component types +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +# include "fwd.hpp" + +//TODO split the includes +# include <cstdint> +# include "../ints/little.hpp" +# include "../strings/vstring.hpp" +# include "../net/ip.hpp" +# include "../mmo/enums.hpp" +# include "../mmo/human_time_diff.hpp" +# include "../mmo/ids.hpp" +# include "../mmo/strs.hpp" +# include "../mmo/utils.hpp" +# include "../mmo/version.hpp" +template <class T> +bool native_to_network(T *network, T native) +{ + *network = native; + return true; +} +template <class T> +bool network_to_native(T *native, T network) +{ + *native = network; + return true; +} +template <size_t N> +struct NetString +{ + char data[N]; +}; +template <size_t N> +bool native_to_network(NetString<N> *network, VString<N-1> native) +{ + // basically WBUF_STRING + char *const begin = network->data; + char *const end = begin + N; + char *const mid = std::copy(native.begin(), native.end(), begin); + std::fill(mid, end, '\0'); + return true; +} +template <size_t N> +bool network_to_native(VString<N-1> *native, NetString<N> network) +{ + // basically RBUF_STRING + const char *const begin = network.data; + const char *const end = begin + N; + const char *const mid = std::find(begin, end, '\0'); + *native = XString(begin, mid, nullptr); + return true; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(Byte *network, SEX native) +{ + bool rv = true; + uint8_t tmp = static_cast<uint8_t>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SEX *native, Byte network) +{ + bool rv = true; + uint8_t tmp; + rv &= network_to_native(&tmp, network); + *native = static_cast<SEX>(tmp); + // TODO this is what really should be doing a checked cast + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little16 *network, Species native) +{ + bool rv = true; + uint16_t tmp = unwrap<Species>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Species *native, Little16 network) +{ + bool rv = true; + uint16_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap<Species>(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, AccountId native) +{ + bool rv = true; + uint32_t tmp = unwrap<AccountId>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(AccountId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap<AccountId>(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, CharId native) +{ + bool rv = true; + uint32_t tmp = unwrap<CharId>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(CharId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap<CharId>(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, PartyId native) +{ + bool rv = true; + uint32_t tmp = unwrap<PartyId>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(PartyId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap<PartyId>(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little16 *network, ItemNameId native) +{ + bool rv = true; + uint16_t tmp = unwrap<ItemNameId>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(ItemNameId *native, Little16 network) +{ + bool rv = true; + uint16_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap<ItemNameId>(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, BlockId native) +{ + bool rv = true; + uint32_t tmp = unwrap<BlockId>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(BlockId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap<BlockId>(tmp); + return rv; +} +struct NetHumanTimeDiff +{ + Little16 year; + Little16 month; + Little16 day; + Little16 hour; + Little16 minute; + Little16 second; +}; +inline __attribute__((warn_unused_result)) +bool native_to_network(NetHumanTimeDiff *network, HumanTimeDiff native) +{ + bool rv = true; + uint16_t year = native.year; rv &= native_to_network(&network->year, year); + uint16_t month = native.month; rv &= native_to_network(&network->month, month); + uint16_t day = native.day; rv &= native_to_network(&network->day, day); + uint16_t hour = native.hour; rv &= native_to_network(&network->hour, hour); + uint16_t minute = native.minute; rv &= native_to_network(&network->minute, minute); + uint16_t second = native.second; rv &= native_to_network(&network->second, second); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(HumanTimeDiff *native, NetHumanTimeDiff network) +{ + bool rv = true; + uint16_t year; rv &= network_to_native(&year, network.year); native->year = year; + uint16_t month; rv &= network_to_native(&month, network.month); native->month = month; + uint16_t day; rv &= network_to_native(&day, network.day); native->day = day; + uint16_t hour; rv &= network_to_native(&hour, network.hour); native->hour = hour; + uint16_t minute; rv &= network_to_native(&minute, network.minute); native->minute = minute; + uint16_t second; rv &= network_to_native(&second, network.second); native->second = second; + return rv; +} + +struct NetVersion +{ + Byte major; + Byte minor; + Byte patch; + Byte devel; + Byte flags; + Byte which; + Little16 vend; +}; +inline __attribute__((warn_unused_result)) +bool native_to_network(NetVersion *network, Version native) +{ + bool rv = true; + uint8_t major = native.major; rv &= native_to_network(&network->major, major); + uint8_t minor = native.minor; rv &= native_to_network(&network->minor, minor); + uint8_t patch = native.patch; rv &= native_to_network(&network->patch, patch); + uint8_t devel = native.devel; rv &= native_to_network(&network->devel, devel); + uint8_t flags = native.flags; rv &= native_to_network(&network->flags, flags); + uint8_t which = native.which; rv &= native_to_network(&network->which, which); + uint16_t vend = native.vend; rv &= native_to_network(&network->vend, vend); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Version *native, NetVersion network) +{ + bool rv = true; + uint8_t major; rv &= network_to_native(&major, network.major); native->major = major; + uint8_t minor; rv &= network_to_native(&minor, network.minor); native->minor = minor; + uint8_t patch; rv &= network_to_native(&patch, network.patch); native->patch = patch; + uint8_t devel; rv &= network_to_native(&devel, network.devel); native->devel = devel; + uint8_t flags; rv &= network_to_native(&flags, network.flags); native->flags = flags; + uint8_t which; rv &= network_to_native(&which, network.which); native->which = which; + uint16_t vend; rv &= network_to_native(&vend, network.vend); native->vend = vend; + return rv; +} + +#endif // TMWA_PROTO2_TYPES_HPP diff --git a/tools/protocol.py b/tools/protocol.py new file mode 100755 index 0000000..d51f242 --- /dev/null +++ b/tools/protocol.py @@ -0,0 +1,1343 @@ +#!/usr/bin/env python +# coding: utf-8 + +# protocol.py - generator for entire TMWA network protocol +# +# Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +# +# This file is part of The Mana World (Athena server) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import glob +import os +from posixpath import relpath + +# The following code should be relatively easy to understand, but please +# keep your sanity fastened and your arms and legs inside at all times. + +generated = '// This is a generated file, edit %s instead\n' % __file__ + +copyright = '''// {filename} - {description} +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +''' + + +class LowType(object): + __slots__ = () + +class NativeType(LowType): + __slots__ = ('name') + + def __init__(self, name): + self.name = name + + def a_tag(self): + return self.name + +class NetworkType(LowType): + __slots__ = ('name') + + def __init__(self, name): + self.name = name + + def e_tag(self): + return self.name + + +class Type(object): + __slots__ = () + +class NeutralType(Type): + __slots__ = ('name') + + def __init__(self, name): + self.name = name + + def native_tag(self): + return self.name + + def network_tag(self): + return self.name + + e_tag = network_tag + +class StringType(Type): + __slots__ = ('native') + + def __init__(self, native): + self.native = native + + def native_tag(self): + return self.native.a_tag() + + def network_tag(self): + return 'NetString<sizeof(%s)>' % self.native.a_tag() + + def dump(self, f): + # not implemented properly, uses a template in the meta instead + pass + +class ProvidedType(Type): + __slots__ = ('native', 'network') + + def __init__(self, native, network): + self.native = native + self.network = network + + def native_tag(self): + return self.native.a_tag() + + def network_tag(self): + return self.network.e_tag() + +class EnumType(Type): + __slots__ = ('native', 'under') + + def __init__(self, native, under): + self.native = native + self.under = under + + def native_tag(self): + return self.native.a_tag() + + def network_tag(self): + return self.under.network_tag() + + def dump(self, f): + native = self.native_tag() + under = self.under.native_tag() + network = self.network_tag() + + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool native_to_network({0} *network, {1} native)\n{{\n'.format(network, native)) + f.write(' bool rv = true;\n') + f.write(' {0} tmp = static_cast<{0}>(native);\n'.format(under)) + f.write(' rv &= native_to_network(network, tmp);\n') + f.write(' return rv;\n') + f.write('}\n') + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool network_to_native({0} *native, {1} network)\n{{\n'.format(native, network)) + f.write(' bool rv = true;\n') + f.write(' {0} tmp;\n'.format(under)) + f.write(' rv &= network_to_native(&tmp, network);\n') + f.write(' *native = static_cast<{0}>(tmp);\n'.format(native)) + f.write(' // TODO this is what really should be doing a checked cast\n') + f.write(' return rv;\n') + f.write('}\n') + +class WrappedType(Type): + __slots__ = ('native', 'under') + + def __init__(self, native, under): + self.native = native + self.under = under + + def native_tag(self): + return self.native.a_tag() + + def network_tag(self): + return self.under.network_tag() + + def dump(self, f): + native = self.native_tag() + under = self.under.native_tag() + network = self.network_tag() + + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool native_to_network({0} *network, {1} native)\n{{\n'.format(network, native)) + f.write(' bool rv = true;\n') + f.write(' {0} tmp = unwrap<{1}>(native);\n'.format(under, native)) + f.write(' rv &= native_to_network(network, tmp);\n') + f.write(' return rv;\n') + f.write('}\n') + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool network_to_native({0} *native, {1} network)\n{{\n'.format(native, network)) + f.write(' bool rv = true;\n') + f.write(' {0} tmp;\n'.format(under)) + f.write(' rv &= network_to_native(&tmp, network);\n') + f.write(' *native = wrap<{0}>(tmp);\n'.format(native)) + f.write(' return rv;\n') + f.write('}\n') + +class StructType(Type): + __slots__ = ('name', 'fields', 'size') + + def __init__(self, name, fields, size): + self.name = name + self.fields = fields + self.size = size + + def dump(self, f): + self.dump_native(f) + self.dump_network(f) + self.dump_convert(f) + f.write('\n') + + def dump_native(self, f): + name = self.name + f.write('struct %s\n{\n' % name) + for (o, l, n) in self.fields: + f.write(' %s %s;\n' % (l.native_tag(), n)) + f.write('};\n') + + def dump_network(self, f): + name = 'Net%s' % self.name + f.write('struct %s\n{\n' % name) + for (o, l, n) in self.fields: + f.write(' %s %s;\n' % (l.network_tag(), n)) + f.write('};\n') + for (o, l, n) in self.fields: + if o is not None: + s = 'offsetof(%s, %s) == %d' % (name, n, o) + f.write('static_assert({0}, "{0}");\n'.format(s)) + if self.size is not None: + s = 'sizeof(%s) == %d' % (name, self.size) + f.write('static_assert({0}, "{0}");\n'.format(s)) + + def dump_convert(self, f): + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool native_to_network(Net{0} *network, {0} native)\n{{\n'.format(self.name)) + f.write(' bool rv = true;\n') + for (o, l, n) in self.fields: + f.write(' rv &= native_to_network(&network->{0}, native.{0});\n'.format(n)) + f.write(' return rv;\n') + f.write('}\n') + + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool network_to_native({0} *native, Net{0} network)\n{{\n'.format(self.name)) + f.write(' bool rv = true;\n') + for (o, l, n) in self.fields: + f.write(' rv &= network_to_native(&native->{0}, network.{0});\n'.format(n)) + f.write(' return rv;\n') + f.write('}\n') + +class PartialStructType(Type): + __slots__ = ('native', 'body') + + def __init__(self, native, body): + self.native = native + self.body = body + + def native_tag(self): + return self.native.a_tag() + + def network_tag(self): + return 'Net%s' % self.native_tag() + + def dump(self, f): + f.write('struct %s\n{\n' % self.network_tag()) + for n, t in self.body: + f.write(' %s %s;\n' % (t.network_tag(), n)) + f.write('};\n') + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool native_to_network(Net{0} *network, {0} native)\n{{\n'.format(self.native_tag())) + f.write(' bool rv = true;\n') + for n, t in self.body: + u = t.native_tag() + # probably not necessary + f.write(' {1} {0} = native.{0}; rv &= native_to_network(&network->{0}, {0});\n'.format(n, u)) + f.write(' return rv;\n') + f.write('}\n') + f.write('inline __attribute__((warn_unused_result))\n') + f.write('bool network_to_native({0} *native, Net{0} network)\n{{\n'.format(self.native_tag())) + f.write(' bool rv = true;\n') + for n, t in self.body: + # the temporary is ABSOLUTELY NECESSARY here + # the native type is permitted to differ from the declared type + # e.g. HumanTimeDiff uses int16_t instead of uint16_t + u = t.native_tag() + f.write(' {1} {0}; rv &= network_to_native(&{0}, network.{0}); native->{0} = {0};\n'.format(n, u)) + f.write(' return rv;\n') + f.write('}\n') + f.write('\n') + + +class Include(object): + __slots__ = ('path', '_types') + + def __init__(self, path): + self.path = path + self._types = [] + + def testcase(self, outdir): + basename = os.path.basename(self.path.strip('<">')) + root = os.path.splitext(basename)[0] + filename = 'include_%s_test.cpp' % root + desc = 'testsuite for protocol includes' + poison = relpath('src/poison.hpp', outdir) + with open(os.path.join(outdir, filename), 'w') as f: + f.write(self.pp(0)) + f.write(copyright.format(filename=filename, description=desc)) + f.write('\n') + f.write('#include "%s"\n\n' % poison) + + for t in self._types: + f.write('using %s = %s;\n' % ('Test_' + ident(t.name), t.name)) + + def pp(self, n): + return '#%*sinclude %s\n' % (n, '', self.path) + + + def native(self, name): + ty = NativeType(name) + self._types.append(ty) + return ty + + def network(self, name): + ty = NetworkType(name) + self._types.append(ty) + return ty + + def neutral(self, name): + ty = NeutralType(name) + self._types.append(ty) + return ty + + +class FixedPacket(object): + __slots__ = ('fixed_struct') + + def __init__(self, fixed_struct): + self.fixed_struct = fixed_struct + + def dump(self, f): + self.fixed_struct.dump(f) + +class VarPacket(object): + __slots__ = ('head_struct', 'repeat_struct') + + def __init__(self, head_struct, repeat_struct): + self.head_struct = head_struct + self.repeat_struct = repeat_struct + + def dump(self, f): + self.head_struct.dump(f) + self.repeat_struct.dump(f) + +def packet(name, + fixed=None, fixed_size=None, + head=None, head_size=None, + repeat=None, repeat_size=None, +): + assert (fixed is None) <= (fixed_size is None) + assert (head is None) <= (head_size is None) + assert (repeat is None) <= (repeat_size is None) + + if fixed is not None: + assert not head and not repeat + return FixedPacket( + StructType('%s_Fixed' % name, fixed, fixed_size)) + else: + assert head and repeat + return VarPacket( + StructType('%s_Head' % name, head, head_size), + StructType('%s_Repeat' % name, repeat, repeat_size)) + + +class Channel(object): + __slots__ = ('server', 'client', 'packets') + + def __init__(self, server, client): + self.server = server + self.client = client + self.packets = [] + + def s(self, id, **kwargs): + name = 'SPacket0x%04x' % id + self.packets.append(packet(name, **kwargs)) + + def r(self, id, **kwargs): + name = 'RPacket0x%04x' % id + self.packets.append(packet(name, **kwargs)) + + def dump(self, outdir): + server = self.server + client = self.client + header = '%s-%s.hpp' % (server, client) + test = '%s-%s_test.cpp' % (server, client) + desc = 'TMWA network protocol: %s/%s' % (server, client) + with open(os.path.join(outdir, header), 'w') as f: + proto2 = relpath(outdir, 'src') + define = ('TMWA_%s_%s_%s_HPP' % (proto2, server, client)).upper() + f.write('#ifndef %s\n' % define) + f.write('#define %s\n' % define) + f.write(copyright.format(filename=header, description=desc)) + f.write('\n') + f.write(generated) + f.write('\n') + f.write('# include "fwd.hpp"\n\n') + f.write('# include "types.hpp"\n') + f.write('\n') + if client == 'user': + f.write('// This is a public protocol, and changes require client cooperation\n') + else: + f.write('// This is an internal protocol, and can be changed without notice\n') + f.write('\n') + for p in self.packets: + p.dump(f) + f.write('\n') + f.write('#endif // %s\n' % define) + + with open(os.path.join(outdir, test), 'w') as f: + poison = relpath('src/poison.hpp', outdir) + f.write('#include "%s"\n' % header) + f.write(copyright.format(filename=test, description=desc)) + f.write('\n') + f.write(generated) + f.write('\n') + f.write('#include "{}"\n'.format(poison)) + + +ident_translation = ''.join(chr(c) if chr(c).isalnum() else '_' for c in range(256)) + +def ident(s): + return s.translate(ident_translation) + + +def at(o, l, n): + return (o, l, ident(n)) + + +class Context(object): + __slots__ = ('outdir', '_includes', '_channels', '_types') + + def __init__(self, outdir): + self.outdir = outdir + self._includes = [] + self._channels = [] + self._types = [] + + + def sysinclude(self, name): + rv = Include('<%s>' % name) + self._includes.append(rv) + return rv + + def include(self, name): + rv = Include('"%s"' % relpath(name, self.outdir)) + self._includes.append(rv) + return rv + + def chan(self, server, client): + ch = Channel(server, client) + self._channels.append(ch) + return ch + + def dump(self): + outdir = self.outdir + for g in glob.glob(os.path.join(outdir, '*.[ch]pp')): + os.remove(g) + proto2 = relpath(outdir, 'src') + with open(os.path.join(outdir, 'fwd.hpp'), 'w') as f: + header = '%s/fwd.hpp' % proto2 + desc = 'Forward declarations of network packets' + sanity = relpath('src/sanity.hpp', outdir) + define = ('TMWA_%s_FWD_HPP' % proto2).upper() + f.write('#ifndef %s\n' % define) + f.write('#define %s\n' % define) + f.write(copyright.format(filename=header, description=desc)) + f.write('\n') + f.write('# include "%s"\n\n' % sanity) + f.write('// TODO put stuff here\n') + f.write('\n') + f.write('#endif // %s\n' % define) + with open(os.path.join(outdir, 'types.hpp'), 'w') as f: + header = '%s/types.hpp' % proto2 + desc = 'Forward declarations of packet component types' + define = ('TMWA_%s_TYPES_HPP' % proto2).upper() + f.write('#ifndef %s\n' % define) + f.write('#define %s\n' % define) + f.write(copyright.format(filename=header, description=desc)) + f.write('\n') + f.write('# include "fwd.hpp"\n\n') + f.write('//TODO split the includes\n') + for inc in self._includes: + f.write(inc.pp(1)) + # this is writing another file + inc.testcase(outdir) + + f.write('template <class T>\n') + f.write('bool native_to_network(T *network, T native)\n{\n') + f.write(' *network = native;\n') + f.write(' return true;\n') + f.write('}\n') + f.write('template <class T>\n') + f.write('bool network_to_native(T *native, T network)\n{\n') + f.write(' *native = network;\n') + f.write(' return true;\n') + f.write('}\n') + + f.write('template <size_t N>\n') + f.write('struct NetString\n{\n') + f.write(' char data[N];\n') + f.write('};\n') + f.write('template <size_t N>\n') + f.write('bool native_to_network(NetString<N> *network, VString<N-1> native)\n{\n') + f.write(' // basically WBUF_STRING\n') + f.write(' char *const begin = network->data;\n') + f.write(' char *const end = begin + N;\n') + f.write(' char *const mid = std::copy(native.begin(), native.end(), begin);\n') + f.write(' std::fill(mid, end, \'\\0\');\n') + f.write(' return true;\n') + f.write('}\n') + f.write('template <size_t N>\n') + f.write('bool network_to_native(VString<N-1> *native, NetString<N> network)\n{\n') + f.write(' // basically RBUF_STRING\n') + f.write(' const char *const begin = network.data;\n') + f.write(' const char *const end = begin + N;\n') + f.write(' const char *const mid = std::find(begin, end, \'\\0\');\n') + f.write(' *native = XString(begin, mid, nullptr);\n') + f.write(' return true;\n') + f.write('}\n') + f.write('\n') + for ty in self._types: + ty.dump(f) + f.write('#endif // %s\n' % define) + for ch in self._channels: + ch.dump(outdir) + + + # types + + def provided(self, native, network): + # the whole point of 'provided' is to not be implemented + return ProvidedType(native, network) + + def enum(self, native, under): + rv = EnumType(native, under) + self._types.append(rv) + return rv + + def wrap(self, native, under): + rv = WrappedType(native, under) + self._types.append(rv) + return rv + + def string(self, native): + rv = StringType(native) + self._types.append(rv) + return rv + + def struct(self, name, body): + rv = StructType(name, body) + self._types.append(rv) + return rv + + def partial_struct(self, native, body): + rv = PartialStructType(native, body) + self._types.append(rv) + return rv + + +def main(): + + # setup + + ctx = Context(outdir='src/proto2/') + + + # headers + + cstdint = ctx.sysinclude('cstdint') + + endians_h = ctx.include('src/ints/little.hpp') + + vstring_h = ctx.include('src/strings/vstring.hpp') + + ip_h = ctx.include('src/net/ip.hpp') + + enums_h = ctx.include('src/mmo/enums.hpp') + human_time_diff_h = ctx.include('src/mmo/human_time_diff.hpp') + ids_h = ctx.include('src/mmo/ids.hpp') + strs_h = ctx.include('src/mmo/strs.hpp') + utils_h = ctx.include('src/mmo/utils.hpp') + version_h = ctx.include('src/mmo/version.hpp') + + + # included types + + uint8_t = cstdint.native('uint8_t') + uint16_t = cstdint.native('uint16_t') + uint32_t = cstdint.native('uint32_t') + uint64_t = cstdint.native('uint64_t') + + Byte = endians_h.neutral('Byte') + Little16 = endians_h.network('Little16') + Little32 = endians_h.network('Little32') + Little64 = endians_h.network('Little64') + + SEX = enums_h.native('SEX') + + Species = ids_h.native('Species') + AccountId = ids_h.native('AccountId') + CharId = ids_h.native('CharId') + PartyId = ids_h.native('PartyId') + ItemNameId = ids_h.native('ItemNameId') + BlockId = ids_h.native('BlockId') + GmLevel = ids_h.native('GmLevel') + + HumanTimeDiff = human_time_diff_h.native('HumanTimeDiff') + + Version = version_h.native('Version') + + ip4 = ip_h.neutral('IP4Address') + + TimeT = utils_h.native('TimeT') + + VString16 = vstring_h.native('VString<15>') + VString20 = vstring_h.native('VString<19>') + VString24 = vstring_h.native('VString<23>') + VString32 = vstring_h.native('VString<31>') + VString40 = vstring_h.native('VString<39>') + + # not all of these are used on the network side of things + # should this set of numbers be +1'ed ? + timestamp_seconds_buffer = utils_h.native('timestamp_seconds_buffer') + timestamp_milliseconds_buffer = utils_h.native('timestamp_milliseconds_buffer') + AccountName = strs_h.native('AccountName') + AccountPass = strs_h.native('AccountPass') + #AccountCrypt = strs_h.native('AccountCrypt') + AccountEmail = strs_h.native('AccountEmail') + ServerName = strs_h.native('ServerName') + #PartyName = strs_h.native('PartyName') + VarName = strs_h.native('VarName') + #MobName = map_t_h.native('MobName') + #NpcName = map_t_h.native('NpcName') + #ScriptLabel = map_t_h.native('ScriptLabel') + #ItemName = map_t_h.native('ItemName') + #md5_native = md5_h.native('md5_native') + #SaltString = md5_h.native('SaltString') + + # generated types + + u8 = ctx.provided(uint8_t, Byte) + u16 = ctx.provided(uint16_t, Little16) + u32 = ctx.provided(uint32_t, Little32) + u64 = ctx.provided(uint64_t, Little64) + + sex = ctx.enum(SEX, u8) + species = ctx.wrap(Species, u16) + account_id = ctx.wrap(AccountId, u32) + char_id = ctx.wrap(CharId, u32) + party_id = ctx.wrap(PartyId, u32) + item_name_id = ctx.wrap(ItemNameId, u16) + block_id = ctx.wrap(BlockId, u32) + + time32 = ctx.provided(TimeT, Little32) + time64 = ctx.provided(TimeT, Little64) + + gm1 = ctx.provided(GmLevel, Byte) + gm = ctx.provided(GmLevel, Little32) + + str16 = ctx.string(VString16) + str20 = ctx.string(VString20) + str24 = ctx.string(VString24) + str32 = ctx.string(VString32) + str40 = ctx.string(VString40) + + seconds = ctx.string(timestamp_seconds_buffer) + millis = ctx.string(timestamp_milliseconds_buffer) + account_name = ctx.string(AccountName) + account_pass = ctx.string(AccountPass) + #account_crypt = ctx.string(AccountCrypt) + account_email = ctx.string(AccountEmail) + server_name = ctx.string(ServerName) + #party_name = ctx.string(PartyName) + var_name = ctx.string(VarName) + #mob_name = ctx.string(MobName) + #npc_name = ctx.string(NpcName) + #script_label = ctx.string(ScriptLabel) + #item_name = ctx.string(ItemName) + #md5_string = ctx.string(md5_string) + #salt_string = ctx.string(SaltString) + + # this will be *so* useful when I do the party copy! + human_time_diff = ctx.partial_struct( + HumanTimeDiff, + [ + ('year', u16), + ('month', u16), + ('day', u16), + ('hour', u16), + ('minute', u16), + ('second', u16), + ] + ) + + version = ctx.partial_struct( + Version, + [ + ('major', u8), + ('minor', u8), + ('patch', u8), + ('devel', u8), + ('flags', u8), + ('which', u8), + ('vend', u16), + ] + ) + + # packets + + login_char = ctx.chan('login', 'char') + login_admin = ctx.chan('login', 'admin') + login_bot = NotImplemented + login_user = ctx.chan('login', 'user') + + char_map = ctx.chan('char', 'map') + char_admin = NotImplemented + char_bot = NotImplemented + char_user = ctx.chan('char', 'user') + + map_admin = NotImplemented + map_bot = NotImplemented + map_user = ctx.chan('map', 'user') + + any_user = ctx.chan('any', 'user') + + # map user + map_user.s(0x0212, + fixed=[ + at(0, u16, 'packet id'), + at(2, block_id, 'npc id'), + at(6, u16, 'command'), + at(8, block_id, 'id'), + at(12, u16, 'x'), + at(14, u16, 'y'), + ], + fixed_size=16, + ) + + # login char + login_char.r(0x2709, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + login_char.r(0x2712, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, u32, 'login id1'), + at(10, u32, 'login id2'), + at(14, sex, 'sex'), + at(15, ip4, 'ip'), + ], + fixed_size=19, + ) + login_char.s(0x2713, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, u8, 'invalid'), + at(7, account_email, 'email'), + at(47, time32, 'connect until'), + ], + fixed_size=51, + ) + login_char.r(0x2714, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'users'), + ], + fixed_size=6, + ) + login_char.r(0x2715, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_email, 'email'), + ], + fixed_size=46, + ) + login_char.r(0x2716, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + ], + fixed_size=6, + ) + login_char.s(0x2717, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_email, 'email'), + at(46, time32, 'connect until'), + ], + fixed_size=50, + ) + login_char.r(0x2720, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'packet length'), + at(4, u32, 'account id'), + ], + head_size=8, + repeat=[at(0, u8, 'c')], + repeat_size=1, + ) + login_char.s(0x2721, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, gm, 'gm level'), + ], + fixed_size=10, + ) + login_char.r(0x2722, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_email, 'old email'), + at(46, account_email, 'new email'), + ], + fixed_size=86, + ) + login_char.s(0x2723, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, sex, 'sex'), + ], + fixed_size=7, + ) + login_char.r(0x2724, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, u32, 'status'), + ], + fixed_size=10, + ) + login_char.r(0x2725, + head=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, human_time_diff, 'deltas'), + ], + head_size=18, + repeat=[at(0, u8, 'c')], + repeat_size=1, + ) + # evil packet, see also 0x794e + login_admin.r(0x2726, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'unused'), + at(4, u32, 'string length'), + ], + head_size=8, + repeat=[ + at(0, u8, 'c'), + ], + repeat_size=1, + ) + login_char.r(0x2727, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + ], + fixed_size=6, + ) + for (id, cat) in [ + (0x2728, login_char.r), + (0x2729, login_char.s), + ]: + cat(id, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'packet length'), + at(4, u32, 'account id'), + ], + head_size=8, + repeat=[ + at(0, var_name, 'name'), + at(32, u32, 'value'), + ], + repeat_size=36, + ) + login_char.r(0x272a, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + ], + fixed_size=6, + ) + login_char.s(0x2730, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + login_char.s(0x2731, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, u8, 'ban not status'), + at(7, time32, 'status or ban until'), + ], + fixed_size=11, + ) + login_char.s(0x2732, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'packet length'), + ], + head_size=4, + repeat=[ + at(0, u32, 'account id'), + at(4, gm1, 'gm level'), + ], + repeat_size=5, + ) + login_char.r(0x2740, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_pass, 'old pass'), + at(30, account_pass, 'new pass'), + ], + fixed_size=54, + ) + login_char.s(0x2741, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, u8, 'status'), + ], + fixed_size=7, + ) + + # any client + any_user.r(0x7530, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + any_user.s(0x7531, + fixed=[ + at(0, u16, 'packet id'), + at(2, version, 'version'), + ], + fixed_size=10, + ) + any_user.r(0x7532, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + + # login admin + login_admin.r(0x7920, + head=[ + at(0, u16, 'packet id'), + at(2, u32, 'start account id'), + at(6, u32, 'end account id'), + ], + head_size=10, + repeat=[at(0, u8, 'c')], + repeat_size=1, + ) + login_admin.s(0x7921, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'packet length'), + ], + head_size=4, + repeat=[ + at(0, u32, 'account id'), + at(4, gm1, 'gm level'), + at(5, account_name, 'account name'), + at(29, sex, 'sex'), + at(30, u32, 'login count'), + at(34, u32, 'status'), + ], + repeat_size=38, + ) + login_admin.r(0x7924, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'source item id'), + at(6, u32, 'dest item id'), + ], + fixed_size=10, + ) + login_admin.s(0x7925, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + login_admin.r(0x7930, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, account_pass, 'password'), + at(50, sex, 'sex'), + at(51, account_email, 'email'), + ], + fixed_size=91, + ) + login_admin.s(0x7931, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7932, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + ], + fixed_size=26, + ) + login_admin.s(0x7933, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7934, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, account_pass, 'password'), + ], + fixed_size=50, + ) + login_admin.s(0x7935, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7936, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, u32, 'status'), + at(30, seconds, 'error message'), + ], + fixed_size=50, + ) + login_admin.s(0x7937, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7938, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + login_admin.s(0x7939, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'packet length'), + ], + head_size=4, + repeat=[ + at(0, ip4, 'ip'), + at(4, u16, 'port'), + at(6, server_name, 'name'), + at(26, u16, 'users'), + at(28, u16, 'maintenance'), + at(30, u16, 'is_new'), + ], + repeat_size=32, + ) + login_admin.r(0x793a, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, account_pass, 'password'), + ], + fixed_size=50, + ) + login_admin.s(0x793b, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x793c, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, sex, 'sex'), + ], + fixed_size=27, + ) + login_admin.s(0x793d, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x793e, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, gm1, 'gm level'), + ], + fixed_size=27, + ) + login_admin.s(0x793f, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7940, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, account_email, 'email'), + ], + fixed_size=66, + ) + login_admin.s(0x7941, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + # this packet is insane + login_admin.r(0x7942, + head=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, u16, 'string length'), + ], + head_size=28, + repeat=[ + at(0, u8, 'c'), + ], + repeat_size=1, + ) + login_admin.s(0x7943, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7944, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + ], + fixed_size=26, + ) + login_admin.s(0x7945, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7946, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + ], + fixed_size=6, + ) + login_admin.s(0x7947, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + ], + fixed_size=30, + ) + login_admin.r(0x7948, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, time32, 'valid until'), + ], + fixed_size=30, + ) + login_admin.s(0x7949, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + at(30, time32, 'valid until'), + ], + fixed_size=34, + ) + login_admin.r(0x794a, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, time32, 'ban until'), + ], + fixed_size=30, + ) + login_admin.s(0x794b, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + at(30, time32, 'ban until'), + ], + fixed_size=34, + ) + login_admin.r(0x794c, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, human_time_diff, 'ban add'), + ], + fixed_size=38, + ) + login_admin.s(0x794d, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + at(30, time32, 'ban until'), + ], + fixed_size=34, + ) + # evil packet (see also 0x2726) + login_admin.r(0x794e, + head=[ + at(0, u16, 'packet id'), + at(2, u16, 'unused'), + at(4, u32, 'string length'), + ], + head_size=8, + repeat=[ + at(0, u8, 'c'), + ], + repeat_size=1, + ) + login_admin.s(0x794f, + fixed=[ + at(0, u16, 'packet id'), + at(2, u16, 'error'), + ], + fixed_size=4, + ) + login_admin.r(0x7950, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + at(26, human_time_diff, 'valid add'), + ], + fixed_size=38, + ) + login_admin.s(0x7951, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, account_name, 'account name'), + at(30, time32, 'valid until'), + ], + fixed_size=34, + ) + login_admin.r(0x7952, + fixed=[ + at(0, u16, 'packet id'), + at(2, account_name, 'account name'), + ], + fixed_size=26, + ) + # this packet is insane + login_admin.s(0x7953, + head=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + at(6, gm1, 'gm level'), + at(7, account_name, 'account name'), + at(31, sex, 'id'), + at(32, u32, 'login count'), + at(36, u32, 'state'), + at(40, seconds, 'error message'), + at(60, millis, 'last login string'), + at(84, str16, 'ip string'), + at(100, account_email, 'email'), + at(140, time32, 'connect until'), + at(144, time32, 'ban until'), + at(148, u16, 'string length'), + ], + head_size=150, + repeat=[ + at(0, u8, 'c'), + ], + repeat_size=1, + ) + login_admin.r(0x7954, + fixed=[ + at(0, u16, 'packet id'), + at(2, u32, 'account id'), + ], + fixed_size=6, + ) + login_admin.r(0x7955, + fixed=[ + at(0, u16, 'packet id'), + ], + fixed_size=2, + ) + + + # teardown + ctx.dump() + +if __name__ == '__main__': + main() |