summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-06 21:10:05 -0200
committershennetsind <ind@henn.et>2013-11-06 21:10:05 -0200
commiteaf04b9a2f0b399027df251c5d19d58d74e24e6a (patch)
treed4481d98fbaea267c6a7906c06c3f2af6bc9dca7 /src/map
parent665f1306a130d4b8c359972bf4e58ef9d3bd9cd8 (diff)
downloadhercules-eaf04b9a2f0b399027df251c5d19d58d74e24e6a.tar.gz
hercules-eaf04b9a2f0b399027df251c5d19d58d74e24e6a.tar.bz2
hercules-eaf04b9a2f0b399027df251c5d19d58d74e24e6a.tar.xz
hercules-eaf04b9a2f0b399027df251c5d19d58d74e24e6a.zip
BG Queue Update
Enabled Party/Guild joining methods, Implements first attempt at the splitting algorithm (Thanks to jaBote!) Checks item 1 on issue #69 Help us test! -- http://hercules.ws/board/topic/1302-bg-queue-debug/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battleground.c39
-rw-r--r--src/map/battleground.h9
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/party.c2
4 files changed, 41 insertions, 15 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 62688659e..84b41af29 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -520,13 +520,43 @@ void bg_begin(struct bg_arena *arena) {
bg->queue_pc_cleanup(sd);
}
}
+ /* TODO/FIXME? I *think* it should check what kind of queue the player used, then check if his party/guild
+ * (his team) still meet the join criteria (sort of what bg->can_queue does)
+ */
if( count < arena->min_players ) {
bg->match_over(arena,true);
} else {
arena->ongoing = true;
- mapreg->setreg(script->add_str("$@bg_queue_id"),arena->queue_id);/* TODO: make this a arena-independant var? or just .@? */
+ /* TODO: make this a arena-independant var? or just .@? */
+ mapreg->setreg(script->add_str("$@bg_queue_id"),arena->queue_id);
mapreg->setregstr(script->add_str("$@bg_delay_var$"),bg->gdelay_var);
+
+ count = 0;
+ for( i = 0; i < queue->size; i++ ) {
+ struct map_session_data * sd = NULL;
+
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
+ if( sd->bg_queue.ready == 1 ) {
+
+ mapreg->setreg(reference_uid(script->add_str("$@bg_member"), count), sd->status.account_id);
+
+ mapreg->setreg(reference_uid(script->add_str("$@bg_member_group"), count),
+ sd->bg_queue.type == BGQT_GUILD ? sd->status.guild_id :
+ sd->bg_queue.type == BGQT_PARTY ? sd->status.party_id :
+ 0
+ );
+ mapreg->setreg(reference_uid(script->add_str("$@bg_member_type"), count),
+ sd->bg_queue.type == BGQT_GUILD ? 1 :
+ sd->bg_queue.type == BGQT_PARTY ? 2 :
+ 0
+ );
+ count++;
+ }
+ }
+ }
+ mapreg->setreg(script->add_str("$@bg_member_size"),count);
+
npc->event_do(arena->npc_event);
/* we split evenly? */
/* but if a party of say 10 joins, it cant be split evenly unless by luck there are 10 soloers in the queue besides them */
@@ -685,12 +715,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
if( sd->bg_queue.arena != NULL )
return BGQA_DUPLICATE_REQUEST;
-
- if( type != BGQT_INDIVIDUAL ) {/* until we get the damn balancing correct */
- clif->colormes(sd->fd,COLOR_RED,"Queueing is only currently enabled only for Solo Mode");
- return BGQA_FAIL_TEAM_COUNT;
- }
-
+
switch(type) {
case BGQT_GUILD:
if( !sd->guild || !sd->state.gmaster_flag )
diff --git a/src/map/battleground.h b/src/map/battleground.h
index a5e540924..4150de8be 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -19,10 +19,11 @@
* 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,
};
struct battleground_member_data {
diff --git a/src/map/clif.c b/src/map/clif.c
index 913a94058..f309a53a9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9213,7 +9213,9 @@ void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
/// Notification from the client, that it has finished map loading and is about to display player's character (CZ_NOTIFY_ACTORINIT).
/// 007d
void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
+#if PACKETVER >= 20090218
int i;
+#endif
if(sd->bl.prev != NULL)
return;
@@ -17572,9 +17574,7 @@ void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) {
clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0);
return;
}
- //debug
- safestrncpy(arena->name, p->bg_name, sizeof(arena->name));
-
+
switch( (enum bg_queue_types)p->type ) {
case BGQT_INDIVIDUAL:
case BGQT_PARTY:
diff --git a/src/map/party.c b/src/map/party.c
index ab05c23f7..1f82028a8 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -849,7 +849,7 @@ int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
for( i = 0; i < MAX_PARTY; i++ )
{
struct map_session_data* sd = p->data[i].sd;
- if( !sd ) continue;
+ if( !sd || sd->bg_id ) continue;
if( p->data[i].x != sd->bl.x || p->data[i].y != sd->bl.y )
{// perform position update