summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-05-15 21:56:21 -0300
committershennetsind <ind@henn.et>2013-05-15 21:56:21 -0300
commitc7f3f6c2ceae862866a019d0a438d8f965b042c2 (patch)
tree1da2a986123b23a05c8722ccc68a949473d84fb9 /src
parentc811ddb181a15eae8a6d01a6956ae7c654f424b2 (diff)
downloadhercules-c7f3f6c2ceae862866a019d0a438d8f965b042c2.tar.gz
hercules-c7f3f6c2ceae862866a019d0a438d8f965b042c2.tar.bz2
hercules-c7f3f6c2ceae862866a019d0a438d8f965b042c2.tar.xz
hercules-c7f3f6c2ceae862866a019d0a438d8f965b042c2.zip
Hercules Renewal Phase One: guild.c started
http://hercules.ws/board/topic/237-hercules-renewal/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c46
-rw-r--r--src/map/battle.c10
-rw-r--r--src/map/battleground.c7
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c68
-rw-r--r--src/map/guild.c218
-rw-r--r--src/map/guild.h175
-rw-r--r--src/map/intif.c38
-rw-r--r--src/map/map.c5
-rw-r--r--src/map/mob.c28
-rw-r--r--src/map/npc.c4
-rw-r--r--src/map/pc.c27
-rw-r--r--src/map/script.c46
-rw-r--r--src/map/skill.c10
-rw-r--r--src/map/status.c4
-rw-r--r--src/map/storage.c2
-rw-r--r--src/map/unit.c8
17 files changed, 390 insertions, 310 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 931fc280b..8a6399568 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3243,20 +3243,20 @@ ACMD(party)
*------------------------------------------*/
ACMD(guild)
{
- char guild[NAME_LENGTH];
+ char guild_name[NAME_LENGTH];
int prev;
nullpo_retr(-1, sd);
- memset(guild, '\0', sizeof(guild));
+ memset(guild_name, '\0', sizeof(guild_name));
- if (!message || !*message || sscanf(message, "%23[^\n]", guild) < 1) {
+ if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) {
clif->message(fd, msg_txt(1030)); // Please enter a guild name (usage: @guild <guild_name>).
return false;
}
prev = battle_config.guild_emperium_check;
battle_config.guild_emperium_check = 0;
- guild_create(sd, guild);
+ guild->create(sd, guild_name);
battle_config.guild_emperium_check = prev;
return true;
@@ -3272,7 +3272,7 @@ ACMD(breakguild)
if (g) { // Check if guild was found
if (sd->state.gmaster_flag) { // Check if player is guild master
int ret = 0;
- ret = guild_break(sd, g->name); // Break guild
+ ret = guild->dobreak(sd, g->name); // Break guild
if (ret) { // Check if anything went wrong
return true; // Guild was broken
} else {
@@ -3305,7 +3305,7 @@ ACMD(agitstart)
}
agit_flag = 1;
- guild_agit_start();
+ guild->agit_start();
clif->message(fd, msg_txt(72)); // War of Emperium has been initiated.
return true;
@@ -3323,7 +3323,7 @@ ACMD(agitstart2)
}
agit2_flag = 1;
- guild_agit2_start();
+ guild->agit2_start();
clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated."
return true;
@@ -3341,7 +3341,7 @@ ACMD(agitend)
}
agit_flag = 0;
- guild_agit_end();
+ guild->agit_end();
clif->message(fd, msg_txt(74)); // War of Emperium has been ended.
return true;
@@ -3359,7 +3359,7 @@ ACMD(agitend2)
}
agit2_flag = 0;
- guild_agit2_end();
+ guild->agit2_end();
clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended."
return true;
@@ -3484,8 +3484,8 @@ ACMD(guildrecall)
return false;
}
- if ((g = guild_searchname(guild_name)) == NULL && // name first to avoid error when name begin with a number
- (g = guild_search(atoi(message))) == NULL)
+ if ((g = guild->searchname(guild_name)) == NULL && // name first to avoid error when name begin with a number
+ (g = guild->search(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
@@ -4080,8 +4080,8 @@ ACMD(guildspy)
return false;
}
- if ((g = guild_searchname(guild_name)) != NULL || // name first to avoid error when name begin with a number
- (g = guild_search(atoi(message))) != NULL) {
+ if ((g = guild->searchname(guild_name)) != NULL || // name first to avoid error when name begin with a number
+ (g = guild->search(atoi(message))) != NULL) {
if (sd->guildspy == g->guild_id) {
sd->guildspy = 0;
sprintf(atcmd_output, msg_txt(103), g->name); // No longer spying on the %s guild.
@@ -4792,14 +4792,14 @@ ACMD(disguiseall)
ACMD(disguiseguild)
{
int id = 0, i;
- char monster[NAME_LENGTH], guild[NAME_LENGTH];
+ char monster[NAME_LENGTH], guild_name[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
memset(monster, '\0', sizeof(monster));
- memset(guild, '\0', sizeof(guild));
+ memset(guild_name, '\0', sizeof(guild_name));
- if( !message || !*message || sscanf(message, "%23[^,], %23[^\r\n]", monster, guild) < 2 ) {
+ if( !message || !*message || sscanf(message, "%23[^,], %23[^\r\n]", monster, guild_name) < 2 ) {
clif->message(fd, msg_txt(1146)); // Please enter a mob name/ID and guild name/ID (usage: @disguiseguild <mob name/ID>, <guild name/ID>).
return false;
}
@@ -4820,7 +4820,7 @@ ACMD(disguiseguild)
return false;
}
- if( (g = guild_searchname(guild)) == NULL && (g = guild_search(atoi(guild))) == NULL ) {
+ if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(guild_name))) == NULL ) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
@@ -4888,7 +4888,7 @@ ACMD(undisguiseguild)
return false;
}
- if( (g = guild_searchname(guild_name)) == NULL && (g = guild_search(atoi(message))) == NULL ) {
+ if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(message))) == NULL ) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
@@ -5662,7 +5662,7 @@ ACMD(changegm)
return false;
}
- guild_gm_change(sd->status.guild_id, pl_sd);
+ guild->gm_change(sd->status.guild_id, pl_sd);
return true;
}
@@ -7467,19 +7467,19 @@ ACMD(sizeall)
ACMD(sizeguild)
{
int size = 0, i;
- char guild[NAME_LENGTH];
+ char guild_name[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
nullpo_retr(-1, sd);
memset(guild, '\0', sizeof(guild));
- if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild) < 2 ) {
+ if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild_name) < 2 ) {
clif->message(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>).
return false;
}
- if( (g = guild_searchname(guild)) == NULL && (g = guild_search(atoi(guild))) == NULL ) {
+ if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(guild_name))) == NULL ) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
@@ -8813,7 +8813,7 @@ ACMD(join) {
struct guild *g = sd->guild, *sg = NULL;
int i;
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
- if( g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild_search(g->alliance[i].guild_id) ) ) {
+ if( g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id) ) ) {
if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id))) {
clif->chsys_join((struct hChSysCh *)sg->channel,sd);
}
diff --git a/src/map/battle.c b/src/map/battle.c
index e16f2ece2..1cb6bea4f 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1306,12 +1306,12 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
}
}
if(src->type != BL_MOB) {
- struct guild *g = src->type == BL_PC ? ((TBL_PC *)src)->guild : guild_search(status_get_guild_id(src));
+ struct guild *g = src->type == BL_PC ? ((TBL_PC *)src)->guild : guild->search(status_get_guild_id(src));
- if (class_ == MOBID_EMPERIUM && (!g || guild_checkskill(g,GD_APPROVAL) <= 0 ))
+ if (class_ == MOBID_EMPERIUM && (!g || guild->checkskill(g,GD_APPROVAL) <= 0 ))
return 0;
- if (g && battle_config.guild_max_castles && guild_checkcastles(g)>=battle_config.guild_max_castles)
+ if (g && battle_config.guild_max_castles && guild->checkcastles(g)>=battle_config.guild_max_castles)
return 0; // [MouseJstr]
}
}
@@ -5477,7 +5477,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
int s_guild = status_get_guild_id(s_bl);
int t_guild = status_get_guild_id(t_bl);
- if( !(map[m].flag.pvp && map[m].flag.pvp_noguild) && s_guild && t_guild && (s_guild == t_guild || guild_isallied(s_guild, t_guild)) && (!map[m].flag.battleground || sbg_id == tbg_id) )
+ if( !(map[m].flag.pvp && map[m].flag.pvp_noguild) && s_guild && t_guild && (s_guild == t_guild || guild->isallied(s_guild, t_guild)) && (!map[m].flag.battleground || sbg_id == tbg_id) )
state |= BCT_GUILD;
else
state |= BCT_ENEMY;
@@ -5510,7 +5510,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
int s_guild = status_get_guild_id(s_bl);
int t_guild = status_get_guild_id(t_bl);
- if(s_guild && t_guild && (s_guild == t_guild || guild_isallied(s_guild, t_guild)))
+ if(s_guild && t_guild && (s_guild == t_guild || guild->isallied(s_guild, t_guild)))
state |= BCT_GUILD;
}
} //end non pvp/gvg chk rivality
diff --git a/src/map/battleground.c b/src/map/battleground.c
index c6a33024a..fa4db436a 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#include "../common/cbasetypes.h"
#include "../common/timer.h"
@@ -92,7 +93,7 @@ int bg_team_join(int bg_id, struct map_session_data *sd)
bg->members[i].y = sd->bl.y;
bg->count++;
- guild_send_dot_remove(sd);
+ guild->send_dot_remove(sd);
for( i = 0; i < MAX_BG_MEMBERS; i++ )
{
diff --git a/src/map/chrif.c b/src/map/chrif.c
index c5ff16713..05f56029b 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -466,7 +466,7 @@ int chrif_connectack(int fd) {
if( !char_init_done ) {
char_init_done = true;
ShowStatus("Event '"CL_WHITE"OnInterIfInitOnce"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInitOnce"));
- guild_castle_map_init();
+ guild->castle_map_init();
}
socket_datasync(fd, true);
@@ -529,7 +529,7 @@ void chrif_on_ready(void) {
do_reconnect_storage();
//Re-save any guild castles that were modified in the disconnection time.
- guild_castle_reconnect(-1, 0, 0);
+ guild->castle_reconnect(-1, 0, 0);
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 5b32be54a..15d6aeb9d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7317,7 +7317,7 @@ void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g)
nullpo_retv(g);
fd=sd->fd;
- ps=guild_getposition(g,sd);
+ ps=guild->getposition(g,sd);
WFIFOHEAD(fd,packet_len(0x16c));
WFIFOW(fd,0)=0x16c;
WFIFOL(fd,2)=g->guild_id;
@@ -7355,7 +7355,7 @@ void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag)
WBUFW(buf,18) = sd->status.hair_color;
clif->send(buf,packet_len(0x1f2),&sd->bl,GUILD_WOS);
}
- else if( ( sd = guild_getavailablesd(g) ) != NULL )
+ else if( ( sd = guild->getavailablesd(g) ) != NULL )
{
WBUFW(buf,14) = 0;
WBUFW(buf,16) = 0;
@@ -7456,7 +7456,7 @@ void clif_guild_basicinfo(struct map_session_data *sd) {
memcpy(WFIFOP(fd,46),g->name, NAME_LENGTH);
memcpy(WFIFOP(fd,70),g->master, NAME_LENGTH);
- safestrncpy((char*)WFIFOP(fd,94),msg_txt(300+guild_checkcastles(g)),16); // "'N' castles"
+ safestrncpy((char*)WFIFOP(fd,94),msg_txt(300+guild->checkcastles(g)),16); // "'N' castles"
WFIFOL(fd,110) = 0; // zeny
WFIFOSET(fd,packet_len(0x1b6));
@@ -7613,7 +7613,7 @@ void clif_guild_positionchanged(struct guild *g,int idx)
WBUFL(buf,16)=g->position[idx].exp_mode;
memcpy(WBUFP(buf,20),g->position[idx].name,NAME_LENGTH);
// }*
- if( (sd=guild_getavailablesd(g))!=NULL )
+ if( (sd=guild->getavailablesd(g))!=NULL )
clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD);
}
@@ -7637,7 +7637,7 @@ void clif_guild_memberpositionchanged(struct guild *g,int idx)
WBUFL(buf, 8)=g->member[idx].char_id;
WBUFL(buf,12)=g->member[idx].position;
// }*
- if( (sd=guild_getavailablesd(g))!=NULL )
+ if( (sd=guild->getavailablesd(g))!=NULL )
clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD);
}
@@ -7698,10 +7698,8 @@ void clif_guild_skillinfo(struct map_session_data* sd)
WFIFOHEAD(fd, 6 + MAX_GUILDSKILL*37);
WFIFOW(fd,0) = 0x0162;
WFIFOW(fd,4) = g->skill_point;
- for(i = 0, c = 0; i < MAX_GUILDSKILL; i++)
- {
- if(g->skill[i].id > 0 && guild_check_skill_require(g, g->skill[i].id))
- {
+ for(i = 0, c = 0; i < MAX_GUILDSKILL; i++) {
+ if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) {
int id = g->skill[i].id;
int p = 6 + c*37;
WFIFOW(fd,p+0) = id;
@@ -7710,7 +7708,7 @@ void clif_guild_skillinfo(struct map_session_data* sd)
WFIFOW(fd,p+8) = skill->get_sp(id, g->skill[i].lv);
WFIFOW(fd,p+10) = skill->get_range(id, g->skill[i].lv);
safestrncpy((char*)WFIFOP(fd,p+12), skill->get_name(id), NAME_LENGTH);
- WFIFOB(fd,p+36)= (g->skill[i].lv < guild_skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0;
+ WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0;
c++;
}
}
@@ -7886,7 +7884,7 @@ void clif_guild_message(struct guild *g,int account_id,const char *mes,int len)
WBUFW(buf, 2) = len + 5;
safestrncpy((char*)WBUFP(buf,4), mes, len+1);
- if ((sd = guild_getavailablesd(g)) != NULL)
+ if ((sd = guild->getavailablesd(g)) != NULL)
clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG);
}
@@ -8006,7 +8004,7 @@ void clif_guild_allianceadded(struct guild *g,int idx)
WBUFL(buf,2)=g->alliance[idx].opposition;
WBUFL(buf,6)=g->alliance[idx].guild_id;
memcpy(WBUFP(buf,10),g->alliance[idx].name,NAME_LENGTH);
- clif->send(buf,packet_len(0x185),guild_getavailablesd(g),GUILD);
+ clif->send(buf,packet_len(0x185),guild->getavailablesd(g),GUILD);
}
*/
@@ -9362,7 +9360,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// guild
// (needs to go before clif_spawn() to show guild emblems correctly)
if(sd->status.guild_id)
- guild_send_memberinfoshort(sd,1);
+ guild->send_memberinfoshort(sd,1);
if(battle_config.pc_invincible_time > 0) {
pc_setinvincibletimer(sd,battle_config.pc_invincible_time);
@@ -9575,10 +9573,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
/* Guild Aura Init */
if( sd->state.gmaster_flag ) {
- guild_guildaura_refresh(sd,GD_LEADERSHIP,guild_checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
- guild_guildaura_refresh(sd,GD_GLORYWOUNDS,guild_checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS));
- guild_guildaura_refresh(sd,GD_SOULCOLD,guild_checkskill(sd->state.gmaster_flag,GD_SOULCOLD));
- guild_guildaura_refresh(sd,GD_HAWKEYES,guild_checkskill(sd->state.gmaster_flag,GD_HAWKEYES));
+ 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));
}
if( sd->state.vending ) { /* show we have a vending */
@@ -10402,7 +10400,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
struct guild *g = sd->guild, *sg = NULL;
int k;
for (k = 0; k < MAX_GUILDALLIANCE; k++) {
- if( g->alliance[k].opposition == 0 && g->alliance[k].guild_id && (sg = guild_search(g->alliance[k].guild_id) ) ) {
+ if( g->alliance[k].opposition == 0 && g->alliance[k].guild_id && (sg = guild->search(g->alliance[k].guild_id) ) ) {
if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id)))
clif->chsys_join((struct hChSysCh *)sg->channel,sd);
}
@@ -11324,7 +11322,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->state.gmaster_flag, skill_id);
else
skill_lv = 0;
} else {
@@ -12384,7 +12382,7 @@ void clif_parse_CreateGuild(int fd,struct map_session_data *sd)
return;
}
- guild_create(sd, name);
+ guild->create(sd, name);
}
@@ -12447,7 +12445,7 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd)
return;
for(i = 4; i < RFIFOW(fd,2); i += 40 ){
- guild_change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), (char*)RFIFOP(fd,i+16));
+ guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), (char*)RFIFOP(fd,i+16));
}
}
@@ -12462,7 +12460,7 @@ void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd)
return;
for(i=4;i<RFIFOW(fd,2);i+=12){
- guild_change_memberposition(sd->status.guild_id,
+ guild->change_memberposition(sd->status.guild_id,
RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8));
}
}
@@ -12475,7 +12473,7 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd)
struct guild* g;
int guild_id = RFIFOL(fd,2);
- if( (g = guild_search(guild_id)) != NULL )
+ if( (g = guild->search(guild_id)) != NULL )
clif->guild_emblem(sd,g);
}
@@ -12511,7 +12509,7 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd)
return;
}
- guild_change_emblem(sd, emblem_len, (const char*)emblem);
+ guild->change_emblem(sd, emblem_len, (const char*)emblem);
}
@@ -12531,7 +12529,7 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd)
if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; // skip duplicate marker
if (msg2[0] == '|') msg2[strnlen(msg2, MAX_GUILDMES2)-1] = '\0'; // delete extra space at the end of string
- guild_change_notice(sd, guild_id, msg1, msg2);
+ guild->change_notice(sd, guild_id, msg1, msg2);
}
// Helper function for guild invite functions
@@ -12551,7 +12549,7 @@ clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_da
return 1;
}
- guild_invite(sd,t_sd);
+ guild->invite(sd,t_sd);
return 0;
}
@@ -12582,7 +12580,7 @@ void clif_parse_GuildInvite2(int fd, struct map_session_data *sd)
/// 1 = accept
void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd)
{
- guild_reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
+ guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
@@ -12599,7 +12597,7 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd)
return;
}
- guild_leave(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
+ guild->leave(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
}
@@ -12611,7 +12609,7 @@ void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd)
clif->message(fd, msg_txt(228));
return;
}
- guild_expulsion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
+ guild->expulsion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
}
@@ -12645,7 +12643,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
if( sd->bg_id )
bg_send_message(sd, text, textlen);
else
- guild_send_message(sd, text, textlen);
+ guild->send_message(sd, text, textlen);
}
@@ -12671,7 +12669,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd)
return;
}
- guild_reqalliance(sd,t_sd);
+ guild->reqalliance(sd,t_sd);
}
@@ -12682,7 +12680,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd)
/// 1 = accept
void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd)
{
- guild_reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
+ guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
@@ -12700,7 +12698,7 @@ void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(228));
return;
}
- guild_delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
+ guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
@@ -12726,7 +12724,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd)
return;
}
- guild_opposition(sd,t_sd);
+ guild->opposition(sd,t_sd);
}
@@ -12741,7 +12739,7 @@ void clif_parse_GuildBreak(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(228));
return;
}
- guild_break(sd,(char*)RFIFOP(fd,2));
+ guild->dobreak(sd,(char*)RFIFOP(fd,2));
}
diff --git a/src/map/guild.c b/src/map/guild.c
index a028cb201..9e7dc9b0f 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -90,8 +90,7 @@ static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id)
}
// Modified [Komurka]
-int guild_skill_get_max (int id)
-{
+int guild_skill_get_max (int id) {
if (id < GD_SKILLBASE || id >= GD_SKILLBASE+MAX_GUILDSKILL)
return 0;
return guild_skill_tree[id-GD_SKILLBASE].max;
@@ -156,7 +155,7 @@ int guild_check_skill_require(struct guild *g,int id)
for(i=0;i<MAX_GUILD_SKILL_REQUIRE;i++)
{
if(guild_skill_tree[idx].need[i].id == 0) break;
- if(guild_skill_tree[idx].need[i].lv > guild_checkskill(g,guild_skill_tree[idx].need[i].id))
+ if(guild_skill_tree[idx].need[i].lv > guild->checkskill(g,guild_skill_tree[idx].need[i].id))
return 0;
}
return 1;
@@ -230,7 +229,7 @@ struct guild_castle* guild_mapindex2gc(short mapindex)
/// lookup: map name -> castle*
struct guild_castle* guild_mapname2gc(const char* mapname)
{
- return guild_mapindex2gc(mapindex_name2id(mapname));
+ return guild->mapindex2gc(mapindex_name2id(mapname));
}
struct map_session_data* guild_getavailablesd(struct guild* g)
@@ -300,8 +299,8 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
c = db_data2ptr(data);
if (
- (g = guild_search(c->guild_id)) == NULL ||
- (i = guild_getindex(g, c->account_id, c->char_id)) < 0
+ (g = guild->search(c->guild_id)) == NULL ||
+ (i = guild->getindex(g, c->account_id, c->char_id)) < 0
) {
ers_free(expcache_ers, c);
return 0;
@@ -399,8 +398,7 @@ int guild_create(struct map_session_data *sd, const char *name)
}
//Whether or not to create guild
-int guild_created(int account_id,int guild_id)
-{
+int guild_created(int account_id,int guild_id) {
struct map_session_data *sd=map_id2sd(account_id);
if(sd==NULL)
@@ -426,7 +424,7 @@ int guild_request_info(int guild_id)
//Information request with event
int guild_npc_request_info(int guild_id,const char *event)
{
- if( guild_search(guild_id) )
+ if( guild->search(guild_id) )
{
if( event && *event )
npc_event_do(event);
@@ -445,7 +443,7 @@ int guild_npc_request_info(int guild_id,const char *event)
ev->next = db_data2ptr(&prev);
}
- return guild_request_info(guild_id);
+ return guild->request_info(guild_id);
}
//Confirmation of the character belongs to guild
@@ -463,7 +461,7 @@ int guild_check_member(struct guild *g)
if( sd->status.guild_id != g->guild_id )
continue;
- i = guild_getindex(g,sd->status.account_id,sd->status.char_id);
+ i = guild->getindex(g,sd->status.account_id,sd->status.char_id);
if (i < 0) {
sd->status.guild_id=0;
sd->guild_emblem_id=0;
@@ -521,7 +519,7 @@ int guild_recv_info(struct guild *sg) {
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
tg[i] = NULL;
if( sg->alliance[i].opposition == 0 && sg->alliance[i].guild_id )
- tg[i] = guild_search(sg->alliance[i].guild_id);
+ tg[i] = guild->search(sg->alliance[i].guild_id);
}
for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) {
@@ -558,7 +556,7 @@ int guild_recv_info(struct guild *sg) {
//If the guild master is online the first time the guild_info is received,
//that means he was the first to join, so apply guild skill blocking here.
if( battle_config.guild_skill_relog_delay )
- guild_block_skill(sd, 300000);
+ guild->block_skill(sd, 300000);
//Also set the guild master flag.
sd->guild = g;
@@ -644,7 +642,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
if(tsd==NULL || g==NULL)
return 0;
- if( (i=guild_getposition(g,sd))<0 || !(g->position[i].mode&0x0001) )
+ if( (i=guild->getposition(g,sd))<0 || !(g->position[i].mode&0x0001) )
return 0; //Invite permission.
if(!battle_config.invite_request_check) {
@@ -714,7 +712,7 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
struct guild* g;
int i;
- if( (g=guild_search(guild_id)) == NULL )
+ if( (g=guild->search(guild_id)) == NULL )
{
sd->guild_invite = 0;
sd->guild_invite_account = 0;
@@ -746,18 +744,18 @@ void guild_member_joined(struct map_session_data *sd)
{
struct guild* g;
int i;
- g=guild_search(sd->status.guild_id);
+ g=guild->search(sd->status.guild_id);
if (!g) {
- guild_request_info(sd->status.guild_id);
+ guild->request_info(sd->status.guild_id);
return;
}
if (strcmp(sd->status.name,g->master) == 0) { // set the Guild Master flag
sd->state.gmaster_flag = g;
// prevent Guild Skills from being used directly after relog
if( battle_config.guild_skill_relog_delay )
- guild_block_skill(sd, 300000);
+ guild->block_skill(sd, 300000);
}
- i = guild_getindex(g, sd->status.account_id, sd->status.char_id);
+ i = guild->getindex(g, sd->status.account_id, sd->status.char_id);
if (i == -1)
sd->status.guild_id = 0;
else {
@@ -772,7 +770,7 @@ void guild_member_joined(struct map_session_data *sd)
if( !(channel->banned && idb_exists(channel->banned, sd->status.account_id) ) )
clif->chsys_join(channel,sd);
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
- if( g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild_search(g->alliance[i].guild_id) ) ) {
+ if( g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id) ) ) {
if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id)))
clif->chsys_join((struct hChSysCh*)sg->channel,sd);
}
@@ -790,7 +788,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag)
struct map_session_data *sd= map_id2sd(account_id),*sd2;
struct guild *g;
- if( (g=guild_search(guild_id))==NULL )
+ if( (g=guild->search(guild_id))==NULL )
return 0;
if(sd==NULL || sd->guild_invite==0){
@@ -872,7 +870,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
if(sd->status.guild_id!=guild_id)
return 0;
- if( (ps=guild_getposition(g,sd))<0 || !(g->position[ps].mode&0x0010) )
+ if( (ps=guild->getposition(g,sd))<0 || !(g->position[ps].mode&0x0010) )
return 0; //Expulsion permission
//Can't leave inside guild castles.
@@ -882,7 +880,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
return 0;
// find the member and perform expulsion
- i = guild_getindex(g, account_id, char_id);
+ i = guild->getindex(g, account_id, char_id);
if( i != -1 && strcmp(g->member[i].name,g->master) != 0 ) //Can't expel the GL!
intif_guild_leave(g->guild_id,account_id,char_id,1,mes);
@@ -892,18 +890,18 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char* name, const char* mes)
{
int i;
- struct guild* g = guild_search(guild_id);
+ struct guild* g = guild->search(guild_id);
struct map_session_data* sd = map_charid2sd(char_id);
struct map_session_data* online_member_sd;
if(g == NULL)
return 0; // no such guild (error!)
- i = guild_getindex(g, account_id, char_id);
+ i = guild->getindex(g, account_id, char_id);
if( i == -1 )
return 0; // not a member (inconsistency!)
- online_member_sd = guild_getavailablesd(g);
+ online_member_sd = guild->getavailablesd(g);
if(online_member_sd == NULL)
return 0; // noone online to inform
@@ -921,7 +919,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
// do stuff that needs the guild_id first, BEFORE we wipe it
if (sd->state.storage_flag == 2) //Close the guild storage.
storage_guild_storageclose(sd);
- guild_send_dot_remove(sd);
+ guild->send_dot_remove(sd);
if( hChSys.ally ) {
clif->chsys_quitg(sd);
}
@@ -951,7 +949,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_);
if(!online){
- int i=guild_getindex(g,sd->status.account_id,sd->status.char_id);
+ int i=guild->getindex(g,sd->status.account_id,sd->status.char_id);
if(i>=0)
g->member[i].sd=NULL;
else
@@ -972,7 +970,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
{ // cleaned up [LuzZza]
int i,alv,c,idx=-1,om=0,oldonline=-1;
- struct guild *g = guild_search(guild_id);
+ struct guild *g = guild->search(guild_id);
if(g == NULL)
return 0;
@@ -1041,7 +1039,7 @@ int guild_send_message(struct map_session_data *sd,const char *mes,int len)
if(sd->status.guild_id==0)
return 0;
intif_guild_message(sd->status.guild_id,sd->status.account_id,mes,len);
- guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len);
+ guild->recv_message(sd->status.guild_id,sd->status.account_id,mes,len);
// Chat logging type 'G' / Guild Chat
logs->chat(LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
@@ -1055,7 +1053,7 @@ int guild_send_message(struct map_session_data *sd,const char *mes,int len)
int guild_recv_message(int guild_id,int account_id,const char *mes,int len)
{
struct guild *g;
- if( (g=guild_search(guild_id))==NULL)
+ if( (g=guild->search(guild_id))==NULL)
return 0;
clif->guild_message(g,account_id,mes,len);
return 0;
@@ -1107,7 +1105,7 @@ int guild_change_position(int guild_id,int idx,
*---------------------------------------------------*/
int guild_position_changed(int guild_id,int idx,struct guild_position *p)
{
- struct guild *g=guild_search(guild_id);
+ struct guild *g=guild->search(guild_id);
int i;
if(g==NULL)
return 0;
@@ -1140,7 +1138,7 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
{
int i;
struct map_session_data *sd;
- struct guild *g=guild_search(guild_id);
+ struct guild *g=guild->search(guild_id);
if(g==NULL)
return 0;
@@ -1163,7 +1161,7 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data)
nullpo_ret(sd);
if (battle_config.require_glory_guild &&
- !((g = sd->guild) && guild_checkskill(g, GD_GLORYGUILD)>0)) {
+ !((g = sd->guild) && guild->checkskill(g, GD_GLORYGUILD)>0)) {
clif->skill_fail(sd,GD_GLORYGUILD,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -1178,7 +1176,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
{
int i;
struct map_session_data *sd;
- struct guild *g=guild_search(guild_id);
+ struct guild *g=guild->search(guild_id);
if(g==NULL)
return 0;
@@ -1251,8 +1249,7 @@ static DBData create_expcache(DBKey key, va_list args)
/*====================================================
* Return taxed experience from player sd to guild
*---------------------------------------------------*/
-unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
-{
+unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) {
struct guild *g;
struct guild_expcache *c;
int per;
@@ -1263,7 +1260,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
if (sd->status.guild_id == 0 ||
(g = sd->guild) == NULL ||
- (per = guild_getposition(g,sd)) < 0 ||
+ (per = guild->getposition(g,sd)) < 0 ||
(per = g->position[per].exp_mode) < 1)
return 0;
@@ -1310,7 +1307,7 @@ int guild_skillup(TBL_PC* sd, uint16 skill_id)
{
struct guild* g;
int idx = skill_id - GD_SKILLBASE;
- int max = guild_skill_get_max(skill_id);
+ int max = guild->skill_get_max(skill_id);
nullpo_ret(sd);
@@ -1333,7 +1330,7 @@ int guild_skillup(TBL_PC* sd, uint16 skill_id)
int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
{
struct map_session_data *sd=map_id2sd(account_id);
- struct guild *g=guild_search(guild_id);
+ struct guild *g=guild->search(guild_id);
int i;
if(g==NULL)
return 0;
@@ -1346,7 +1343,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
case GD_GLORYWOUNDS:
case GD_SOULCOLD:
case GD_HAWKEYES:
- guild_guildaura_refresh(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv);
+ guild->aura_refresh(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv);
break;
}
}
@@ -1419,7 +1416,7 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag)
struct guild *g;
int i;
- g = guild_search(guild_id1);
+ g = guild->search(guild_id1);
if (g == NULL)
return 0;
@@ -1623,8 +1620,8 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
sd[0] = map_id2sd(account_id1);
sd[1] = map_id2sd(account_id2);
- g[0]=guild_search(guild_id1);
- g[1]=guild_search(guild_id2);
+ g[0]=guild->search(guild_id1);
+ g[1]=guild->search(guild_id2);
if(sd[0]!=NULL && (flag&0x0f)==0){
sd[0]->guild_alliance=0;
@@ -1733,7 +1730,7 @@ int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap)
npc_event_do(strcat(name, "::OnGuildBreak"));
//Save the new 'owner', this should invoke guardian clean up and other such things.
- guild_castledatasave(gc->castle_id, 1, 0);
+ guild->castledatasave(gc->castle_id, 1, 0);
}
return 0;
}
@@ -1741,7 +1738,7 @@ int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap)
//Invoked on /breakguild "Guild name"
int guild_broken(int guild_id,int flag)
{
- struct guild *g = guild_search(guild_id);
+ struct guild *g = guild->search(guild_id);
struct map_session_data *sd = NULL;
int i;
@@ -1780,7 +1777,7 @@ int guild_gm_change(int guild_id, struct map_session_data *sd)
if (sd->status.guild_id != guild_id)
return 0;
- g=guild_search(guild_id);
+ g=guild->search(guild_id);
nullpo_ret(g);
@@ -1799,7 +1796,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
struct guild_member gm;
int pos, i;
- g=guild_search(guild_id);
+ g=guild->search(guild_id);
if (!g)
return 0;
@@ -1828,7 +1825,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
clif->message(g->member[0].sd->fd, msg_txt(679)); //"You have become the Guild Master!"
g->member[0].sd->state.gmaster_flag = g;
//Block his skills for 5 minutes to prevent abuse.
- guild_block_skill(g->member[0].sd, 300000);
+ guild->block_skill(g->member[0].sd, 300000);
}
// announce the change to all guild members
@@ -1911,7 +1908,7 @@ void guild_castle_map_init(void)
*/
int guild_castledatasave(int castle_id, int index, int value)
{
- struct guild_castle *gc = guild_castle_search(castle_id);
+ struct guild_castle *gc = guild->castle_search(castle_id);
if (gc == NULL) {
ShowWarning("guild_castledatasave: guild castle '%d' not found\n", castle_id);
@@ -1963,7 +1960,7 @@ int guild_castledatasave(int castle_id, int index, int value)
}
if (!intif_guild_castle_datasave(castle_id, index, value)) {
- guild_castle_reconnect(castle_id, index, value);
+ guild->castle_reconnect(castle_id, index, value);
}
return 0;
}
@@ -2012,26 +2009,24 @@ int guild_castledataloadack(int len, struct guild_castle *gc)
if( ev < 0 ) { //No castles owned, invoke OnAgitInit as it is.
npc_event_doall("OnAgitInit");
npc_event_doall("OnAgitInit2");
- }
- else // load received castles into memory, one by one
- for( i = 0; i < n; i++, gc++ )
- {
- struct guild_castle *c = guild_castle_search(gc->castle_id);
- if (!c) {
- ShowError("guild_castledataloadack: castle id=%d not found.\n", gc->castle_id);
- continue;
- }
+ } else { // load received castles into memory, one by one
+ for( i = 0; i < n; i++, gc++ ) {
+ struct guild_castle *c = guild->castle_search(gc->castle_id);
+ if (!c) {
+ ShowError("guild_castledataloadack: castle id=%d not found.\n", gc->castle_id);
+ continue;
+ }
- // update map-server castle data with new info
- memcpy(&c->guild_id, &gc->guild_id, sizeof(struct guild_castle) - offsetof(struct guild_castle, guild_id));
+ // update map-server castle data with new info
+ memcpy(&c->guild_id, &gc->guild_id, sizeof(struct guild_castle) - offsetof(struct guild_castle, guild_id));
- if( c->guild_id )
- {
- if( i != ev )
- guild_request_info(c->guild_id);
- else { // last owned one
- guild_npc_request_info(c->guild_id, "::OnAgitInit");
- guild_npc_request_info(c->guild_id, "::OnAgitInit2");
+ if( c->guild_id ) {
+ if( i != ev )
+ guild->request_info(c->guild_id);
+ else { // last owned one
+ guild->npc_request_info(c->guild_id, "::OnAgitInit");
+ guild->npc_request_info(c->guild_id, "::OnAgitInit2");
+ }
}
}
}
@@ -2095,7 +2090,7 @@ int guild_checkcastles(struct guild *g)
bool guild_isallied(int guild_id, int guild_id2)
{
int i;
- struct guild* g = guild_search(guild_id);
+ struct guild* g = guild->search(guild_id);
nullpo_ret(g);
ARR_FIND( 0, MAX_GUILDALLIANCE, i, g->alliance[i].guild_id == guild_id2 );
@@ -2228,3 +2223,86 @@ void do_final_guild(void) {
aFree(guild_flags);/* never empty; created on boot */
}
+void guild_defaults(void) {
+ guild = &guild_s;
+
+ guild->init = do_init_guild;
+ guild->final = do_final_guild;
+ /* */
+ guild->skill_get_max = guild_skill_get_max;
+ /* */
+ guild->checkskill = guild_checkskill;
+ guild->check_skill_require = guild_check_skill_require;
+ guild->checkcastles = guild_checkcastles;
+ guild->isallied = guild_isallied;
+ /* */
+ guild->search = guild_search;
+ guild->searchname = guild_searchname;
+ guild->castle_search = guild_castle_search;
+ /* */
+ guild->mapname2gc = guild_mapname2gc;
+ guild->mapindex2gc = guild_mapindex2gc;
+ /* */
+ guild->getavailablesd = guild_getavailablesd;
+ guild->getindex = guild_getindex;
+ guild->getposition = guild_getposition;
+ guild->payexp = guild_payexp;
+ guild->getexp = guild_getexp;
+ /* */
+ guild->create = guild_create;
+ guild->created = guild_created;
+ guild->request_info = guild_request_info;
+ guild->recv_noinfo = guild_recv_noinfo;
+ guild->recv_info = guild_recv_info;
+ guild->npc_request_info = guild_npc_request_info;
+ guild->invite = guild_invite;
+ guild->reply_invite = guild_reply_invite;
+ guild->member_joined = guild_member_joined;
+ guild->member_added = guild_member_added;
+ guild->leave = guild_leave;
+ guild->member_withdraw = guild_member_withdraw;
+ guild->expulsion = guild_expulsion;
+ guild->skillup = guild_skillup;
+ guild->block_skill = guild_block_skill;
+ guild->reqalliance = guild_reqalliance;
+ guild->reply_reqalliance = guild_reply_reqalliance;
+ guild->allianceack = guild_allianceack;
+ guild->delalliance = guild_delalliance;
+ guild->opposition = guild_opposition;
+ guild->check_alliance = guild_check_alliance;
+ /* */
+ guild->send_memberinfoshort = guild_send_memberinfoshort;
+ guild->recv_memberinfoshort = guild_recv_memberinfoshort;
+ guild->change_memberposition = guild_change_memberposition;
+ guild->memberposition_changed = guild_memberposition_changed;
+ guild->change_position = guild_change_position;
+ guild->position_changed = guild_position_changed;
+ guild->change_notice = guild_change_notice;
+ guild->notice_changed = guild_notice_changed;
+ guild->change_emblem = guild_change_emblem;
+ guild->emblem_changed = guild_emblem_changed;
+ guild->send_message = guild_send_message;
+ guild->recv_message = guild_recv_message;
+ guild->send_dot_remove = guild_send_dot_remove;
+ guild->skillupack = guild_skillupack;
+ guild->dobreak = guild_break;
+ guild->broken = guild_broken;
+ guild->gm_change = guild_gm_change;
+ guild->gm_changed = guild_gm_changed;
+ /* */
+ guild->castle_map_init = guild_castle_map_init;
+ guild->castledatasave = guild_castledatasave;
+ guild->castledataloadack = guild_castledataloadack;
+ guild->castle_reconnect = guild_castle_reconnect;
+ /* */
+ guild->agit_start = guild_agit_start;
+ guild->agit_end = guild_agit_end;
+ guild->agit2_start = guild_agit2_start;
+ guild->agit2_end = guild_agit2_end;
+ /* guild flag cachin */
+ guild->flag_add = guild_flag_add;
+ guild->flag_remove = guild_flag_remove;
+ guild->flags_clear = guild_flags_clear;
+ /* guild aura */
+ guild->aura_refresh = guild_guildaura_refresh;
+}
diff --git a/src/map/guild.h b/src/map/guild.h
index 0df93d138..9841f5451 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _GUILD_H_
#define _GUILD_H_
@@ -23,90 +24,90 @@ struct guardian_data {
struct guild_castle* castle;
};
-int guild_skill_get_max(int id);
-
-int guild_checkskill(struct guild *g,int id);
-int guild_check_skill_require(struct guild *g,int id); // [Komurka]
-int guild_checkcastles(struct guild *g); // [MouseJstr]
-bool guild_isallied(int guild_id, int guild_id2); //Checks alliance based on guild Ids. [Skotlex]
-
-void do_init_guild(void);
-struct guild *guild_search(int guild_id);
-struct guild *guild_searchname(char *str);
-struct guild_castle *guild_castle_search(int gcid);
-
-struct guild_castle* guild_mapname2gc(const char* mapname);
-struct guild_castle* guild_mapindex2gc(short mapindex);
-
-struct map_session_data *guild_getavailablesd(struct guild *g);
-int guild_getindex(struct guild *g,int account_id,int char_id);
-int guild_getposition(struct guild *g, struct map_session_data *sd);
-unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp);
-int guild_getexp(struct map_session_data *sd,int exp); // [Celest]
-
-int guild_create(struct map_session_data *sd, const char *name);
-int guild_created(int account_id,int guild_id);
-int guild_request_info(int guild_id);
-int guild_recv_noinfo(int guild_id);
-int guild_recv_info(struct guild *sg);
-int guild_npc_request_info(int guild_id,const char *ev);
-int guild_invite(struct map_session_data *sd,struct map_session_data *tsd);
-int guild_reply_invite(struct map_session_data *sd,int guild_id,int flag);
-void guild_member_joined(struct map_session_data *sd);
-int guild_member_added(int guild_id,int account_id,int char_id,int flag);
-int guild_leave(struct map_session_data *sd,int guild_id,
- int account_id,int char_id,const char *mes);
-int guild_member_withdraw(int guild_id,int account_id,int char_id,int flag,
- const char *name,const char *mes);
-int guild_expulsion(struct map_session_data *sd,int guild_id,
- int account_id,int char_id,const char *mes);
-int guild_skillup(struct map_session_data* sd, uint16 skill_id);
-void guild_block_skill(struct map_session_data *sd, int time);
-int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd);
-int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag);
-int guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2);
-int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,
- int flag,const char *name1,const char *name2);
-int guild_delalliance(struct map_session_data *sd,int guild_id,int flag);
-int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd);
-int guild_check_alliance(int guild_id1, int guild_id2, int flag);
-
-int guild_send_memberinfoshort(struct map_session_data *sd,int online);
-int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_);
-int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx);
-int guild_memberposition_changed(struct guild *g,int idx,int pos);
-int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char *name);
-int guild_position_changed(int guild_id,int idx,struct guild_position *p);
-int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2);
-int guild_notice_changed(int guild_id,const char *mes1,const char *mes2);
-int guild_change_emblem(struct map_session_data *sd,int len,const char *data);
-int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data);
-int guild_send_message(struct map_session_data *sd,const char *mes,int len);
-int guild_recv_message(int guild_id,int account_id,const char *mes,int len);
-int guild_send_dot_remove(struct map_session_data *sd);
-int guild_skillupack(int guild_id,uint16 skill_id,int account_id);
-int guild_break(struct map_session_data *sd,char *name);
-int guild_broken(int guild_id,int flag);
-int guild_gm_change(int guild_id, struct map_session_data *sd);
-int guild_gm_changed(int guild_id, int account_id, int char_id);
-
-void guild_castle_map_init(void);
-int guild_castledatasave(int castle_id,int index,int value);
-int guild_castledataloadack(int len, struct guild_castle *gc);
-void guild_castle_reconnect(int castle_id, int index, int value);
-
-void guild_agit_start(void);
-void guild_agit_end(void);
-
-void guild_agit2_start(void);
-void guild_agit2_end(void);
-/* guild flag cachin */
-void guild_flag_add(struct npc_data *nd);
-void guild_flag_remove(struct npc_data *nd);
-void guild_flags_clear(void);
-
-void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
-
-void do_final_guild(void);
+struct guild_interface {
+ void (*init) (void);
+ void (*final) (void);
+ /* */
+ int (*skill_get_max) (int id);
+ /* */
+ int (*checkskill) (struct guild *g,int id);
+ int (*check_skill_require) (struct guild *g,int id); // [Komurka]
+ int (*checkcastles) (struct guild *g); // [MouseJstr]
+ bool (*isallied) (int guild_id, int guild_id2); //Checks alliance based on guild Ids. [Skotlex]
+ /* */
+ struct guild *(*search) (int guild_id);
+ struct guild *(*searchname) (char *str);
+ struct guild_castle *(*castle_search) (int gcid);
+ /* */
+ struct guild_castle *(*mapname2gc) (const char* mapname);
+ struct guild_castle *(*mapindex2gc) (short mapindex);
+ /* */
+ struct map_session_data *(*getavailablesd) (struct guild *g);
+ int (*getindex) (struct guild *g,int account_id,int char_id);
+ int (*getposition) (struct guild *g, struct map_session_data *sd);
+ unsigned int (*payexp) (struct map_session_data *sd,unsigned int exp);
+ int (*getexp) (struct map_session_data *sd,int exp); // [Celest]
+ /* */
+ int (*create) (struct map_session_data *sd, const char *name);
+ int (*created) (int account_id,int guild_id);
+ int (*request_info) (int guild_id);
+ int (*recv_noinfo) (int guild_id);
+ int (*recv_info) (struct guild *sg);
+ int (*npc_request_info) (int guild_id,const char *ev);
+ int (*invite) (struct map_session_data *sd,struct map_session_data *tsd);
+ int (*reply_invite) (struct map_session_data *sd,int guild_id,int flag);
+ void (*member_joined) (struct map_session_data *sd);
+ int (*member_added) (int guild_id,int account_id,int char_id,int flag);
+ int (*leave) (struct map_session_data *sd,int guild_id,int account_id,int char_id,const char *mes);
+ int (*member_withdraw) (int guild_id,int account_id,int char_id,int flag,const char *name,const char *mes);
+ int (*expulsion) (struct map_session_data *sd,int guild_id,int account_id,int char_id,const char *mes);
+ int (*skillup) (struct map_session_data* sd, uint16 skill_id);
+ void (*block_skill) (struct map_session_data *sd, int time);
+ int (*reqalliance) (struct map_session_data *sd,struct map_session_data *tsd);
+ int (*reply_reqalliance) (struct map_session_data *sd,int account_id,int flag);
+ int (*allianceack) (int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2);
+ int (*delalliance) (struct map_session_data *sd,int guild_id,int flag);
+ int (*opposition) (struct map_session_data *sd,struct map_session_data *tsd);
+ int (*check_alliance) (int guild_id1, int guild_id2, int flag);
+ /* */
+ int (*send_memberinfoshort) (struct map_session_data *sd,int online);
+ int (*recv_memberinfoshort) (int guild_id,int account_id,int char_id,int online,int lv,int class_);
+ int (*change_memberposition) (int guild_id,int account_id,int char_id,short idx);
+ int (*memberposition_changed) (struct guild *g,int idx,int pos);
+ int (*change_position) (int guild_id,int idx,int mode,int exp_mode,const char *name);
+ int (*position_changed) (int guild_id,int idx,struct guild_position *p);
+ int (*change_notice) (struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2);
+ int (*notice_changed) (int guild_id,const char *mes1,const char *mes2);
+ int (*change_emblem) (struct map_session_data *sd,int len,const char *data);
+ int (*emblem_changed) (int len,int guild_id,int emblem_id,const char *data);
+ int (*send_message) (struct map_session_data *sd,const char *mes,int len);
+ int (*recv_message) (int guild_id,int account_id,const char *mes,int len);
+ int (*send_dot_remove) (struct map_session_data *sd);
+ int (*skillupack) (int guild_id,uint16 skill_id,int account_id);
+ int (*dobreak) (struct map_session_data *sd,char *name);
+ int (*broken) (int guild_id,int flag);
+ int (*gm_change) (int guild_id, struct map_session_data *sd);
+ int (*gm_changed) (int guild_id, int account_id, int char_id);
+ /* */
+ void (*castle_map_init) (void);
+ int (*castledatasave) (int castle_id,int index,int value);
+ int (*castledataloadack) (int len, struct guild_castle *gc);
+ void (*castle_reconnect) (int castle_id, int index, int value);
+ /* */
+ void (*agit_start) (void);
+ void (*agit_end) (void);
+ void (*agit2_start) (void);
+ void (*agit2_end) (void);
+ /* guild flag cachin */
+ void (*flag_add) (struct npc_data *nd);
+ void (*flag_remove) (struct npc_data *nd);
+ void (*flags_clear) (void);
+ /* guild aura */
+ void (*aura_refresh) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
+} guild_s;
+
+struct guild_interface *guild;
+
+void guild_defaults(void);
#endif /* _GUILD_H_ */
diff --git a/src/map/intif.c b/src/map/intif.c
index bab8470a4..93bb8add7 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1115,7 +1115,7 @@ int intif_parse_PartyMessage(int fd)
// ACK guild creation
int intif_parse_GuildCreated(int fd)
{
- guild_created(RFIFOL(fd,2),RFIFOL(fd,6));
+ guild->created(RFIFOL(fd,2),RFIFOL(fd,6));
return 0;
}
@@ -1124,12 +1124,12 @@ int intif_parse_GuildInfo(int fd)
{
if(RFIFOW(fd,2) == 8) {
ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4));
- guild_recv_noinfo(RFIFOL(fd,4));
+ guild->recv_noinfo(RFIFOL(fd,4));
return 0;
}
if( RFIFOW(fd,2)!=sizeof(struct guild)+4 )
ShowError("intif: guild info : data size error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4);
- guild_recv_info((struct guild *)RFIFOP(fd,4));
+ guild->recv_info((struct guild *)RFIFOP(fd,4));
return 0;
}
@@ -1138,28 +1138,28 @@ int intif_parse_GuildMemberAdded(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: guild member added %d %d %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
- guild_member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
+ guild->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
return 0;
}
// ACK member leaving guild
int intif_parse_GuildMemberWithdraw(int fd)
{
- guild_member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(char *)RFIFOP(fd,55),(char *)RFIFOP(fd,15));
+ guild->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(char *)RFIFOP(fd,55),(char *)RFIFOP(fd,15));
return 0;
}
// ACK guild member basic info
int intif_parse_GuildMemberInfoShort(int fd)
{
- guild_recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17));
+ guild->recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17));
return 0;
}
// ACK guild break
int intif_parse_GuildBroken(int fd)
{
- guild_broken(RFIFOL(fd,2),RFIFOB(fd,6));
+ guild->broken(RFIFOL(fd,2),RFIFOB(fd,6));
return 0;
}
@@ -1172,7 +1172,7 @@ int intif_parse_GuildBasicInfoChanged(int fd)
int type = RFIFOW(fd,8);
//void* data = RFIFOP(fd,10);
- struct guild* g = guild_search(guild_id);
+ struct guild* g = guild->search(guild_id);
if( g == NULL )
return 0;
@@ -1199,16 +1199,16 @@ int intif_parse_GuildMemberInfoChanged(int fd)
struct guild* g;
int idx;
- g = guild_search(guild_id);
+ g = guild->search(guild_id);
if( g == NULL )
return 0;
- idx = guild_getindex(g,account_id,char_id);
+ idx = guild->getindex(g,account_id,char_id);
if( idx == -1 )
return 0;
switch( type ) {
- case GMI_POSITION: g->member[idx].position = RFIFOW(fd,18); guild_memberposition_changed(g,idx,RFIFOW(fd,18)); break;
+ case GMI_POSITION: g->member[idx].position = RFIFOW(fd,18); guild->memberposition_changed(g,idx,RFIFOW(fd,18)); break;
case GMI_EXP: g->member[idx].exp = RFIFOQ(fd,18); break;
case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break;
case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break;
@@ -1224,55 +1224,55 @@ int intif_parse_GuildPosition(int fd)
{
if( RFIFOW(fd,2)!=sizeof(struct guild_position)+12 )
ShowError("intif: guild info : data size error\n %d %d %d",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12);
- guild_position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12));
+ guild->position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12));
return 0;
}
// ACK change of guild skill update
int intif_parse_GuildSkillUp(int fd)
{
- guild_skillupack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
+ guild->skillupack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
return 0;
}
// ACK change of guild relationship
int intif_parse_GuildAlliance(int fd)
{
- guild_allianceack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18),(char *) RFIFOP(fd,19),(char *) RFIFOP(fd,43));
+ guild->allianceack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18),(char *) RFIFOP(fd,19),(char *) RFIFOP(fd,43));
return 0;
}
// ACK change of guild notice
int intif_parse_GuildNotice(int fd)
{
- guild_notice_changed(RFIFOL(fd,2),(char *) RFIFOP(fd,6),(char *) RFIFOP(fd,66));
+ guild->notice_changed(RFIFOL(fd,2),(char *) RFIFOP(fd,6),(char *) RFIFOP(fd,66));
return 0;
}
// ACK change of guild emblem
int intif_parse_GuildEmblem(int fd)
{
- guild_emblem_changed(RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8), (char *)RFIFOP(fd,12));
+ guild->emblem_changed(RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8), (char *)RFIFOP(fd,12));
return 0;
}
// ACK guild message
int intif_parse_GuildMessage(int fd)
{
- guild_recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
+ guild->recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
return 0;
}
// Reply guild castle data request
int intif_parse_GuildCastleDataLoad(int fd)
{
- return guild_castledataloadack(RFIFOW(fd,2), (struct guild_castle *)RFIFOP(fd,4));
+ return guild->castledataloadack(RFIFOW(fd,2), (struct guild_castle *)RFIFOP(fd,4));
}
// ACK change of guildmaster
int intif_parse_GuildMasterChanged(int fd)
{
- return guild_gm_changed(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
+ return guild->gm_changed(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
}
// Request pet creation
diff --git a/src/map/map.c b/src/map/map.c
index 5b0a4ed27..49aef6c4c 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -4960,7 +4960,7 @@ void do_final(void)
do_final_instance();
do_final_itemdb();
do_final_storage();
- do_final_guild();
+ guild->final();
do_final_party();
do_final_pc();
do_final_pet();
@@ -5201,6 +5201,7 @@ void load_defaults(void) {
battle_defaults();
buyingstore_defaults();
clif_defaults();
+ guild_defaults();
homunculus_defaults();
ircbot_defaults();
log_defaults();
@@ -5397,7 +5398,7 @@ int do_init(int argc, char *argv[])
do_init_pc();
do_init_status();
do_init_party();
- do_init_guild();
+ guild->init();
do_init_storage();
do_init_pet();
homun->init();
diff --git a/src/map/mob.c b/src/map/mob.c
index 0f1ad0452..57325ba1c 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -483,8 +483,8 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
if (class_ == MOBID_EMPERIUM)
{
- struct guild_castle* gc = guild_mapindex2gc(map[m].index);
- struct guild* g = (gc) ? guild_search(gc->guild_id) : NULL;
+ struct guild_castle* gc = guild->mapindex2gc(map[m].index);
+ struct guild* g = (gc) ? guild->search(gc->guild_id) : NULL;
if (gc)
{
md->guardian_data = (struct guardian_data*)aCalloc(1, sizeof(struct guardian_data));
@@ -587,7 +587,7 @@ static int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t d
md = (struct mob_data*)bl;
nullpo_ret(md->guardian_data);
- g = guild_search((int)data);
+ g = guild->search((int)data);
if (g == NULL)
{ //Liberate castle, if the guild is not found this is an error! [Skotlex]
@@ -598,16 +598,16 @@ static int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t d
if (md->guardian_data->castle->guild_id) //Free castle up.
{
ShowNotice("Clearing ownership of castle %d (%s)\n", md->guardian_data->castle->castle_id, md->guardian_data->castle->castle_name);
- guild_castledatasave(md->guardian_data->castle->castle_id, 1, 0);
+ guild->castledatasave(md->guardian_data->castle->castle_id, 1, 0);
}
} else {
if (md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS && md->guardian_data->castle->guardian[md->guardian_data->number].visible)
- guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
+ guild->castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
unit_free(&md->bl,CLR_OUTSIGHT); //Remove guardian.
}
return 0;
}
- guardup_lv = guild_checkskill(g,GD_GUARDUP);
+ guardup_lv = guild->checkskill(g,GD_GUARDUP);
md->guardian_data->emblem_id = g->emblem_id;
memcpy(md->guardian_data->guild_name, g->name, NAME_LENGTH);
md->guardian_data->guardup_lv = guardup_lv;
@@ -667,7 +667,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
if (!mob_parse_dataset(&data))
return 0;
- gc=guild_mapname2gc(map[m].name);
+ gc=guild->mapname2gc(map[m].name);
if (gc == NULL)
{
ShowError("mob_spawn_guardian: No castle set at map %s\n", map[m].name);
@@ -676,7 +676,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
if (!gc->guild_id)
ShowWarning("mob_spawn_guardian: Spawning guardian %d on a castle with no guild (castle map %s)\n", class_, map[m].name);
else
- g = guild_search(gc->guild_id);
+ g = guild->search(gc->guild_id);
if( has_index && gc->guardian[guardian].id )
{ //Check if guardian already exists, refuse to spawn if so.
@@ -713,7 +713,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
{
md->guardian_data->emblem_id = g->emblem_id;
memcpy (md->guardian_data->guild_name, g->name, NAME_LENGTH);
- md->guardian_data->guardup_lv = guild_checkskill(g,GD_GUARDUP);
+ md->guardian_data->guardup_lv = guild->checkskill(g,GD_GUARDUP);
} else if (md->guardian_data->guild_id)
add_timer(gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
mob_spawn(md);
@@ -2114,7 +2114,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
if( md->guardian_data && md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS )
- guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
+ guild->castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
if( src )
{ // Use Dead skill only if not killed by Script or Command
@@ -2675,25 +2675,25 @@ int mob_guardian_guildchange(struct mob_data *md)
md->guardian_data->guild_name[0] = '\0';
} else {
if (md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS && md->guardian_data->castle->guardian[md->guardian_data->number].visible)
- guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number, 0);
+ guild->castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number, 0);
unit_free(&md->bl,CLR_OUTSIGHT); //Remove guardian.
}
return 0;
}
- g = guild_search(md->guardian_data->castle->guild_id);
+ g = guild->search(md->guardian_data->castle->guild_id);
if (g == NULL)
{ //Properly remove guardian info from Castle data.
ShowError("mob_guardian_guildchange: New Guild (id %d) does not exists!\n", md->guardian_data->guild_id);
if (md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS)
- guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number, 0);
+ guild->castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number, 0);
unit_free(&md->bl,CLR_OUTSIGHT);
return 0;
}
md->guardian_data->guild_id = g->guild_id;
md->guardian_data->emblem_id = g->emblem_id;
- md->guardian_data->guardup_lv = guild_checkskill(g,GD_GUARDUP);
+ md->guardian_data->guardup_lv = guild->checkskill(g,GD_GUARDUP);
memcpy(md->guardian_data->guild_name, g->name, NAME_LENGTH);
return 1;
diff --git a/src/map/npc.c b/src/map/npc.c
index 3a3ae472d..77ee8d486 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1889,7 +1889,7 @@ int npc_unload(struct npc_data* nd, bool single) {
}
}
if( nd->u.scr.guild_id )
- guild_flag_remove(nd);
+ guild->flag_remove(nd);
}
script_stop_sleeptimers(nd->bl.id);
@@ -3824,7 +3824,7 @@ int npc_reload(void) {
struct block_list* bl;
/* clear guild flag cache */
- guild_flags_clear();
+ guild->flags_clear();
npc_clear_pathlist();
diff --git a/src/map/pc.c b/src/map/pc.c
index 87cb52895..49828071c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -34,7 +34,7 @@
#include "npc.h" // fake_nd
#include "pet.h" // pet_unlocktarget()
#include "party.h" // party_search()
-#include "guild.h" // guild_search(), guild_request_info()
+#include "guild.h" // guild->search(), guild_request_info()
#include "script.h" // script_config
#include "skill.h"
#include "status.h" // struct status_data
@@ -1207,7 +1207,7 @@ int pc_reg_received(struct map_session_data *sd)
if (sd->status.party_id)
party_member_joined(sd);
if (sd->status.guild_id)
- guild_member_joined(sd);
+ guild->member_joined(sd);
// pet
if (sd->status.pet_id > 0)
@@ -4086,7 +4086,8 @@ int pc_isUseitem(struct map_session_data *sd,int n)
return 0;
if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (pc_get_group_level(sd) < item->item_usage.override) ) {
- clif->colormes(sd->fd,COLOR_WHITE,msg_txt(1474));
+ clif->msgtable(sd->fd,664);
+ //clif->colormes(sd->fd,COLOR_WHITE,msg_txt(1474));
return 0; // You cannot use this item while sitting.
}
@@ -4749,7 +4750,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if (battle_config.clear_unit_onwarp&BL_PC)
skill->clear_unitgroup(&sd->bl);
party_send_dot_remove(sd); //minimap dot fix [Kevin]
- guild_send_dot_remove(sd);
+ guild->send_dot_remove(sd);
bg_send_dot_remove(sd);
if (sd->regen.state.gc)
sd->regen.state.gc = 0;
@@ -4824,7 +4825,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if( sd->status.guild_id > 0 && map[m].flag.gvg_castle )
{ // Increased guild castle regen [Valaris]
- struct guild_castle *gc = guild_mapindex2gc(sd->mapindex);
+ struct guild_castle *gc = guild->mapindex2gc(sd->mapindex);
if(gc && gc->guild_id == sd->status.guild_id)
sd->regen.state.gc = 1;
}
@@ -4948,7 +4949,7 @@ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) {
struct guild *g;
if( sd->status.guild_id>0 && (g=sd->guild)!=NULL)
- return guild_checkskill(g,skill_id);
+ return guild->checkskill(g,skill_id);
return 0;
} else if(!(index = skill->get_index(skill_id)) || index >= ARRAYLENGTH(sd->status.skill) ) {
ShowError("pc_checkskill: Invalid skill id %d (char_id=%d).\n", skill_id, sd->status.char_id);
@@ -4970,7 +4971,7 @@ int pc_checkskill2(struct map_session_data *sd,uint16 index) {
struct guild *g;
if( sd->status.guild_id>0 && (g=sd->guild)!=NULL)
- return guild_checkskill(g,skill_db[index].nameid);
+ return guild->checkskill(g,skill_db[index].nameid);
return 0;
}
if(sd->status.skill[index].id == skill_db[index].nameid)
@@ -5756,7 +5757,7 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
return 0; // no exp on pvp maps
if(sd->status.guild_id>0)
- base_exp-=guild_payexp(sd,base_exp);
+ base_exp-=guild->payexp(sd,base_exp);
if(src) pc_calcexp(sd, &base_exp, &job_exp, src);
@@ -6053,7 +6054,7 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
nullpo_ret(sd);
if( skill_id >= GD_SKILLBASE && skill_id < GD_SKILLBASE+MAX_GUILDSKILL ) {
- guild_skillup(sd, skill_id);
+ guild->skillup(sd, skill_id);
return 0;
}
@@ -6889,10 +6890,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_guildaura_refresh(sd,GD_LEADERSHIP,guild_checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
- guild_guildaura_refresh(sd,GD_GLORYWOUNDS,guild_checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS));
- guild_guildaura_refresh(sd,GD_SOULCOLD,guild_checkskill(sd->state.gmaster_flag,GD_SOULCOLD));
- guild_guildaura_refresh(sd,GD_HAWKEYES,guild_checkskill(sd->state.gmaster_flag,GD_HAWKEYES));
+ 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));
}
}
// script
diff --git a/src/map/script.c b/src/map/script.c
index fba6ef0e9..76092f4ce 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4817,7 +4817,7 @@ BUILDIN(warpguild)
int y = script_getnum(st,4);
int gid = script_getnum(st,5);
- g = guild_search(gid);
+ g = guild->search(gid);
if( g == NULL )
return true;
@@ -6759,7 +6759,7 @@ BUILDIN(getguildname)
guild_id = script_getnum(st,2);
- if( ( g = guild_search(guild_id) ) != NULL )
+ if( ( g = guild->search(guild_id) ) != NULL )
{
script_pushstrcopy(st,g->name);
}
@@ -6781,7 +6781,7 @@ BUILDIN(getguildmaster)
guild_id = script_getnum(st,2);
- if( ( g = guild_search(guild_id) ) != NULL )
+ if( ( g = guild->search(guild_id) ) != NULL )
{
script_pushstrcopy(st,g->member[0].name);
}
@@ -6799,7 +6799,7 @@ BUILDIN(getguildmasterid)
guild_id = script_getnum(st,2);
- if( ( g = guild_search(guild_id) ) != NULL )
+ if( ( g = guild->search(guild_id) ) != NULL )
{
script_pushint(st,g->member[0].char_id);
}
@@ -7693,7 +7693,7 @@ BUILDIN(guildskill)
id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
level = script_getnum(st,3);
for( i=0; i < level; i++ )
- guild_skillup(sd, id);
+ guild->skillup(sd, id);
return true;
}
@@ -7729,11 +7729,11 @@ BUILDIN(getgdskilllv)
guild_id = script_getnum(st,2);
skill_id = ( script_isstring(st,3) ? skill->name2id(script_getstr(st,3)) : script_getnum(st,3) );
- g = guild_search(guild_id);
+ g = guild->search(guild_id);
if( g == NULL )
script_pushint(st, -1);
else
- script_pushint(st, guild_checkskill(g,skill_id));
+ script_pushint(st, guild->checkskill(g,skill_id));
return true;
}
@@ -8372,7 +8372,7 @@ BUILDIN(guildgetexp)
if(exp < 0)
return true;
if(sd && sd->status.guild_id > 0)
- guild_getexp (sd, exp);
+ guild->getexp (sd, exp);
return true;
}
@@ -8393,7 +8393,7 @@ BUILDIN(guildchangegm)
if (!sd)
script_pushint(st,0);
else
- script_pushint(st,guild_gm_change(guild_id, sd));
+ script_pushint(st,guild->gm_change(guild_id, sd));
return true;
}
@@ -9322,7 +9322,7 @@ BUILDIN(getmapguildusers)
script_pushint(st,-1);
return true;
}
- g = guild_search(gid);
+ g = guild->search(gid);
if (g){
for(i = 0; i < g->max_member; i++)
@@ -10743,7 +10743,7 @@ BUILDIN(agitstart)
{
if(agit_flag==1) return true; // Agit already Start.
agit_flag=1;
- guild_agit_start();
+ guild->agit_start();
return true;
}
@@ -10751,7 +10751,7 @@ BUILDIN(agitend)
{
if(agit_flag==0) return true; // Agit already End.
agit_flag=0;
- guild_agit_end();
+ guild->agit_end();
return true;
}
@@ -10759,7 +10759,7 @@ BUILDIN(agitstart2)
{
if(agit2_flag==1) return true; // Agit2 already Start.
agit2_flag=1;
- guild_agit2_start();
+ guild->agit2_start();
return true;
}
@@ -10767,7 +10767,7 @@ BUILDIN(agitend2)
{
if(agit2_flag==0) return true; // Agit2 already End.
agit2_flag=0;
- guild_agit2_end();
+ guild->agit2_end();
return true;
}
@@ -10810,9 +10810,9 @@ BUILDIN(flagemblem)
clif->guild_emblem_area(&nd->bl);
/* guild flag caching */
if( g_id ) /* adding a id */
- guild_flag_add(nd);
+ guild->flag_add(nd);
else if( changed ) /* removing a flag */
- guild_flag_remove(nd);
+ guild->flag_remove(nd);
}
return true;
}
@@ -10820,7 +10820,7 @@ BUILDIN(flagemblem)
BUILDIN(getcastlename)
{
const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL);
- struct guild_castle* gc = guild_mapname2gc(mapname);
+ struct guild_castle* gc = guild->mapname2gc(mapname);
const char* name = (gc) ? gc->castle_name : "";
script_pushstrcopy(st,name);
return true;
@@ -10830,7 +10830,7 @@ BUILDIN(getcastledata)
{
const char *mapname = mapindex_getmapname(script_getstr(st,2),NULL);
int index = script_getnum(st,3);
- struct guild_castle *gc = guild_mapname2gc(mapname);
+ struct guild_castle *gc = guild->mapname2gc(mapname);
if (gc == NULL) {
script_pushint(st,0);
@@ -10874,7 +10874,7 @@ BUILDIN(setcastledata)
const char *mapname = mapindex_getmapname(script_getstr(st,2),NULL);
int index = script_getnum(st,3);
int value = script_getnum(st,4);
- struct guild_castle *gc = guild_mapname2gc(mapname);
+ struct guild_castle *gc = guild->mapname2gc(mapname);
if (gc == NULL) {
ShowWarning("buildin_setcastledata: guild castle for map '%s' not found\n", mapname);
@@ -10886,7 +10886,7 @@ BUILDIN(setcastledata)
return false;
}
- guild_castledatasave(gc->castle_id, index, value);
+ guild->castledatasave(gc->castle_id, index, value);
return true;
}
@@ -10903,7 +10903,7 @@ BUILDIN(requestguildinfo)
}
if(guild_id>0)
- guild_npc_request_info(guild_id,event);
+ guild->npc_request_info(guild_id,event);
return true;
}
@@ -11105,7 +11105,7 @@ BUILDIN(mapwarp) // Added by RoVeRT
switch(check_val){
case 1:
- g = guild_search(check_ID);
+ g = guild->search(check_ID);
if (g){
for( i=0; i < g->max_member; i++)
{
@@ -11425,7 +11425,7 @@ BUILDIN(guardianinfo)
int id = script_getnum(st,3);
int type = script_getnum(st,4);
- struct guild_castle* gc = guild_mapname2gc(mapname);
+ struct guild_castle* gc = guild->mapname2gc(mapname);
struct mob_data* gd;
if( gc == NULL || id < 0 || id >= MAX_GUARDIANS )
diff --git a/src/map/skill.c b/src/map/skill.c
index 2e8bc8b1c..bbc88d9d2 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -7194,7 +7194,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
skill->castend_nodamage_id);
if (sd)
- guild_block_skill(sd,skill->get_time2(skill_id,skill_lv));
+ guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
break;
case GD_REGENERATION:
@@ -7208,7 +7208,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
skill->castend_nodamage_id);
if (sd)
- guild_block_skill(sd,skill->get_time2(skill_id,skill_lv));
+ guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
break;
case GD_RESTORE:
@@ -7222,7 +7222,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
skill->castend_nodamage_id);
if (sd)
- guild_block_skill(sd,skill->get_time2(skill_id,skill_lv));
+ guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
break;
case GD_EMERGENCYCALL:
@@ -7232,7 +7232,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(status_get_guild_id(src));
+ g = sd?sd->state.gmaster_flag:guild->search(status_get_guild_id(src));
if (!g)
break;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -7247,7 +7247,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
}
if (sd)
- guild_block_skill(sd,skill->get_time2(skill_id,skill_lv));
+ guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
break;
diff --git a/src/map/status.c b/src/map/status.c
index fd9ef1d2e..b7e906910 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2096,7 +2096,7 @@ int status_calc_mob_(struct mob_data* md, bool first)
if(flag&4)
{ // Strengthen Guardians - custom value +10% / lv
struct guild_castle *gc;
- gc=guild_mapname2gc(map[md->bl.m].name);
+ gc=guild->mapname2gc(map[md->bl.m].name);
if (!gc)
ShowError("status_calc_mob: No castle set at map %s\n", map[md->bl.m].name);
else
@@ -5876,7 +5876,7 @@ int status_get_emblem_id(struct block_list *bl) {
break;
case BL_NPC:
if (((TBL_NPC*)bl)->subtype == SCRIPT && ((TBL_NPC*)bl)->u.scr.guild_id > 0) {
- struct guild *g = guild_search(((TBL_NPC*)bl)->u.scr.guild_id);
+ struct guild *g = guild->search(((TBL_NPC*)bl)->u.scr.guild_id);
if (g)
return g->emblem_id;
}
diff --git a/src/map/storage.c b/src/map/storage.c
index f9c343f09..fda80735a 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -358,7 +358,7 @@ static DBData create_guildstorage(DBKey key, va_list args)
struct guild_storage *guild2storage(int guild_id)
{
struct guild_storage *gs = NULL;
- if(guild_search(guild_id) != NULL)
+ if(guild->search(guild_id) != NULL)
gs = idb_ensure(guild_storage_db,guild_id,create_guildstorage);
return gs;
}
diff --git a/src/map/unit.c b/src/map/unit.c
index 4602901d9..cbc695c4a 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2112,9 +2112,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
if(sd->party_invite>0)
party_reply_invite(sd,sd->party_invite,0);
if(sd->guild_invite>0)
- guild_reply_invite(sd,sd->guild_invite,0);
+ guild->reply_invite(sd,sd->guild_invite,0);
if(sd->guild_alliance>0)
- guild_reply_reqalliance(sd,sd->guild_alliance_account,0);
+ guild->reply_reqalliance(sd,sd->guild_alliance_account,0);
if(sd->menuskill_id)
sd->menuskill_id = sd->menuskill_val = 0;
if( sd->touching_id )
@@ -2143,7 +2143,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
skill->sit(sd,0);
}
party_send_dot_remove(sd);//minimap dot fix [Kevin]
- guild_send_dot_remove(sd);
+ guild->send_dot_remove(sd);
bg_send_dot_remove(sd);
if( map[bl->m].users <= 0 || sd->state.debug_remove_map )
@@ -2320,7 +2320,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
// Notify friends that this char logged out. [Skotlex]
map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
party_send_logout(sd);
- guild_send_memberinfoshort(sd,0);
+ guild->send_memberinfoshort(sd,0);
pc_cleareventtimer(sd);
pc_inventory_rental_clear(sd);
pc_delspiritball(sd,sd->spiritball,1);