diff options
-rw-r--r-- | src/map/battleground.c | 14 | ||||
-rw-r--r-- | src/map/battleground.h | 1 | ||||
-rw-r--r-- | src/map/clif.c | 10 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c index 64bc25269..88cc323bf 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -420,9 +420,20 @@ int bg_id2pos ( int queue_id, int account_id ) { } return 0; } +void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bool response) { + if( arena->begin_timer == INVALID_TIMER || !sd->bg_queue.arena || sd->bg_queue.arena != arena ) { + bg->queue_pc_cleanup(sd); + return; + } + if( response ) { + sd->bg_queue.ready = 1; + /* check if all are ready then cancell timer, and start game */ + } else + bg->queue_pc_cleanup(sd); +} void bg_queue_player_cleanup(struct map_session_data *sd) { if ( sd->bg_queue.client_has_bg_data ) { - clif->bgqueue_notice_delete(sd,BGQND_CLOSEWINDOW, sd->bg_queue.arena->id); + clif->bgqueue_notice_delete(sd,BGQND_CLOSEWINDOW, sd->bg_queue.arena ? sd->bg_queue.arena->id : 0); } script->queue_remove(sd->bg_queue.arena->queue_id,sd->status.account_id); sd->bg_queue.arena = NULL; @@ -726,6 +737,7 @@ void battleground_defaults(void) { bg->begin_timer = bg_begin_timer; bg->queue_pregame = bg_queue_pregame; bg->fillup_timer = bg_fillup_timer; + bg->queue_ready_ack = bg_queue_ready_ack; /* */ bg->config_read = bg_config_read; } diff --git a/src/map/battleground.h b/src/map/battleground.h index 8fe9f3b77..030d13d90 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -96,6 +96,7 @@ struct battleground_interface { int (*begin_timer) (int tid, unsigned int 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); + void (*queue_ready_ack) (struct bg_arena *arena, struct map_session_data *sd, bool response); /* */ void (*config_read) (void); } bg_s; diff --git a/src/map/clif.c b/src/map/clif.c index e8de09d70..0c2d16a4d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17399,8 +17399,14 @@ void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) { } void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) { - //struct packet_bgqueue_battlebegin_ack *p = P2PTR(fd, bgqueue_checkstateType); - return; + struct packet_bgqueue_battlebegin_ack *p = P2PTR(fd, bgqueue_checkstateType); + struct bg_arena *arena; + if( !bg->queue_on ) return; /* temp, until feature is complete */ + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? true : false); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } //if ( p->result == 1 ) // bg->queue_pc_ready(sd); //else |