diff options
author | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
---|---|---|
committer | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
commit | f52e1007fe08c67003c0bc4c78231904dd3fd5cc (patch) | |
tree | 99907d827264e501774e58ab4630e41fa7103c02 /src/map/battleground.h | |
parent | 2410110dece79b4598c12f1c953219f1d0d1904a (diff) | |
parent | 769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6 (diff) | |
download | hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.gz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.bz2 hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.xz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.zip |
Merge pull request #1 from HerculesWS/master
Update from original
Diffstat (limited to 'src/map/battleground.h')
-rw-r--r-- | src/map/battleground.h | 78 |
1 files changed, 48 insertions, 30 deletions
diff --git a/src/map/battleground.h b/src/map/battleground.h index 8fe9f3b77..c1d3be054 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -2,11 +2,12 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _BATTLEGROUND_H_ -#define _BATTLEGROUND_H_ +#ifndef MAP_BATTLEGROUND_H +#define MAP_BATTLEGROUND_H -#include "../common/mmo.h" // struct party +#include "clif.h" #include "guild.h" +#include "../common/mmo.h" // struct party /** * Defines @@ -18,16 +19,24 @@ * Enumerations **/ enum bg_queue_types { - BGQT_INVALID, - BGQT_INDIVIDUAL, - BGQT_PARTY, - BGQT_GUILD + BGQT_INVALID = 0x0, + BGQT_INDIVIDUAL = 0x1, + BGQT_PARTY = 0x2, + /* yup no 0x3 */ + BGQT_GUILD = 0x4, +}; + +enum bg_team_leave_type { + BGTL_LEFT = 0x0, + BGTL_QUIT = 0x1, + BGTL_AFK = 0x2, }; struct battleground_member_data { unsigned short x, y; struct map_session_data *sd; unsigned afk : 1; + struct point source;/* where did i come from before i join? */ }; struct battleground_data { @@ -41,22 +50,6 @@ struct battleground_data { char die_event[EVENT_NAME_LENGTH]; }; -void do_init_battleground(void); -void do_final_battleground(void); - -struct battleground_data* bg_team_search(int bg_id); -int bg_send_dot_remove(struct map_session_data *sd); -int bg_team_get_id(struct block_list *bl); -struct map_session_data* bg_getavailablesd(struct battleground_data *bg); - -int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const char *dev); -int bg_team_join(int bg_id, struct map_session_data *sd); -int bg_team_delete(int bg_id); -int bg_team_leave(struct map_session_data *sd, int flag); -int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y); -int bg_member_respawn(struct map_session_data *sd); -int bg_send_message(struct map_session_data *sd, const char *mes, int len); - struct bg_arena { char name[NAME_LENGTH]; unsigned char id; @@ -66,7 +59,6 @@ struct bg_arena { short min_players; short max_players; short min_team_players; - char cooldown_variable[NAME_LENGTH]; char delay_var[NAME_LENGTH]; unsigned short maxDuration; int queue_id; @@ -75,33 +67,59 @@ struct bg_arena { int game_timer; unsigned short fillup_duration; unsigned short pregame_duration; + bool ongoing; + enum bg_queue_types allowed_types; }; -/* battleground.c interface (incomplete) */ struct battleground_interface { bool queue_on; /* */ - int mafksec; + int mafksec, afk_timer_id; char gdelay_var[BG_DELAY_VAR_LENGTH]; /* */ struct bg_arena **arena; unsigned char arenas; /* */ + DBMap *team_db; // int bg_id -> struct battleground_data* + unsigned int team_counter; // Next bg_id + /* */ + void (*init) (bool minimal); + void (*final) (void); + /* */ struct bg_arena *(*name2arena) (char *name); void (*queue_add) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type); enum BATTLEGROUNDS_QUEUE_ACK (*can_queue) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type); int (*id2pos) (int queue_id, int account_id); void (*queue_pc_cleanup) (struct map_session_data *sd); void (*begin) (struct bg_arena *arena); - int (*begin_timer) (int tid, unsigned int tick, int id, intptr_t data); + int (*begin_timer) (int tid, int64 tick, int id, intptr_t data); void (*queue_pregame) (struct bg_arena *arena); - int (*fillup_timer) (int tid, unsigned int tick, int id, intptr_t data); + int (*fillup_timer) (int tid, int64 tick, int id, intptr_t data); + void (*queue_ready_ack) (struct bg_arena *arena, struct map_session_data *sd, bool response); + void (*match_over) (struct bg_arena *arena, bool canceled); + void (*queue_check) (struct bg_arena *arena); + struct battleground_data* (*team_search) (int bg_id); + struct map_session_data* (*getavailablesd) (struct battleground_data *bgd); + bool (*team_delete) (int bg_id); + bool (*team_warp) (int bg_id, unsigned short map_index, short x, short y); + void (*send_dot_remove) (struct map_session_data *sd); + bool (*team_join) (int bg_id, struct map_session_data *sd); + int (*team_leave) (struct map_session_data *sd, enum bg_team_leave_type flag); + bool (*member_respawn) (struct map_session_data *sd); + int (*create) (unsigned short map_index, short rx, short ry, const char *ev, const char *dev); + int (*team_get_id) (struct block_list *bl); + bool (*send_message) (struct map_session_data *sd, const char *mes, int len); + int (*send_xy_timer_sub) (DBKey key, DBData *data, va_list ap); + int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data); + int (*afk_timer) (int tid, int64 tick, int id, intptr_t data); + /* */ + enum bg_queue_types (*str2teamtype) (const char *str); /* */ void (*config_read) (void); -} bg_s; +}; struct battleground_interface *bg; void battleground_defaults(void); -#endif /* _BATTLEGROUND_H_ */ +#endif /* MAP_BATTLEGROUND_H */ |