diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-03-29 16:49:52 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-03-29 16:49:52 +0000 |
commit | ff0af0b4437fb987bc0cf2c0091942a266b8731e (patch) | |
tree | d25e7820182d6cdbce85ca23fcf2d85ef33faa77 /src/map/battleground.c | |
parent | fcdf995bd039935c5cdf4842ea9158d44ee6de29 (diff) | |
download | hercules-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
Diffstat (limited to 'src/map/battleground.c')
-rw-r--r-- | src/map/battleground.c | 117 |
1 files changed, 9 insertions, 108 deletions
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) |