summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-29 16:49:52 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-29 16:49:52 +0000
commitff0af0b4437fb987bc0cf2c0091942a266b8731e (patch)
treed25e7820182d6cdbce85ca23fcf2d85ef33faa77
parentfcdf995bd039935c5cdf4842ea9158d44ee6de29 (diff)
downloadhercules-ff0af0b4437fb987bc0cf2c0091942a266b8731e.tar.gz
hercules-ff0af0b4437fb987bc0cf2c0091942a266b8731e.tar.bz2
hercules-ff0af0b4437fb987bc0cf2c0091942a266b8731e.tar.xz
hercules-ff0af0b4437fb987bc0cf2c0091942a266b8731e.zip
- Implementing official battleground "emblem" crossed swords icon.
- Removing the custom guild packets from Battleground as they are not needed anymore. - Scripts updated. - In this way, you get "battle cursor" over your same team, but that's how official does. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13635 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--conf/battle/battleground.conf14
-rw-r--r--db/bgemblem_1.ebm2
-rw-r--r--db/bgemblem_2.ebmbin614 -> 0 bytes
-rw-r--r--npc/battleground/bg_flavius_01.txt4
-rw-r--r--npc/battleground/bg_flavius_02.txt4
-rw-r--r--npc/battleground/bg_tierra_01.txt4
-rw-r--r--npc/battleground/bg_tierra_02.txt4
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/battleground.c117
-rw-r--r--src/map/battleground.h7
-rw-r--r--src/map/clif.c264
-rw-r--r--src/map/clif.h10
-rw-r--r--src/map/script.c10
14 files changed, 75 insertions, 369 deletions
diff --git a/conf/battle/battleground.conf b/conf/battle/battleground.conf
index 63375986f..a91e1ddd6 100644
--- a/conf/battle/battleground.conf
+++ b/conf/battle/battleground.conf
@@ -42,17 +42,3 @@ bg_flee_penalty: 20
// Interval before updating the bg-member map mini-dots (milliseconds)
bg_update_interval: 1000
-
-// Reserved Guild ID's for battlegrounds
-// Please take care of this configuration, you need to take 2 guild ids manually created
-// in your guild database (txt or sql). Only the ID's are required.
-// Take care this this "Fake guilds" will be never used by players.
-bg_guild_id1: 998
-bg_guild_id2: 999
-
-// ** BattleGround Emblems **
-// In the folder /db you will find 2 files:
-// bgemblem_1.ebm (used for General Guillaume Marollo)
-// bgemblem_2.ebm (used for Prince Croix Marollo)
-// You can set your own emblems for battleground, using files from the _tmpEmblem folder
-// in your client files, just remember to keep the names.
diff --git a/db/bgemblem_1.ebm b/db/bgemblem_1.ebm
deleted file mode 100644
index b217e7886..000000000
--- a/db/bgemblem_1.ebm
+++ /dev/null
@@ -1,2 +0,0 @@
-xoSe?}[߶v1vXnt]O e誝B`P ` ,ZC B/11bFC$rxSY9ys>9M5 e~z[rMԞ I
-M."Uz=GԳ#KmpKm%ϠHZQ<y}D"~Ϯ`H,\H&>䝞4RX%܉lusVL6KMC:P&;\s,Z{%@-'q#+n*qɫC"?S1L7b-|eƹMgzɬnM|ٽ+N{Z=wEb=S k2N?,*saob`,`9pv>snPq"Gۺ l|Ցcår;qm#Ls7!Sv1S"0 mTMחV>Q'HOOz-gbl^l7IEb#F<vt:/|@ ]VET<n QU)SR{GQYScu /__!˫ݗȻ_Pھx<~ظAOk Ꮧ#>IYAgK}b{I) $~o5.KRŜų¯ӯjY[=fvdQ,cPCkLWVkbn? \ No newline at end of file
diff --git a/db/bgemblem_2.ebm b/db/bgemblem_2.ebm
deleted file mode 100644
index 96d260c77..000000000
--- a/db/bgemblem_2.ebm
+++ /dev/null
Binary files differ
diff --git a/npc/battleground/bg_flavius_01.txt b/npc/battleground/bg_flavius_01.txt
index 89d520371..dbfea0873 100644
--- a/npc/battleground/bg_flavius_01.txt
+++ b/npc/battleground/bg_flavius_01.txt
@@ -11,7 +11,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Flavius_BG1::OnGuillaumeJoin",1;
end;
OnEnterBG:
- set $@FlaviusBG1_id1, waitingroom2bg("bat_b01",390,10,0,"Flavius_BG1::OnGuillaumeQuit","");
+ set $@FlaviusBG1_id1, waitingroom2bg("bat_b01",390,10,"Flavius_BG1::OnGuillaumeQuit","");
end;
}
@@ -21,7 +21,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Flavius_BG1::OnCroixJoin",1;
end;
OnEnterBG:
- set $@FlaviusBG1_id2, waitingroom2bg("bat_b01",10,290,1,"Flavius_BG1::OnCroixQuit","");
+ set $@FlaviusBG1_id2, waitingroom2bg("bat_b01",10,290,"Flavius_BG1::OnCroixQuit","");
end;
}
diff --git a/npc/battleground/bg_flavius_02.txt b/npc/battleground/bg_flavius_02.txt
index 493979a06..57cb79246 100644
--- a/npc/battleground/bg_flavius_02.txt
+++ b/npc/battleground/bg_flavius_02.txt
@@ -11,7 +11,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Flavius_BG2::OnGuillaumeJoin",1;
end;
OnEnterBG:
- set $@FlaviusBG2_id1, waitingroom2bg("bat_b02",390,10,0,"Flavius_BG2::OnGuillaumeQuit","");
+ set $@FlaviusBG2_id1, waitingroom2bg("bat_b02",390,10,"Flavius_BG2::OnGuillaumeQuit","");
end;
}
@@ -21,7 +21,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Flavius_BG2::OnCroixJoin",1;
end;
OnEnterBG:
- set $@FlaviusBG2_id2, waitingroom2bg("bat_b02",10,290,1,"Flavius_BG2::OnCroixQuit","");
+ set $@FlaviusBG2_id2, waitingroom2bg("bat_b02",10,290,"Flavius_BG2::OnCroixQuit","");
end;
}
diff --git a/npc/battleground/bg_tierra_01.txt b/npc/battleground/bg_tierra_01.txt
index 884f15e17..ed1e65120 100644
--- a/npc/battleground/bg_tierra_01.txt
+++ b/npc/battleground/bg_tierra_01.txt
@@ -11,7 +11,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Tierra_BG1::OnGuillaumeJoin",1;
end;
OnEnterBG:
- set $@TierraBG1_id1, waitingroom2bg("bat_a01",50,374,0,"Tierra_BG1::OnGuillaumeQuit","");
+ set $@TierraBG1_id1, waitingroom2bg("bat_a01",50,374,"Tierra_BG1::OnGuillaumeQuit","");
end;
}
@@ -21,7 +21,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Tierra_BG1::OnCroixJoin",1;
end;
OnEnterBG:
- set $@TierraBG1_id2, waitingroom2bg("bat_a01",42,16,1,"Tierra_BG1::OnCroixQuit","");
+ set $@TierraBG1_id2, waitingroom2bg("bat_a01",42,16,"Tierra_BG1::OnCroixQuit","");
end;
}
diff --git a/npc/battleground/bg_tierra_02.txt b/npc/battleground/bg_tierra_02.txt
index 3789cd4bd..a69f65e2b 100644
--- a/npc/battleground/bg_tierra_02.txt
+++ b/npc/battleground/bg_tierra_02.txt
@@ -11,7 +11,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Tierra_BG2::OnGuillaumeJoin",1;
end;
OnEnterBG:
- set $@TierraBG2_id1, waitingroom2bg("bat_a02",50,374,0,"Tierra_BG2::OnGuillaumeQuit","");
+ set $@TierraBG2_id1, waitingroom2bg("bat_a02",50,374,"Tierra_BG2::OnGuillaumeQuit","");
end;
}
@@ -21,7 +21,7 @@ OnInit:
waitingroom "Battle Station 10 Players",10,"Tierra_BG2::OnCroixJoin",1;
end;
OnEnterBG:
- set $@TierraBG2_id2, waitingroom2bg("bat_a02",42,16,1,"Tierra_BG2::OnCroixQuit","");
+ set $@TierraBG2_id2, waitingroom2bg("bat_a02",42,16,"Tierra_BG2::OnCroixQuit","");
end;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index bd9e49f5a..5c1c9562a 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3829,8 +3829,6 @@ static const struct _battle_data {
{ "display_status_timers", &battle_config.display_status_timers, 1, 0, 1, },
// BattleGround Settings
{ "bg_update_interval", &battle_config.bg_update_interval, 1000, 100, INT_MAX, },
- { "bg_guild_id1", &battle_config.bg_guild_id1, 0, 0, INT_MAX, },
- { "bg_guild_id2", &battle_config.bg_guild_id2, 0, 0, INT_MAX, },
{ "bg_short_attack_damage_rate", &battle_config.bg_short_damage_rate, 80, 0, INT_MAX, },
{ "bg_long_attack_damage_rate", &battle_config.bg_long_damage_rate, 80, 0, INT_MAX, },
{ "bg_weapon_attack_damage_rate", &battle_config.bg_weapon_damage_rate, 60, 0, INT_MAX, },
diff --git a/src/map/battle.h b/src/map/battle.h
index 21c68b50b..8cca3886c 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -464,8 +464,6 @@ extern struct Battle_Config
int display_status_timers; //Show or hide skill buff/delay timers in recent clients [Sara]
// [BattleGround Settings]
int bg_update_interval;
- int bg_guild_id1;
- int bg_guild_id2;
int bg_short_damage_rate;
int bg_long_damage_rate;
int bg_weapon_damage_rate;
diff --git a/src/map/battleground.c b/src/map/battleground.c
index f26f1efb9..40fe2a0c6 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -24,7 +24,6 @@
static DBMap* bg_team_db; // int bg_id -> struct battleground_data*
static unsigned int bg_team_counter = 0; // Next bg_id
-struct guild bg_guild[2]; // Temporal fake guild information
struct battleground_data* bg_team_search(int bg_id)
{ // Search a BG Team using bg_id
@@ -45,7 +44,6 @@ int bg_team_delete(int bg_id)
int i;
struct map_session_data *sd;
struct battleground_data *bg = bg_team_search(bg_id);
- struct guild *g;
if( bg == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
@@ -55,19 +53,6 @@ int bg_team_delete(int bg_id)
bg_send_dot_remove(sd);
sd->state.bg_id = 0;
- if( sd->status.guild_id && (g = guild_search(sd->status.guild_id)) != NULL )
- {
- clif_guild_belonginfo(sd,g);
- clif_guild_basicinfo(sd);
- clif_guild_allianceinfo(sd);
- clif_guild_memberlist(sd);
- clif_guild_skillinfo(sd);
- }
- else
- clif_bg_leave_single(sd, sd->status.name, "Leaving Battleground...");
-
- clif_charnameupdate(sd);
- clif_guild_emblem_area(&sd->bl);
}
idb_remove(bg_team_db, bg_id);
return 1;
@@ -108,25 +93,15 @@ int bg_team_join(int bg_id, struct map_session_data *sd)
bg->count++;
guild_send_dot_remove(sd);
- clif_bg_belonginfo(sd);
- // clif_bg_emblem(sd, bg->g);
- clif_charnameupdate(sd);
for( i = 0; i < MAX_BG_MEMBERS; i++ )
{
- if( (pl_sd = bg->members[i].sd) == NULL )
- continue;
- clif_guild_basicinfo(pl_sd);
- clif_bg_emblem(pl_sd, bg->g);
- clif_bg_memberlist(pl_sd);
- if( pl_sd != sd )
+ if( (pl_sd = bg->members[i].sd) != NULL && pl_sd != sd )
clif_hpmeter_single(sd->fd, pl_sd->bl.id, pl_sd->battle_status.hp, pl_sd->battle_status.max_hp);
}
- clif_guild_emblem_area(&sd->bl);
clif_bg_hp(sd);
clif_bg_xy(sd);
-
return 1;
}
@@ -134,52 +109,28 @@ int bg_team_leave(struct map_session_data *sd, int flag)
{ // Single Player leaves team
int i, bg_id;
struct battleground_data *bg;
- struct map_session_data *pl_sd;
- struct guild *g;
+ char output[128];
if( sd == NULL || !sd->state.bg_id )
return 0;
- // Packets
- clif_bg_leave_single(sd, sd->status.name, "Leaving Battle...");
bg_send_dot_remove(sd);
bg_id = sd->state.bg_id;
sd->state.bg_id = 0;
- if( sd->status.guild_id && (g = guild_search(sd->status.guild_id)) != NULL )
- { // Refresh Guild Information
- clif_guild_belonginfo(sd, g);
- clif_guild_basicinfo(sd);
- clif_guild_allianceinfo(sd);
- clif_guild_memberlist(sd);
- clif_guild_skillinfo(sd);
- clif_guild_emblem(sd, g);
- }
-
- clif_charnameupdate(sd);
- clif_guild_emblem_area(&sd->bl);
-
if( (bg = bg_team_search(bg_id)) == NULL )
return 0;
ARR_FIND(0, MAX_BG_MEMBERS, i, bg->members[i].sd == sd);
if( i < MAX_BG_MEMBERS ) // Removes member from BG
memset(&bg->members[i], 0, sizeof(bg->members[0]));
-
bg->count--;
- for( i = 0; i < MAX_BG_MEMBERS; i++ )
- { // Update other BG members
- if( (pl_sd = bg->members[i].sd) == NULL )
- continue;
- if( flag )
- clif_bg_expulsion_single(pl_sd, sd->status.name, "User has quit the game...");
- else
- clif_bg_leave_single(pl_sd, sd->status.name, "Leaving Battle...");
-
- clif_guild_basicinfo(pl_sd);
- clif_bg_emblem(pl_sd, bg->g);
- clif_bg_memberlist(pl_sd);
- }
+
+ if( flag )
+ sprintf(output, "Server : %s has quit the game...", sd->status.name);
+ else
+ sprintf(output, "Server : %s is leaving the battlefield...", sd->status.name);
+ clif_bg_message(bg, "Server", output, strlen(output) + 1);
if( bg->logout_event[0] && flag )
npc_event(sd, bg->logout_event, 0);
@@ -200,14 +151,7 @@ int bg_member_respawn(struct map_session_data *sd)
return 1; // Warped
}
-struct guild* bg_guild_get(int bg_id)
-{ // Return Fake Guild for BG Members
- struct battleground_data *bg = bg_team_search(bg_id);
- if( bg == NULL ) return NULL;
- return bg->g;
-}
-
-int bg_create(unsigned short mapindex, short rx, short ry, int guild_index, const char *ev, const char *dev)
+int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const char *dev)
{
struct battleground_data *bg;
bg_team_counter++;
@@ -215,7 +159,6 @@ int bg_create(unsigned short mapindex, short rx, short ry, int guild_index, cons
CREATE(bg, struct battleground_data, 1);
bg->bg_id = bg_team_counter;
bg->count = 0;
- bg->g = &bg_guild[guild_index];
bg->mapindex = mapindex;
bg->x = rx;
bg->y = ry;
@@ -299,53 +242,11 @@ int bg_send_xy_timer(int tid, unsigned int tick, int id, intptr data)
return 0;
}
-void bg_guild_build_data(void)
-{
- int i, j;
- memset(&bg_guild, 0, sizeof(bg_guild));
- for( i = 1; i <= 2; i++ )
- { // Emblem Data
- FILE* fp = NULL;
- char path[256];
-
- j = i - 1;
- sprintf(path, "%s/bgemblem_%d.ebm", db_path, i);
- if( (fp = fopen(path, "rb")) == NULL )
- continue;
-
- bg_guild[j].emblem_id = 1;
- fseek(fp, 0, SEEK_END);
- bg_guild[j].emblem_len = ftell(fp);
- fseek(fp, 0, SEEK_SET);
- fread(&bg_guild[j].emblem_data, 1, bg_guild[j].emblem_len, fp);
- fclose(fp);
-
- ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"' emblem data file.\n", path);
- }
-
- // Guild Data - Guillaume
- strncpy(bg_guild[0].name, "Blue Team", NAME_LENGTH);
- strncpy(bg_guild[0].master, "General Guillaume Marollo", NAME_LENGTH);
- bg_guild[0].guild_id = battle_config.bg_guild_id1;
- bg_guild[0].guild_lv = 1;
- strncpy(bg_guild[0].position[0].name, "Blue Team", NAME_LENGTH);
- bg_guild[0].max_member = MAX_BG_MEMBERS;
-
- // Guild Data - Croix
- strncpy(bg_guild[1].name, "Red Team", NAME_LENGTH);
- strncpy(bg_guild[1].master, "Prince Croix Marollo", NAME_LENGTH);
- bg_guild[1].guild_id = battle_config.bg_guild_id2;
- bg_guild[1].guild_lv = 1;
- strncpy(bg_guild[1].position[0].name, "Red Team", NAME_LENGTH);
- bg_guild[1].max_member = MAX_BG_MEMBERS;
-}
-
void do_init_battleground(void)
{
bg_team_db = idb_alloc(DB_OPT_RELEASE_DATA);
add_timer_func_list(bg_send_xy_timer, "bg_send_xy_timer");
add_timer_interval(gettick() + battle_config.bg_update_interval, bg_send_xy_timer, 0, 0, battle_config.bg_update_interval);
- bg_guild_build_data();
}
void do_final_battleground(void)
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 97a9a19dd..946ac2692 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -19,8 +19,6 @@ struct battleground_data {
unsigned int bg_id;
unsigned char count;
struct battleground_member_data members[MAX_BG_MEMBERS];
- // Fake Guild Link
- struct guild *g;
// BG Cementery
unsigned short mapindex, x, y;
// Logout Event
@@ -28,18 +26,15 @@ struct battleground_data {
char die_event[50];
};
-extern struct guild bg_guild[];
-
void do_init_battleground(void);
void do_final_battleground(void);
struct battleground_data* bg_team_search(int bg_id);
-struct guild* bg_guild_get(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, int guild_index, const char *ev, const char *dev);
+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);
diff --git a/src/map/clif.c b/src/map/clif.c
index 0ccb6a031..883ac73b7 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -812,8 +812,8 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS )
{ //The hell, why flags work like this?
- WBUFL(buf,22) = clif_visual_emblem_id(bl);
- WBUFL(buf,26) = clif_visual_guild_id(bl);
+ WBUFL(buf,22) = status_get_emblem_id(bl);
+ WBUFL(buf,26) = status_get_guild_id(bl);
}
WBUFW(buf,28) = vd->hair_color;
@@ -827,8 +827,8 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFB(buf,40) = 0;
return packet_len(0x7c);
}
- WBUFL(buf,34) = clif_visual_guild_id(bl);
- WBUFW(buf,38) = clif_visual_emblem_id(bl);
+ WBUFL(buf,34) = status_get_guild_id(bl);
+ WBUFW(buf,38) = status_get_emblem_id(bl);
WBUFW(buf,40) = (sd)? sd->status.manner : 0;
#if PACKETVER >= 7
if (!type) {
@@ -908,8 +908,8 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
WBUFW(buf,32) = vd->hair_color;
WBUFW(buf,34) = vd->cloth_color;
WBUFW(buf,36) = (sd)? sd->head_dir : 0;
- WBUFL(buf,38) = clif_visual_guild_id(bl);
- WBUFW(buf,42) = clif_visual_emblem_id(bl);
+ WBUFL(buf,38) = status_get_guild_id(bl);
+ WBUFW(buf,42) = status_get_emblem_id(bl);
WBUFW(buf,44) = (sd)? sd->status.manner : 0;
#if PACKETVER < 7
WBUFW(buf,46) = (sc)? sc->opt3 : 0;
@@ -1062,6 +1062,8 @@ int clif_spawn(struct block_list *bl)
clif_specialeffect(bl,423,AREA);
else if(sd->state.size==1)
clif_specialeffect(bl,421,AREA);
+ if( sd->state.bg_id && map[sd->bl.m].flag.battleground )
+ clif_sendbgemblem_area(sd);
}
break;
case BL_MOB:
@@ -3484,6 +3486,8 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
clif_specialeffect_single(bl,423,sd->fd);
else if(tsd->state.size==1)
clif_specialeffect_single(bl,421,sd->fd);
+ if( tsd->state.bg_id && map[tsd->bl.m].flag.battleground )
+ clif_sendbgemblem_single(sd->fd,tsd);
}
break;
case BL_MER: // Devotion Effects
@@ -6200,8 +6204,6 @@ int clif_guild_belonginfo(struct map_session_data *sd, struct guild *g)
{
int ps,fd;
nullpo_retr(0, sd);
- if( sd->state.bg_id )
- return clif_bg_belonginfo(sd);
nullpo_retr(0, g);
fd=sd->fd;
@@ -6302,24 +6304,18 @@ int clif_guild_basicinfo(struct map_session_data *sd)
int fd,i,t;
struct guild *g;
struct guild_castle *gc = NULL;
- struct battleground_data *bg = NULL;
nullpo_retr(0, sd);
fd = sd->fd;
- if( sd->state.bg_id && (g = bg_guild_get(sd->state.bg_id)) != NULL )
- bg = bg_team_search(sd->state.bg_id);
- else
- g = guild_search(sd->status.guild_id);
-
- if( g == NULL )
+ if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
WFIFOHEAD(fd,packet_len(0x1b6));
WFIFOW(fd, 0)=0x1b6;//0x150;
WFIFOL(fd, 2)=g->guild_id;
WFIFOL(fd, 6)=g->guild_lv;
- WFIFOL(fd,10)=bg?bg->count:g->connect_member;
+ WFIFOL(fd,10)=g->connect_member;
WFIFOL(fd,14)=g->max_member;
WFIFOL(fd,18)=g->average_lv;
WFIFOL(fd,22)=g->exp;
@@ -6352,10 +6348,7 @@ int clif_guild_allianceinfo(struct map_session_data *sd)
struct guild *g;
nullpo_retr(0, sd);
- if( !sd->state.bg_id || (g = bg_guild_get(sd->state.bg_id)) == NULL )
- g = guild_search(sd->status.guild_id);
-
- if( g == NULL )
+ if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
fd = sd->fd;
@@ -6387,8 +6380,6 @@ int clif_guild_memberlist(struct map_session_data *sd)
if( (fd = sd->fd) == 0 )
return 0;
- if( sd->state.bg_id )
- return clif_bg_memberlist(sd);
if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
@@ -6425,10 +6416,7 @@ int clif_guild_positionnamelist(struct map_session_data *sd)
struct guild *g;
nullpo_retr(0, sd);
- if( !sd->state.bg_id || (g = bg_guild_get(sd->state.bg_id)) == NULL )
- g = guild_search(sd->status.guild_id);
-
- if( g == NULL )
+ if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
fd = sd->fd;
@@ -6451,10 +6439,7 @@ int clif_guild_positioninfolist(struct map_session_data *sd)
struct guild *g;
nullpo_retr(0, sd);
- if( !sd->state.bg_id || (g = bg_guild_get(sd->state.bg_id)) == NULL )
- g = guild_search(sd->status.guild_id);
-
- if( g == NULL )
+ if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
fd = sd->fd;
@@ -6545,8 +6530,8 @@ void clif_guild_emblem_area(struct block_list* bl)
// (emblem in the flag npcs and emblem over the head in agit maps) [FlavioJS]
WBUFW(buf,0) = 0x1B4;
WBUFL(buf,2) = bl->id;
- WBUFL(buf,6) = clif_visual_guild_id(bl);
- WBUFW(buf,10) = clif_visual_emblem_id(bl);
+ WBUFL(buf,6) = status_get_guild_id(bl);
+ WBUFW(buf,10) = status_get_emblem_id(bl);
clif_send(buf, 12, bl, AREA_WOS);
}
@@ -6560,10 +6545,7 @@ int clif_guild_skillinfo(struct map_session_data* sd)
int i,c;
nullpo_retr(0, sd);
- if( !sd->state.bg_id || (g = bg_guild_get(sd->state.bg_id)) == NULL )
- g = guild_search(sd->status.guild_id);
-
- if( g == NULL )
+ if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
fd = sd->fd;
@@ -6697,10 +6679,7 @@ int clif_guild_expulsionlist(struct map_session_data *sd)
struct guild *g;
nullpo_retr(0, sd);
- if( !sd->state.bg_id || (g = bg_guild_get(sd->state.bg_id)) == NULL )
- g = guild_search(sd->status.guild_id);
-
- if( g == NULL )
+ if( (g = guild_search(sd->status.guild_id)) == NULL )
return 0;
fd = sd->fd;
@@ -7271,12 +7250,7 @@ int clif_charnameack (int fd, struct block_list *bl)
if (ssd->status.party_id > 0)
p = party_search(ssd->status.party_id);
- if (ssd->state.bg_id > 0)
- {
- g = bg_guild_get(ssd->state.bg_id);
- ps = 0;
- }
- else if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL )
+ if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL )
{
ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id);
if( i < g->max_member ) ps = g->member[i].position;
@@ -7317,8 +7291,6 @@ int clif_charnameack (int fd, struct block_list *bl)
case BL_MOB:
{
struct mob_data *md = (struct mob_data *)bl;
- struct guild *g;
- struct battleground_data *bg;
nullpo_retr(0, md);
memcpy(WBUFP(buf,6), md->name, NAME_LENGTH);
@@ -7329,13 +7301,6 @@ int clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,54), md->guardian_data->guild_name, NAME_LENGTH);
memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH);
}
- else if( md->state.bg_id && (bg = bg_team_search(md->state.bg_id)) != NULL && (g = bg->g) != NULL )
- {
- WBUFW(buf, 0) = cmd = 0x195;
- WBUFB(buf,30) = 0;
- memcpy(WBUFP(buf,54), g->name, NAME_LENGTH);
- memcpy(WBUFP(buf,78), g->position[0].name, NAME_LENGTH);
- }
else if( battle_config.show_mob_info )
{
char mobhp[50], *str_p = mobhp;
@@ -7401,12 +7366,7 @@ int clif_charnameupdate (struct map_session_data *ssd)
if( ssd->status.party_id > 0 )
p = party_search(ssd->status.party_id);
- if( ssd->state.bg_id > 0 )
- {
- g = bg_guild_get(ssd->state.bg_id);
- ps = 0;
- }
- else if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL )
+ if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL )
{
ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id);
if( i < g->max_member ) ps = g->member[i].position;
@@ -8024,10 +7984,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
}
if( sd->state.bg_id ) clif_bg_hp(sd); // BattleGround System
- if( sd->state.changemap && map[sd->bl.m].flag.battleground == 2 )
+ if( sd->state.changemap && map[sd->bl.m].flag.battleground )
{
clif_set01D6(sd,19); // Battleground Mode
- clif_bg_updatescore_single(sd);
+ if( map[sd->bl.m].flag.battleground == 2 )
+ clif_bg_updatescore_single(sd);
}
if(map[sd->bl.m].flag.pvp) {
@@ -8057,7 +8018,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
}
}
- if( map_flag_gvg(sd->bl.m) || map[sd->bl.m].flag.battleground )
+ if( map_flag_gvg(sd->bl.m) )
{
clif_set0199(sd,3);
if( battle_config.gvg_flee_penalty != 100 || battle_config.bg_flee_penalty != 100 )
@@ -10418,10 +10379,6 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd)
if( (g = guild_search(guild_id)) != NULL )
clif_guild_emblem(sd,g);
- else if( guild_id == battle_config.bg_guild_id1 )
- clif_bg_emblem(sd, &bg_guild[0]);
- else if( guild_id == battle_config.bg_guild_id2 )
- clif_bg_emblem(sd, &bg_guild[1]);
}
/*==========================================
@@ -12947,135 +12904,6 @@ int clif_bg_xy_remove(struct map_session_data *sd)
return 0;
}
-int clif_bg_belonginfo(struct map_session_data *sd)
-{
- int fd;
- struct guild *g;
- nullpo_retr(0, sd);
-
- if( !sd->state.bg_id || (g = bg_guild_get(sd->state.bg_id)) == NULL )
- return 0;
-
- fd = sd->fd;
- WFIFOHEAD(fd,packet_len(0x16c));
- memset(WFIFOP(fd,0),0,packet_len(0x16c));
- WFIFOW(fd,0) = 0x16c;
- WFIFOL(fd,2) = g->guild_id;
- WFIFOL(fd,6) = g->emblem_id;
- WFIFOL(fd,10) = 0;
- memcpy(WFIFOP(fd,19), g->name, NAME_LENGTH);
- WFIFOSET(fd,packet_len(0x16c));
- return 1;
-}
-
-int clif_visual_guild_id(struct block_list *bl)
-{
- struct battleground_data *bg;
- int bg_id;
- nullpo_retr(0, bl);
-
- if( (bg_id = bg_team_get_id(bl)) > 0 && (bg = bg_team_search(bg_id)) != NULL && bg->g )
- return bg->g->guild_id;
- else
- return status_get_guild_id(bl);
-}
-
-int clif_visual_emblem_id(struct block_list *bl)
-{
- struct battleground_data *bg;
- int bg_id;
- nullpo_retr(0, bl);
-
- if( (bg_id = bg_team_get_id(bl)) > 0 && (bg = bg_team_search(bg_id)) != NULL && bg->g )
- return bg->g->emblem_id;
- else
- return status_get_emblem_id(bl);
-}
-
-int clif_bg_emblem(struct map_session_data *sd, struct guild *g)
-{
- int fd;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, g);
- fd = sd->fd;
-
- if( g->emblem_len <= 0 )
- return 0;
-
- WFIFOHEAD(fd,g->emblem_len+12);
- WFIFOW(fd,0)=0x152;
- WFIFOW(fd,2)=g->emblem_len+12;
- WFIFOL(fd,4)=g->guild_id;
- WFIFOL(fd,8)=g->emblem_id;
- memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len);
- WFIFOSET(fd,WFIFOW(fd,2));
- return 0;
-}
-
-int clif_bg_memberlist(struct map_session_data *sd)
-{
- int fd, i, c;
- struct battleground_data *bg;
- struct map_session_data *psd;
- nullpo_retr(0, sd);
-
- if( (fd = sd->fd) == 0 )
- return 0;
- if( !sd->state.bg_id || (bg = bg_team_search(sd->state.bg_id)) == NULL )
- return 0;
-
- WFIFOHEAD(fd,bg->count * 104 + 4);
- WFIFOW(fd,0) = 0x154;
- for( i = 0, c = 0; i < bg->count; i++ )
- {
- if( (psd = bg->members[i].sd) == NULL )
- continue;
- WFIFOL(fd,c*104+ 4) = psd->status.account_id;
- WFIFOL(fd,c*104+ 8) = psd->status.char_id;
- WFIFOW(fd,c*104+12) = psd->status.hair;
- WFIFOW(fd,c*104+14) = psd->status.hair_color;
- WFIFOW(fd,c*104+16) = psd->status.sex;
- WFIFOW(fd,c*104+18) = psd->status.class_;
- WFIFOW(fd,c*104+20) = psd->status.base_level;
- WFIFOL(fd,c*104+22) = 0;
- WFIFOL(fd,c*104+26) = 1;
- WFIFOL(fd,c*104+30) = c;
- memset(WFIFOP(fd,c*104+34),0,50);
- memcpy(WFIFOP(fd,c*104+84),psd->status.name,NAME_LENGTH);
- c++;
- }
- WFIFOW(fd, 2)=c*104+4;
- WFIFOSET(fd,WFIFOW(fd,2));
- return 0;
-}
-
-int clif_bg_leave(struct map_session_data *sd, const char *name, const char *mes)
-{
- unsigned char buf[128];
- nullpo_retr(0, sd);
-
- WBUFW(buf,0)=0x15a;
- memcpy(WBUFP(buf, 2),name,NAME_LENGTH);
- memcpy(WBUFP(buf,26),mes,40);
- clif_send(buf,packet_len(0x15a),&sd->bl,BG);
- return 0;
-}
-
-int clif_bg_leave_single(struct map_session_data *sd, const char *name, const char *mes)
-{
- int fd;
- nullpo_retr(0, sd);
-
- fd = sd->fd;
- WFIFOHEAD(fd,66);
- WFIFOW(fd,0) = 0x15a;
- memcpy(WFIFOP(fd,2), name, NAME_LENGTH);
- memcpy(WFIFOP(fd,26), mes, 40);
- WFIFOSET(fd,66);
- return 0;
-}
-
int clif_bg_message(struct battleground_data *bg, const char *name, const char *mes, int len)
{
struct map_session_data *sd;
@@ -13096,21 +12924,6 @@ int clif_bg_message(struct battleground_data *bg, const char *name, const char *
return 0;
}
-int clif_bg_expulsion_single(struct map_session_data *sd, const char *name, const char *mes)
-{
- int fd;
- nullpo_retr(0, sd);
-
- fd = sd->fd;
- WFIFOHEAD(fd, 90);
- WFIFOW(fd,0) = 0x15c;
- safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH);
- safestrncpy((char*)WFIFOP(fd,26), mes, 40);
- safestrncpy((char*)WFIFOP(fd,66), "", NAME_LENGTH);
- WFIFOSET(fd,90);
- return 0;
-}
-
/*==========================================
* Validates and processes battlechat messages [pakpil]
* S 0x2db <packet len>.w <text>.?B (<name> : <message>) 00
@@ -13173,6 +12986,31 @@ int clif_bg_updatescore_single(struct map_session_data *sd)
return 0;
}
+int clif_sendbgemblem_area(struct map_session_data *sd)
+{
+ unsigned char buf[33];
+ nullpo_retr(0,sd);
+
+ WBUFW(buf, 0) = 0x2dd;
+ WBUFL(buf,2) = sd->bl.id;
+ safestrncpy((char*)WBUFP(buf,6), sd->status.name, NAME_LENGTH); // name don't show in screen.
+ WBUFW(buf,30) = sd->state.bg_id;
+ clif_send(buf,packet_len(0x2dd), &sd->bl, AREA);
+ return 0;
+}
+
+int clif_sendbgemblem_single(int fd, struct map_session_data *sd)
+{
+ nullpo_retr(0,sd);
+ WFIFOHEAD(fd,32);
+ WFIFOW(fd,0) = 0x2dd;
+ WFIFOL(fd,2) = sd->bl.id;
+ safestrncpy((char*)WFIFOP(fd,6), sd->status.name, NAME_LENGTH);
+ WFIFOW(fd,30) = sd->state.bg_id;
+ WFIFOSET(fd,packet_len(0x2dd));
+ return 0;
+}
+
/*==========================================
* pPbgfobO
*------------------------------------------*/
@@ -13442,7 +13280,7 @@ static int packetdb_readdb(void)
0, 0, 0, 0, 0, 0, 0, 0, 0,191, 0, 0, 0, 0, 0, 0,
//#0x02C0
0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 6, -1, 10, 10, 0, 0, -1, -1, 6, 0,
+ 0, 0, 0, 0, 0, 0, 6, -1, 10, 10, 0, 0, -1, 32, 6, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
diff --git a/src/map/clif.h b/src/map/clif.h
index ad00176b6..bc0855b7e 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -343,17 +343,11 @@ int clif_guild_xy_remove(struct map_session_data *sd);
int clif_bg_hp(struct map_session_data *sd);
int clif_bg_xy(struct map_session_data *sd);
int clif_bg_xy_remove(struct map_session_data *sd);
-int clif_bg_belonginfo(struct map_session_data *sd);
-int clif_visual_guild_id(struct block_list *bl);
-int clif_visual_emblem_id(struct block_list *bl);
-int clif_bg_emblem(struct map_session_data *sd, struct guild *g);
-int clif_bg_memberlist(struct map_session_data *sd);
-int clif_bg_leave(struct map_session_data *sd, const char *name, const char *mes);
-int clif_bg_leave_single(struct map_session_data *sd, const char *name, const char *mes);
int clif_bg_message(struct battleground_data *bg, const char *name, const char *mes, int len);
-int clif_bg_expulsion_single(struct map_session_data *sd, const char *name, const char *mes);
int clif_bg_updatescore(int m);
int clif_bg_updatescore_single(struct map_session_data *sd);
+int clif_sendbgemblem_area(struct map_session_data *sd);
+int clif_sendbgemblem_single(int fd, struct map_session_data *sd);
// atcommand
int clif_displaymessage(const int fd,const char* mes);
diff --git a/src/map/script.c b/src/map/script.c
index 8e2d54f3b..174bad12b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13372,7 +13372,7 @@ BUILDIN_FUNC(waitingroom2bg)
struct npc_data *nd;
struct chat_data *cd;
const char *map_name, *ev = "", *dev = "";
- int x, y, i, mapindex = 0, guild_index, bg_id, n;
+ int x, y, i, mapindex = 0, bg_id, n;
struct map_session_data *sd;
if( script_hasdata(st,8) )
@@ -13399,12 +13399,10 @@ BUILDIN_FUNC(waitingroom2bg)
x = script_getnum(st,3);
y = script_getnum(st,4);
- guild_index = script_getnum(st,5);
- ev = script_getstr(st,6); // Logout Event
- dev = script_getstr(st,7); // Die Event
+ ev = script_getstr(st,5); // Logout Event
+ dev = script_getstr(st,6); // Die Event
- guild_index = cap_value(guild_index, 0, 1);
- if( (bg_id = bg_create(mapindex, x, y, guild_index, ev, dev)) == 0 )
+ if( (bg_id = bg_create(mapindex, x, y, ev, dev)) == 0 )
{ // Creation failed
script_pushint(st,0);
return 0;