summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c12
-rw-r--r--src/map/guild.c44
-rw-r--r--src/map/pc.c12
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/skill.c21
-rw-r--r--src/map/skill.h1
6 files changed, 52 insertions, 40 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index c19c9f7f6..951969a0f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7379,7 +7379,7 @@ void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g)
WFIFOL(fd,2)=g->guild_id;
WFIFOL(fd,6)=g->emblem_id;
WFIFOL(fd,10)=g->position[ps].mode;
- WFIFOB(fd,14)=(bool)(sd->state.gmaster_flag==g);
+ WFIFOB(fd,14)=(bool)(sd->state.gmaster_flag == 1);
WFIFOL(fd,15)=0; // InterSID (unknown purpose)
memcpy(WFIFOP(fd,19),g->name,NAME_LENGTH);
WFIFOSET(fd,packet_len(0x16c));
@@ -9633,10 +9633,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
/* Guild Aura Init */
if( sd->state.gmaster_flag ) {
- guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
- guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS));
- guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->state.gmaster_flag,GD_SOULCOLD));
- guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->state.gmaster_flag,GD_HAWKEYES));
+ guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP));
+ guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS));
+ guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD));
+ guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES));
}
if( sd->state.vending ) { /* show we have a vending */
@@ -11408,7 +11408,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
if( skill_id >= GD_SKILLBASE ) {
if( sd->state.gmaster_flag )
- skill_lv = guild->checkskill(sd->state.gmaster_flag, skill_id);
+ skill_lv = guild->checkskill(sd->guild, skill_id);
else
skill_lv = 0;
} else {
diff --git a/src/map/guild.c b/src/map/guild.c
index 5ff0254dc..e5ea6809d 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -564,7 +564,7 @@ int guild_recv_info(struct guild *sg) {
//Also set the guild master flag.
sd->guild = g;
- sd->state.gmaster_flag = g;
+ sd->state.gmaster_flag = 1;
clif->charnameupdate(sd); // [LuzZza]
clif->guild_masterormember(sd);
}
@@ -754,7 +754,7 @@ void guild_member_joined(struct map_session_data *sd)
return;
}
if (strcmp(sd->status.name,g->master) == 0) { // set the Guild Master flag
- sd->state.gmaster_flag = g;
+ sd->state.gmaster_flag = 1;
// prevent Guild Skills from being used directly after relog
if( battle_config.guild_skill_relog_delay )
guild->block_skill(sd, 300000);
@@ -933,6 +933,10 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
if( g->instances )
instance->check_kick(sd);
clif->charnameupdate(sd); //Update display name [Skotlex]
+ status_change_end(&sd->bl, SC_LEADERSHIP, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_GLORYWOUNDS, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SOULCOLD, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_HAWKEYES, INVALID_TIMER);
//TODO: send emblem update to self and people around
}
return 0;
@@ -1756,8 +1760,13 @@ int guild_broken(int guild_id,int flag)
gstorage->pc_quit(sd,1);
sd->status.guild_id=0;
sd->guild = NULL;
+ sd->state.gmaster_flag = 0;
clif->guild_broken(g->member[i].sd,0);
clif->charnameupdate(sd); // [LuzZza]
+ status_change_end(&sd->bl, SC_LEADERSHIP, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_GLORYWOUNDS, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SOULCOLD, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_HAWKEYES, INVALID_TIMER);
}
}
@@ -1828,7 +1837,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
if (g->member[0].sd && g->member[0].sd->fd) {
clif->message(g->member[0].sd->fd, msg_txt(679)); //"You have become the Guild Master!"
- g->member[0].sd->state.gmaster_flag = g;
+ g->member[0].sd->state.gmaster_flag = 1;
//Block his skills for 5 minutes to prevent abuse.
guild->block_skill(g->member[0].sd, 300000);
}
@@ -1849,9 +1858,9 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
/*====================================================
* Guild disbanded
*---------------------------------------------------*/
-int guild_break(struct map_session_data *sd,char *name)
-{
+int guild_break(struct map_session_data *sd,char *name) {
struct guild *g;
+ struct unit_data *ud;
int i;
nullpo_ret(sd);
@@ -1872,7 +1881,30 @@ int guild_break(struct map_session_data *sd,char *name)
clif->guild_broken(sd,2);
return 0;
}
-
+
+ /* regardless of char server allowing it, we clear the guild master's auras */
+ if( (ud = unit_bl2ud(&sd->bl)) ) {
+ int count = 0;
+ struct skill_unit_group *groups[4];
+ for (i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i];i++) {
+ switch (ud->skillunit[i]->skill_id) {
+ case GD_LEADERSHIP:
+ case GD_GLORYWOUNDS:
+ case GD_SOULCOLD:
+ case GD_HAWKEYES:
+ if( count == 4 )
+ ShowWarning("guild_break:'%s' got more than 4 guild aura instances! (%d)\n",sd->status.name,ud->skillunit[i]->skill_id);
+ else
+ groups[count++] = ud->skillunit[i];
+ break;
+ }
+
+ }
+ for(i = 0; i < count; i++) {
+ skill->del_unitgroup(groups[i],ALC_MARK);
+ }
+ }
+
intif_guild_break(g->guild_id);
return 1;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 84cfe7eb3..5a8b77cd3 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6987,10 +6987,10 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) {
pc->setinvincibletimer(sd, battle_config.pc_invincible_time);
if( sd->state.gmaster_flag ) {
- guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
- guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS));
- guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->state.gmaster_flag,GD_SOULCOLD));
- guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->state.gmaster_flag,GD_HAWKEYES));
+ guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP));
+ guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS));
+ guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD));
+ guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES));
}
}
// script
@@ -8933,12 +8933,12 @@ int pc_checkitem(struct map_session_data *sd)
}
if (sd->state.gmaster_flag) {
- struct guild_storage *guild_storage = gstorage->id2storage2(sd->state.gmaster_flag->guild_id);
+ struct guild_storage *guild_storage = gstorage->id2storage2(sd->guild->guild_id);
if (guild_storage) {
for( i = 0; i < MAX_GUILD_STORAGE; i++ ) {
id = guild_storage->items[i].nameid;
if( id && !itemdb_available(id) ) {
- ShowWarning("Removed invalid/disabled item id %d from guild storage (amount=%d, char_id=%d, guild_id=%d).\n", id, guild_storage->items[i].amount, sd->status.char_id, sd->state.gmaster_flag->guild_id);
+ ShowWarning("Removed invalid/disabled item id %d from guild storage (amount=%d, char_id=%d, guild_id=%d).\n", id, guild_storage->items[i].amount, sd->status.char_id, sd->guild->guild_id);
gstorage->delitem(sd, guild_storage, i, guild_storage->items[i].amount);
gstorage->close(sd); // force closing
}
diff --git a/src/map/pc.h b/src/map/pc.h
index c21258dd7..a69c77efe 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -158,7 +158,7 @@ struct map_session_data {
unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
- struct guild *gmaster_flag;
+ unsigned int gmaster_flag : 1;
unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
unsigned int warping : 1;//states whether you're in the middle of a warp processing
unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc().
diff --git a/src/map/skill.c b/src/map/skill.c
index 0b39ff620..f27a42ac9 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2954,24 +2954,6 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i
type, skill_id);
}
-int skill_guildaura_sub (struct map_session_data* sd, int id, int strvit, int agidex)
-{
- if(id == sd->bl.id && battle_config.guild_aura&16)
- return 0; // Do not affect guild leader
-
- if (sd->sc.data[SC_GUILDAURA]) {
- struct status_change_entry *sce = sd->sc.data[SC_GUILDAURA];
- if( sce->val3 != strvit || sce->val4 != agidex ) {
- sce->val3 = strvit;
- sce->val4 = agidex;
- status_calc_bl(&sd->bl, iStatus->sc2scb_flag(SC_GUILDAURA));
- }
- return 0;
- }
- sc_start4(&sd->bl, SC_GUILDAURA,100, 1, id, strvit, agidex, 1000);
- return 1;
-}
-
/*==========================================
* Checks that you have the requirements for casting a skill for homunculus/mercenary.
* Flag:
@@ -7521,7 +7503,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int j = 0;
struct guild *g;
// i don't know if it actually summons in a circle, but oh well. ;P
- g = sd?sd->state.gmaster_flag:guild->search(iStatus->get_guild_id(src));
+ g = sd ? sd->guild : guild->search(iStatus->get_guild_id(src));
if (!g)
break;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -18209,7 +18191,6 @@ void skill_defaults(void) {
skill->unit_onleft = skill_unit_onleft;
skill->unit_onout = skill_unit_onout;
skill->unit_move_unit_group = skill_unit_move_unit_group;
- skill->guildaura_sub = skill_guildaura_sub;
skill->sit = skill_sit;
skill->brandishspear = skill_brandishspear;
skill->repairweapon = skill_repairweapon;
diff --git a/src/map/skill.h b/src/map/skill.h
index 1ca5f235a..f9dbd0f1a 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1842,7 +1842,6 @@ struct skill_interface {
int (*unit_onleft) (uint16 skill_id, struct block_list *bl,unsigned int tick);
int (*unit_onout) (struct skill_unit *src, struct block_list *bl, unsigned int tick);
int (*unit_move_unit_group) ( struct skill_unit_group *group, int16 m,int16 dx,int16 dy);
- int (*guildaura_sub) (struct map_session_data* sd, int id, int strvit, int agidex);
int (*sit) (struct map_session_data *sd, int type);
void (*brandishspear) (struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag);
void (*repairweapon) (struct map_session_data *sd, int idx);