Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef CHOOSEENTITIES_H_
|
||||
#define CHOOSEENTITIES_H_
|
||||
|
||||
struct chooseentities_ent_s {
|
||||
u64 entity;
|
||||
struct chooseentities_ent_s *next;
|
||||
};
|
||||
|
||||
struct chooseentities_s {
|
||||
u64 id;
|
||||
int nentity;
|
||||
struct chooseentities_ent_s *entity;
|
||||
};
|
||||
|
||||
void chooseentities_free(struct chooseentities_s *c);
|
||||
void *chooseentities_deserialize(char **dst, const char *maxdst);
|
||||
int chooseentities_serialize(void *ao, char **dst, const char *maxdst);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef ENTITYCHOICES_H_
|
||||
#define ENTITYCHOICES_H_
|
||||
|
||||
struct entitychoices_entities_s {
|
||||
u64 entity;
|
||||
struct entitychoices_entities_s *next;
|
||||
};
|
||||
|
||||
struct entitychoices_s {
|
||||
u64 id;
|
||||
u64 type;
|
||||
u64 countmin;
|
||||
u64 countmax;
|
||||
|
||||
u64 source;
|
||||
u64 player_id;
|
||||
|
||||
struct entitychoices_entities_s *entities;
|
||||
};
|
||||
|
||||
void entitychoices_free(struct entitychoices_s *ec);
|
||||
int entitychoices_serialize(void *ep, char **dst, const char *maxdst);
|
||||
void entitychoices_dump(struct entitychoices_s *es);
|
||||
void *entitychoices_deserialize(char **dst, const char *maxdst);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef TAG_H_
|
||||
#define TAG_H_
|
||||
|
||||
enum gametag_e {
|
||||
TAG_SCRIPT_DATA_NUM_1 = 2,
|
||||
TAG_SCRIPT_DATA_NUM_2 = 3,
|
||||
TAG_SCRIPT_DATA_ENT_1 = 4,
|
||||
TAG_SCRIPT_DATA_ENT_2 = 5,
|
||||
MISSION_EVENT = 6,
|
||||
TIMEOUT = 7,
|
||||
TURN_START = 8,
|
||||
TURN_TIMER_SLUSH = 9,
|
||||
PREMIUM = 12,
|
||||
GOLD_REWARD_STATE = 13,
|
||||
PLAYSTATE = 17,
|
||||
LAST_AFFECTED_BY = 18,
|
||||
STEP = 19,
|
||||
TURN = 20,
|
||||
FATIGUE = 22,
|
||||
CURRENT_PLAYER = 23,
|
||||
FIRST_PLAYER = 24,
|
||||
RESOURCES_USED = 25,
|
||||
RESOURCES = 26,
|
||||
HERO_ENTITY = 27,
|
||||
MAXHANDSIZE = 28,
|
||||
STARTHANDSIZE = 29,
|
||||
PLAYER_ID = 30,
|
||||
TEAM_ID = 31,
|
||||
TRIGGER_VISUAL = 32,
|
||||
RECENTLY_ARRIVED = 33,
|
||||
PROTECTING = 34,
|
||||
PROTECTED = 35,
|
||||
DEFENDING = 36,
|
||||
PROPOSED_DEFENDER = 37,
|
||||
ATTACKING = 38,
|
||||
PROPOSED_ATTACKER = 39,
|
||||
ATTACHED = 40,
|
||||
EXHAUSTED = 43,
|
||||
DAMAGE = 44,
|
||||
HEALTH = 45,
|
||||
ATK = 47,
|
||||
COST = 48,
|
||||
ZONE = 49,
|
||||
CONTROLLER = 50,
|
||||
OWNER = 51,
|
||||
DEFINITION = 52,
|
||||
ENTITY_ID = 53,
|
||||
HISTORY_PROXY = 54,
|
||||
COPY_DEATHRATTLE = 55,
|
||||
ELITE = 114,
|
||||
MAXRESOURCES = 176,
|
||||
CARD_SET = 183,
|
||||
CARDTEXT_INHAND = 184,
|
||||
CARDNAME = 185,
|
||||
CARD_ID = 186,
|
||||
DURABILITY = 187,
|
||||
SILENCED = 188,
|
||||
WINDFURY = 189,
|
||||
TAUNT = 190,
|
||||
STEALTH = 191,
|
||||
SPELLPOWER = 192,
|
||||
DIVINE_SHIELD = 194,
|
||||
CHARGE = 197,
|
||||
NEXT_STEP = 198,
|
||||
CLASS = 199,
|
||||
CARDRACE = 200,
|
||||
FACTION = 201,
|
||||
CARDTYPE = 202,
|
||||
RARITY = 203,
|
||||
STATE = 204,
|
||||
SUMMONED = 205,
|
||||
FREEZE = 208,
|
||||
ENRAGED = 212,
|
||||
OVERLOAD = 215,
|
||||
LOYALTY = 216,
|
||||
DEATHRATTLE = 217,
|
||||
BATTLECRY = 218,
|
||||
SECRET = 219,
|
||||
COMBO = 220,
|
||||
CANT_HEAL = 221,
|
||||
CANT_DAMAGE = 222,
|
||||
CANT_SET_ASIDE = 223,
|
||||
CANT_REMOVE_FROM_GAME = 224,
|
||||
CANT_READY = 225,
|
||||
CANT_EXHAUST = 226,
|
||||
CANT_ATTACK = 227,
|
||||
CANT_TARGET = 228,
|
||||
CANT_DESTROY = 229,
|
||||
CANT_DISCARD = 230,
|
||||
CANT_PLAY = 231,
|
||||
CANT_DRAW = 232,
|
||||
INCOMING_HEALING_MULTIPLIER = 233,
|
||||
INCOMING_HEALING_ADJUSTMENT = 234,
|
||||
INCOMING_HEALING_CAP = 235,
|
||||
INCOMING_DAMAGE_MULTIPLIER = 236,
|
||||
INCOMING_DAMAGE_ADJUSTMENT = 237,
|
||||
INCOMING_DAMAGE_CAP = 238,
|
||||
CANT_BE_HEALED = 239,
|
||||
CANT_BE_DAMAGED = 240,
|
||||
CANT_BE_SET_ASIDE = 241,
|
||||
CANT_BE_REMOVED_FROM_GAME = 242,
|
||||
CANT_BE_READIED = 243,
|
||||
CANT_BE_EXHAUSTED = 244,
|
||||
CANT_BE_ATTACKED = 245,
|
||||
CANT_BE_TARGETED = 246,
|
||||
CANT_BE_DESTROYED = 247,
|
||||
CANT_BE_SUMMONING_SICK = 253,
|
||||
FROZEN = 260,
|
||||
JUST_PLAYED = 261,
|
||||
LINKEDCARD = 262,
|
||||
ZONE_POSITION = 263,
|
||||
CANT_BE_FROZEN = 264,
|
||||
COMBO_ACTIVE = 266,
|
||||
CARD_TARGET = 267,
|
||||
NUM_CARDS_PLAYED_THIS_TURN = 269,
|
||||
CANT_BE_TARGETED_BY_OPPONENTS = 270,
|
||||
NUM_TURNS_IN_PLAY = 271,
|
||||
NUM_TURNS_LEFT = 272,
|
||||
OUTGOING_DAMAGE_CAP = 273,
|
||||
OUTGOING_DAMAGE_ADJUSTMENT = 274,
|
||||
OUTGOING_DAMAGE_MULTIPLIER = 275,
|
||||
OUTGOING_HEALING_CAP = 276,
|
||||
OUTGOING_HEALING_ADJUSTMENT = 277,
|
||||
OUTGOING_HEALING_MULTIPLIER = 278,
|
||||
INCOMING_ABILITY_DAMAGE_ADJUSTMENT = 279,
|
||||
INCOMING_COMBAT_DAMAGE_ADJUSTMENT = 280,
|
||||
OUTGOING_ABILITY_DAMAGE_ADJUSTMENT = 281,
|
||||
OUTGOING_COMBAT_DAMAGE_ADJUSTMENT = 282,
|
||||
OUTGOING_ABILITY_DAMAGE_MULTIPLIER = 283,
|
||||
OUTGOING_ABILITY_DAMAGE_CAP = 284,
|
||||
INCOMING_ABILITY_DAMAGE_MULTIPLIER = 285,
|
||||
INCOMING_ABILITY_DAMAGE_CAP = 286,
|
||||
OUTGOING_COMBAT_DAMAGE_MULTIPLIER = 287,
|
||||
OUTGOING_COMBAT_DAMAGE_CAP = 288,
|
||||
INCOMING_COMBAT_DAMAGE_MULTIPLIER = 289,
|
||||
INCOMING_COMBAT_DAMAGE_CAP = 290,
|
||||
CURRENT_SPELLPOWER = 291,
|
||||
ARMOR = 292,
|
||||
MORPH = 293,
|
||||
IS_MORPHED = 294,
|
||||
TEMP_RESOURCES = 295,
|
||||
OVERLOAD_OWED = 296,
|
||||
NUM_ATTACKS_THIS_TURN = 297,
|
||||
NEXT_ALLY_BUFF = 302,
|
||||
MAGNET = 303,
|
||||
FIRST_CARD_PLAYED_THIS_TURN = 304,
|
||||
MULLIGAN_STATE = 305,
|
||||
TAUNT_READY = 306,
|
||||
STEALTH_READY = 307,
|
||||
CHARGE_READY = 308,
|
||||
CANT_BE_TARGETED_BY_ABILITIES = 311,
|
||||
SHOULDEXITCOMBAT = 312,
|
||||
CREATOR = 313,
|
||||
CANT_BE_DISPELLED = 314,
|
||||
PARENT_CARD = 316,
|
||||
NUM_MINIONS_PLAYED_THIS_TURN = 317,
|
||||
PREDAMAGE = 318,
|
||||
TARGETING_ARROW_TEXT = 325,
|
||||
ENCHANTMENT_BIRTH_VISUAL = 330,
|
||||
ENCHANTMENT_IDLE_VISUAL = 331,
|
||||
CANT_BE_TARGETED_BY_HERO_POWERS = 332,
|
||||
HEALTH_MINIMUM = 337,
|
||||
TAG_ONE_TURN_EFFECT = 338,
|
||||
SILENCE = 339,
|
||||
COUNTER = 340,
|
||||
ARTISTNAME = 342,
|
||||
HAND_REVEALED = 348,
|
||||
ADJACENT_BUFF = 350,
|
||||
FLAVORTEXT = 351,
|
||||
FORCED_PLAY = 352,
|
||||
LOW_HEALTH_THRESHOLD = 353,
|
||||
SPELLPOWER_DOUBLE = 356,
|
||||
HEALING_DOUBLE = 357,
|
||||
NUM_OPTIONS_PLAYED_THIS_TURN = 358,
|
||||
TO_BE_DESTROYED = 360,
|
||||
AURA = 362,
|
||||
POISONOUS = 363,
|
||||
HOW_TO_EARN = 364,
|
||||
HOW_TO_EARN_GOLDEN = 365,
|
||||
HERO_POWER_DOUBLE = 366,
|
||||
AI_MUST_PLAY = 367,
|
||||
NUM_MINIONS_PLAYER_KILLED_THIS_TURN = 368,
|
||||
NUM_MINIONS_KILLED_THIS_TURN = 369,
|
||||
AFFECTED_BY_SPELL_POWER = 370,
|
||||
EXTRA_DEATHRATTLES = 371,
|
||||
START_WITH_1_HEALTH = 372,
|
||||
IMMUNE_WHILE_ATTACKING = 373,
|
||||
MULTIPLY_HERO_DAMAGE = 374,
|
||||
MULTIPLY_BUFF_VALUE = 375,
|
||||
CUSTOM_KEYWORD_EFFECT = 376,
|
||||
TOPDECK = 377,
|
||||
CANT_BE_TARGETED_BY_BATTLECRIES = 379,
|
||||
SHOWN_HERO_POWER = 380,
|
||||
DEATHRATTLE_RETURN_ZONE = 382,
|
||||
STEADY_SHOT_CAN_TARGET = 383,
|
||||
DISPLAYED_CREATOR = 385,
|
||||
POWERED_UP = 386,
|
||||
SPARE_PART = 388,
|
||||
FORGETFUL = 389,
|
||||
CAN_SUMMON_MAXPLUSONE_MINION = 390,
|
||||
OBFUSCATED = 391,
|
||||
BURNING = 392,
|
||||
OVERLOAD_LOCKED = 393,
|
||||
NUM_TIMES_HERO_POWER_USED_THIS_GAME = 394,
|
||||
CURRENT_HEROPOWER_DAMAGE_BONUS = 395,
|
||||
HEROPOWER_DAMAGE = 396,
|
||||
LAST_CARD_PLAYED = 397,
|
||||
NUM_FRIENDLY_MINIONS_THAT_DIED_THIS_TURN = 398,
|
||||
NUM_CARDS_DRAWN_THIS_TURN = 399,
|
||||
AI_ONE_SHOT_KILL = 400,
|
||||
EVIL_GLOW = 401,
|
||||
HIDE_COST = 402,
|
||||
INSPIRE = 403,
|
||||
RECEIVES_DOUBLE_SPELLDAMAGE_BONUS = 404,
|
||||
HEROPOWER_ADDITIONAL_ACTIVATIONS = 405,
|
||||
HEROPOWER_ACTIVATIONS_THIS_TURN = 406,
|
||||
REVEALED = 410,
|
||||
NUM_FRIENDLY_MINIONS_THAT_DIED_THIS_GAME = 412,
|
||||
CANNOT_ATTACK_HEROES = 413,
|
||||
LOCK_AND_LOAD = 414,
|
||||
TREASURE = 415,
|
||||
SHADOWFORM = 416,
|
||||
NUM_FRIENDLY_MINIONS_THAT_ATTACKED_THIS_TURN = 417,
|
||||
NUM_RESOURCES_SPENT_THIS_GAME = 418,
|
||||
CHOOSE_BOTH = 419,
|
||||
ELECTRIC_CHARGE_LEVEL = 420,
|
||||
HEAVILY_ARMORED = 421,
|
||||
DONT_SHOW_IMMUNE = 422,
|
||||
HISTORY_PROXY_NO_BIG_CARD = 432,
|
||||
TRANSFORMED_FROM_CARD = 435,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef MISC_H_
|
||||
#define MISC_H_
|
||||
|
||||
struct gamesetup_s {
|
||||
u64 board;
|
||||
u64 maxsecrets;
|
||||
u64 maxfriendlyminions;
|
||||
u64 keepalive;
|
||||
u64 stuckdisconnect;
|
||||
};
|
||||
|
||||
struct handshake_s {
|
||||
u64 gamehandle;
|
||||
char *password;
|
||||
int npassword;
|
||||
u64 clienthandle;
|
||||
u64 mission;
|
||||
char *version;
|
||||
int nversion;
|
||||
|
||||
struct platform_s *platform;
|
||||
};
|
||||
|
||||
struct platform_s {
|
||||
u64 os;
|
||||
u64 screen;
|
||||
int nname;
|
||||
char *name;
|
||||
u64 store;
|
||||
};
|
||||
|
||||
struct chooseoption_s {
|
||||
u64 id;
|
||||
u64 index;
|
||||
u64 target;
|
||||
u64 suboption;
|
||||
u64 position;
|
||||
};
|
||||
|
||||
void gamesetup_free(struct gamesetup_s *g);
|
||||
int gamesetup_serialize(void *data, char **dst, const char *maxdst);
|
||||
void *gamesetup_deserialize(char **dst, const char *maxdst);
|
||||
|
||||
void handshake_free(struct handshake_s *h);
|
||||
void *handshake_deserialize(char **dst, const char *maxdst);
|
||||
int handshake_serialize(void *ao, char **dst, const char *maxdst);
|
||||
|
||||
void platform_free(struct platform_s *p);
|
||||
struct platform_s *platform_deserialize(char **dst, const char *maxdst);
|
||||
int platform_serialize(void *ao, char **dst, const char *maxdst);
|
||||
int platform_size(struct platform_s *p);
|
||||
|
||||
int chooseoption_serialize(void *ao, char **dst, const char *maxdst);
|
||||
void chooseoption_free(struct chooseoption_s *c);
|
||||
void *chooseoption_deserialize(char **dst, const char *maxdst);
|
||||
void chooseoption_dump(struct chooseoption_s *o, u64 local_held_card);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef MOUSEINFO_H_
|
||||
#define MOUSEINFO_H_
|
||||
|
||||
struct mouseinfo_s {
|
||||
u64 arroworigin;
|
||||
u64 heldcard;
|
||||
u64 overcard;
|
||||
u64 x;
|
||||
u64 y;
|
||||
};
|
||||
|
||||
void mouseinfo_free(struct mouseinfo_s *p);
|
||||
void *mouseinfo_deserialize(char **dst, const char *maxdst);
|
||||
int mouseinfo_serialize(void *ao, char **dst, const char *maxdst);
|
||||
int mouseinfo_size(struct mouseinfo_s *p);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef OPTIONS_H_
|
||||
#define OPTIONS_H_
|
||||
|
||||
struct suboption_target_s {
|
||||
u64 value;
|
||||
struct suboption_target_s *next;
|
||||
};
|
||||
|
||||
struct suboption_s {
|
||||
u64 id;
|
||||
struct suboption_target_s *target;
|
||||
|
||||
struct suboption_s *next;
|
||||
};
|
||||
|
||||
struct option_s {
|
||||
u64 type;
|
||||
struct suboption_s *mainoption;
|
||||
struct suboption_s *suboptions;
|
||||
|
||||
struct option_s *next;
|
||||
};
|
||||
|
||||
struct alloptions_s {
|
||||
u64 id;
|
||||
struct option_s *options;
|
||||
};
|
||||
|
||||
void alloptions_free(struct alloptions_s *a);
|
||||
int alloptions_serialize(void *s, char **dst, const char *maxdst);
|
||||
int alloptions_size(struct alloptions_s *p);
|
||||
|
||||
void option_free(struct option_s *p);
|
||||
int option_serialize(struct option_s *s, char **dst, const char *maxdst);
|
||||
int option_size(struct option_s *p);
|
||||
|
||||
void suboption_free(struct suboption_s *p);
|
||||
int suboption_serialize(struct suboption_s *s, char **dst, const char *maxdst);
|
||||
int suboption_size(struct suboption_s *p);
|
||||
|
||||
void alloptions_dump(struct alloptions_s *a);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef PACKET_H_
|
||||
#define PACKET_H_
|
||||
|
||||
enum packet_e {
|
||||
P_GETGAMESTATE = 0x01,
|
||||
P_CHOOSEOPTION = 0x02,
|
||||
P_CHOOSEENTITIES = 0x03,
|
||||
P_TURNTIMER = 0x09,
|
||||
P_ENTITIESCHOSEN = 0x0D,
|
||||
P_ALLOPTIONS = 0x0E,
|
||||
P_USERUI = 0x0F,
|
||||
P_GAMESETUP = 0x10,
|
||||
P_ENTITYCHOICES = 0x11,
|
||||
P_POWERHISTORY = 0x13,
|
||||
P_SPECTATORNOTIFY = 0x18,
|
||||
P_PING = 0x73,
|
||||
P_PONG = 0x74,
|
||||
P_HANDSHAKE = 0xA8,
|
||||
};
|
||||
|
||||
struct packet_s {
|
||||
int id;
|
||||
int len;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct packet_meta_s {
|
||||
int id;
|
||||
void *(*deserialize)(char **dst, const char *end);
|
||||
int (*serialize)(void *p, char **dst, const char *end);
|
||||
int (*free)(void *p);
|
||||
};
|
||||
|
||||
#define parse_packet(m_p, m_buf, m_nbuf)\
|
||||
char *ptrd##m_buf = m_buf;\
|
||||
m_p = deserialize(&ptrd##m_buf, ptrd##m_buf + m_nbuf);
|
||||
|
||||
#define build_packet(m_p, m_src, m_type, m_buffer)\
|
||||
char m_buffer[8192];\
|
||||
char *ptr##m_buffer;\
|
||||
int n##m_buffer = 0;\
|
||||
ptr##m_buffer = m_buffer;\
|
||||
add_packet(&m_p, m_src, m_type);\
|
||||
n##m_buffer = serialize(m_p, &ptr##m_buffer, ptr##m_buffer + sizeof(m_buffer));
|
||||
|
||||
void packet_free(struct packet_s *p);
|
||||
struct packet_s *deserialize(char **dst, const char *maxdst);
|
||||
int serialize(struct packet_s *p, char **dst, const char *maxdst);
|
||||
struct packet_s *packet_init(enum packet_e id, void *data);
|
||||
void add_packet(struct packet_s **dst, void *ph, enum packet_e n);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef DEF_H_
|
||||
#define DEF_H_
|
||||
|
||||
struct powerhistory_tag_s {
|
||||
u64 name;
|
||||
u64 value;
|
||||
|
||||
struct powerhistory_tag_s *next;
|
||||
};
|
||||
|
||||
struct powerhistory_hide_s {
|
||||
u64 entity;
|
||||
u64 zone;
|
||||
};
|
||||
|
||||
struct powerhistory_tagchange_s {
|
||||
u64 entity;
|
||||
u64 tag;
|
||||
u64 value;
|
||||
};
|
||||
|
||||
struct powerhistory_entity_s {
|
||||
u64 entity;
|
||||
char *name;
|
||||
int nname;
|
||||
|
||||
struct powerhistory_tag_s *tag, *tag_tail;
|
||||
};
|
||||
|
||||
struct powerhistory_powerstart_s {
|
||||
u64 type;
|
||||
u64 index;
|
||||
u64 source;
|
||||
u64 target;
|
||||
|
||||
int ncard_id;
|
||||
char *card_id;
|
||||
};
|
||||
|
||||
struct powerhistory_powerend_s {
|
||||
int i;
|
||||
};
|
||||
|
||||
struct powerhistory_game_entity_s {
|
||||
u64 id;
|
||||
struct powerhistory_tag_s *tag, *tag_tail;
|
||||
};
|
||||
|
||||
struct powerhistory_s {
|
||||
struct powerhistory_data_s *data, *data_tail;
|
||||
};
|
||||
|
||||
struct powerhistory_info_s {
|
||||
u64 id;
|
||||
struct powerhistory_info_s *next;
|
||||
};
|
||||
|
||||
struct powerhistory_meta_s {
|
||||
u64 type;
|
||||
u64 data;
|
||||
struct powerhistory_info_s *info, *info_tail;
|
||||
};
|
||||
|
||||
struct powerhistory_player_s {
|
||||
u64 id;
|
||||
u64 bnet_hi;
|
||||
u64 bnet_lo;
|
||||
u64 cardback;
|
||||
struct powerhistory_game_entity_s *entity;
|
||||
|
||||
struct powerhistory_player_s *next;
|
||||
};
|
||||
|
||||
struct powerhistory_creategame_s {
|
||||
struct powerhistory_game_entity_s *game_entity;
|
||||
struct powerhistory_player_s *player, *player_tail;
|
||||
};
|
||||
|
||||
struct powerhistory_data_s {
|
||||
struct powerhistory_entity_s *full;
|
||||
struct powerhistory_entity_s *show;
|
||||
struct powerhistory_hide_s *hide;
|
||||
struct powerhistory_tagchange_s *tagchange;
|
||||
struct powerhistory_creategame_s *creategame;
|
||||
struct powerhistory_powerstart_s *powerstart;
|
||||
struct powerhistory_powerend_s *powerend;
|
||||
struct powerhistory_entity_s *change_entity;
|
||||
struct powerhistory_meta_s *meta;
|
||||
|
||||
struct powerhistory_data_s *next, *tail;
|
||||
};
|
||||
|
||||
void powerhistory_free(struct powerhistory_s *p);
|
||||
void *powerhistory_deserialize(char **dst, const char *maxdst);
|
||||
int powerhistory_serialize(void *data, char **dst, const char *maxdst);
|
||||
int powerhistory_size(struct powerhistory_s *ph);
|
||||
|
||||
struct powerhistory_data_s *powerhistory_data_deserialize(char **dst, const char *maxdst);
|
||||
int powerhistorydata_serialize(struct powerhistory_data_s *ph, char **dst, const char *maxdst);
|
||||
int powerhistorydata_size(struct powerhistory_data_s *ph);
|
||||
void powerhistory_data_free(struct powerhistory_data_s *d);
|
||||
|
||||
struct powerhistory_meta_s *meta_deserialize(char **dst, const char *maxdst);
|
||||
int meta_serialize(struct powerhistory_meta_s *ph, char **dst, const char *maxdst);
|
||||
int meta_size(struct powerhistory_meta_s *ph);
|
||||
void meta_free(struct powerhistory_meta_s *t);
|
||||
|
||||
struct powerhistory_powerend_s *powerend_deserialize(char **dst, const char *maxdst);
|
||||
int powerend_serialize(struct powerhistory_powerend_s *ph, char **dst, const char *maxdst);
|
||||
int powerend_size(struct powerhistory_powerend_s *ph);
|
||||
void powerend_free(struct powerhistory_powerend_s *p);
|
||||
|
||||
struct powerhistory_powerstart_s *powerstart_deserialize(char **dst, const char *maxdst);
|
||||
int powerstart_serialize(struct powerhistory_powerstart_s *ph, char **dst, const char *maxdst);
|
||||
int powerstart_size(struct powerhistory_powerstart_s *ph);
|
||||
void powerstart_free(struct powerhistory_powerstart_s *p);
|
||||
|
||||
struct powerhistory_creategame_s *creategame_deserialize(char **dst, const char *maxdst);
|
||||
int creategame_serialize(struct powerhistory_creategame_s *ph, char **dst, const char *maxdst);
|
||||
int creategame_size(struct powerhistory_creategame_s *ph);
|
||||
void creategame_free(struct powerhistory_creategame_s *c);
|
||||
|
||||
struct powerhistory_tagchange_s *tagchange_deserialize(char **dst, const char *maxdst);
|
||||
int tagchange_serialize(struct powerhistory_tagchange_s *ph, char **dst, const char *maxdst);
|
||||
int tagchange_size(struct powerhistory_tagchange_s *ph);
|
||||
void tagchange_free(struct powerhistory_tagchange_s *t);
|
||||
|
||||
struct powerhistory_hide_s *hide_deserialize(char **dst, const char *maxdst);
|
||||
int hide_serialize(struct powerhistory_hide_s *ph, char **dst, const char *maxdst);
|
||||
int hide_size(struct powerhistory_hide_s *ph);
|
||||
void hide_free(struct powerhistory_hide_s *t);
|
||||
|
||||
struct powerhistory_game_entity_s *game_entity_deserialize(char **dst, const char *maxdst);
|
||||
int game_entity_serialize(struct powerhistory_game_entity_s *ph, char **dst, const char *maxdst);
|
||||
int game_entity_size(struct powerhistory_game_entity_s *ph);
|
||||
void game_entity_free(struct powerhistory_game_entity_s *g);
|
||||
|
||||
struct powerhistory_entity_s *entity_deserialize(char **dst, const char *maxdst);
|
||||
int entity_serialize(struct powerhistory_entity_s *ph, char **dst, const char *maxdst);
|
||||
int entity_size(struct powerhistory_entity_s *ph);
|
||||
void entity_free(struct powerhistory_entity_s *e);
|
||||
|
||||
struct powerhistory_tag_s *tag_deserialize(char **dst, const char *maxdst);
|
||||
int tag_serialize(struct powerhistory_tag_s *ph, char **dst, const char *maxdst);
|
||||
int tag_size(struct powerhistory_tag_s *ph);
|
||||
void tag_free(struct powerhistory_tag_s *t);
|
||||
|
||||
void player_free(struct powerhistory_player_s *p);
|
||||
struct powerhistory_player_s *player_deserialize(char **dst, const char *maxdst);
|
||||
int player_serialize(struct powerhistory_player_s *ph, char **dst, const char *maxdst);
|
||||
int player_size(struct powerhistory_player_s *ph);
|
||||
|
||||
int bnet_size(struct powerhistory_player_s *ph);
|
||||
|
||||
void powerhistory_dump(struct powerhistory_s *p);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef PROTO_H_
|
||||
#define PROTO_H_
|
||||
|
||||
#define error()\
|
||||
hm_log(LOG_EMERG, lg, "dst: %p end: %p n: %d", *dst, maxdst, n);\
|
||||
abort();
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <ev.h>
|
||||
|
||||
#include <hmbase.h>
|
||||
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#include <zone.h>
|
||||
#include <misc.h>
|
||||
#include <powerhistory.h>
|
||||
#include <packet.h>
|
||||
#include <gametag.h>
|
||||
#include <entitychoices.h>
|
||||
#include <chooseentities.h>
|
||||
#include <options.h>
|
||||
#include <mouseinfo.h>
|
||||
#include <userui.h>
|
||||
#include <turntimer.h>
|
||||
|
||||
int sizeofu64(u64 v);
|
||||
int sizeofu32(int v);
|
||||
int write_byte(char **dst, const char *end, const char src);
|
||||
int write_bytes(char **dst, const char *end, const char *src, const int nsrc);
|
||||
void write_uint(char **dst, const char *end, int src);
|
||||
void write_uint64(char **dst, const char *end, u64 src);
|
||||
int write_mem_int(char **dst, const char *end, const int src);
|
||||
char read_byte(char **dst, const char *end);
|
||||
int read_uint(char **dst, const char *end);
|
||||
u64 read_uint64(char **dst, const char *end);
|
||||
int read_mem_int(char **dst, const char *end);
|
||||
char *read_bytes(char **dst, const char *end, int *ndst);
|
||||
int skip(char **dst, const char *end, const int jump);
|
||||
|
||||
extern struct hm_log_s *lg;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef TURNTIMER_H_
|
||||
#define TURNTIMER_H_
|
||||
|
||||
struct turntimer_s {
|
||||
u64 seconds;
|
||||
u64 turn;
|
||||
char show;
|
||||
};
|
||||
|
||||
void turntimer_free(struct turntimer_s *t);
|
||||
int turntimer_serialize(void *ao, char **dst, const char *maxdst);
|
||||
void turntimer_dump(struct turntimer_s *t);
|
||||
void *turntimer_deserialize(char **dst, const char *maxdst);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef USERUI_H_
|
||||
#define USERUI_H_
|
||||
|
||||
struct userui_s {
|
||||
struct mouseinfo_s *mouseinfo;
|
||||
u64 emote;
|
||||
u64 player_id;
|
||||
};
|
||||
|
||||
void userui_free(struct userui_s *u);
|
||||
int userui_serialize(void *ao, char **dst, const char *maxdst);
|
||||
void *userui_deserialize(char **dst, const char *maxdst);
|
||||
int userui_size(struct userui_s *p);
|
||||
void userui_dump(struct userui_s *u);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
hm_gameserver - hearthmod gameserver
|
||||
Copyright (C) 2016 Filip Pancik
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#ifndef ZONE_H_
|
||||
#define ZONE_H_
|
||||
|
||||
enum zone_e {
|
||||
ZONE_INVALID = 0,
|
||||
ZONE_PLAY = 1,
|
||||
ZONE_DECK = 2,
|
||||
ZONE_HAND = 3,
|
||||
ZONE_GRAVEYARD = 4,
|
||||
ZONE_REMOVEDFROMGAME = 5,
|
||||
ZONE_SETASIDE = 6,
|
||||
ZONE_SECRET = 7,
|
||||
ZONE_DISCARD = -2,
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user