summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c80
1 files changed, 38 insertions, 42 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 936b4c900..5f6ce83c6 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -4,37 +4,37 @@
#define HERCULES_CORE
-#include "../config/core.h" // GP_BOUND_ITEMS
+#include "config/core.h" // GP_BOUND_ITEMS
#include "guild.h"
+#include "map/battle.h"
+#include "map/channel.h"
+#include "map/clif.h"
+#include "map/instance.h"
+#include "map/intif.h"
+#include "map/log.h"
+#include "map/map.h"
+#include "map/mob.h"
+#include "map/npc.h"
+#include "map/pc.h"
+#include "map/skill.h"
+#include "map/status.h"
+#include "map/storage.h"
+#include "common/HPM.h"
+#include "common/cbasetypes.h"
+#include "common/ers.h"
+#include "common/malloc.h"
+#include "common/mapindex.h"
+#include "common/nullpo.h"
+#include "common/showmsg.h"
+#include "common/strlib.h"
+#include "common/timer.h"
+#include "common/utils.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "battle.h"
-#include "channel.h"
-#include "clif.h"
-#include "instance.h"
-#include "intif.h"
-#include "log.h"
-#include "map.h"
-#include "mob.h"
-#include "npc.h"
-#include "pc.h"
-#include "skill.h"
-#include "status.h"
-#include "storage.h"
-#include "../common/HPM.h"
-#include "../common/cbasetypes.h"
-#include "../common/ers.h"
-#include "../common/malloc.h"
-#include "../common/mapindex.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "../common/utils.h"
-
struct guild_interface guild_s;
/*==========================================
@@ -343,14 +343,12 @@ int guild_create(struct map_session_data *sd, const char *name)
if( !tname[0] )
return 0; // empty name
- if( sd->status.guild_id )
- {// already in a guild
- clif->guild_created(sd,1);
+ if( sd->status.guild_id ) {
+ clif->guild_created(sd,1); // You're already in a guild
return 0;
}
if (battle_config.guild_emperium_check && pc->search_inventory(sd, ITEMID_EMPERIUM) == INDEX_NOT_FOUND) {
- // item required
- clif->guild_created(sd,3);
+ clif->guild_created(sd,3); // You need the necessary item to create a guild
return 0;
}
@@ -367,14 +365,14 @@ int guild_created(int account_id,int guild_id) {
if(sd==NULL)
return 0;
if(!guild_id) {
- clif->guild_created(sd, 2); // Creation failure (presence of the same name Guild)
+ clif->guild_created(sd, 2); // Creation failure (The guild name already exists)
return 0;
}
//struct guild *g;
sd->status.guild_id=guild_id;
- clif->guild_created(sd,0);
+ clif->guild_created(sd,0); // Success
if(battle_config.guild_emperium_check)
- pc->delitem(sd,pc->search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption
+ pc->delitem(sd, pc->search_inventory(sd, ITEMID_EMPERIUM), 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); //emperium consumption
return 0;
}
@@ -615,7 +613,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&GPERM_INVITE) )
return 0; //Invite permission.
if(!battle_config.invite_request_check) {
@@ -840,7 +838,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&GPERM_EXPEL))
return 0; //Expulsion permission
//Can't leave inside guild castles.
@@ -895,7 +893,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
// update char, if online
if(sd != NULL && sd->status.guild_id == guild_id) {
// do stuff that needs the guild_id first, BEFORE we wipe it
- if (sd->state.storage_flag == 2) //Close the guild storage.
+ if (sd->state.storage_flag == STORAGE_FLAG_GUILD) //Close the guild storage.
gstorage->close(sd);
guild->send_dot_remove(sd);
if (channel->config->ally) {
@@ -926,7 +924,7 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id) {
if(gstor && gstor->storage_status == 1) { //Someone is in guild storage, close them
struct s_mapiterator* iter = mapit_getallusers();
for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) {
- if(sd->status.guild_id == guild_id && sd->state.storage_flag == 2) {
+ if(sd->status.guild_id == guild_id && sd->state.storage_flag == STORAGE_FLAG_GUILD) {
gstorage->close(sd);
break;
}
@@ -1095,9 +1093,7 @@ int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char
struct guild_position p;
exp_mode = cap_value(exp_mode, 0, battle_config.guild_exp_limit);
- //Mode 0x01 <- Invite
- //Mode 0x10 <- Expel.
- p.mode=mode&0x11;
+ p.mode=mode&GPERM_BOTH; // Invite and Expel
p.exp_mode=exp_mode;
safestrncpy(p.name,name,NAME_LENGTH);
return intif->guild_position(guild_id,idx,&p);
@@ -1750,7 +1746,7 @@ int guild_broken(int guild_id,int flag)
for(i=0;i<g->max_member;i++){
// Destroy all relationships
if((sd=g->member[i].sd)!=NULL){
- if(sd->state.storage_flag == 2)
+ if(sd->state.storage_flag == STORAGE_FLAG_GUILD)
gstorage->pc_quit(sd,1);
sd->status.guild_id=0;
sd->guild = NULL;
@@ -1910,7 +1906,7 @@ int guild_break(struct map_session_data *sd,char *name) {
}
}
- for(i = 0; i < count; i++) {
+ for(i = 0; i < count; i++) { // FIXME: Why is this not done in the above loop?
skill->del_unitgroup(groups[i],ALC_MARK);
}
}