summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char_sql/int_guild.c1
-rw-r--r--src/map/clif.c17
-rw-r--r--src/map/guild.c41
-rw-r--r--src/map/guild.h3
4 files changed, 34 insertions, 28 deletions
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index dbb9bc1ad..9132f9ec2 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -1773,7 +1773,6 @@ int mapif_parse_GuildPosition(int fd,int guild_id,int idx,struct guild_position
memcpy(&g->position[idx],p,sizeof(struct guild_position));
mapif_guild_position(g,idx);
- ShowInfo("int_guild: position data changed (Guild %d, position %d)\n",guild_id, idx);
g->position[idx].modified = GS_POSITION_MODIFIED;
g->save_flag |= GS_POSITION; // Change guild_position
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index b2e680b93..9b8bcfdeb 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10578,6 +10578,7 @@ void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) {
*/
void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if (!sd->status.guild_id) return;
switch(RFIFOL(fd,2)){
case 0: // ギルド基本情報、同盟敵対情報
clif_guild_basicinfo(sd);
@@ -10612,8 +10613,11 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) {
int i;
RFIFOHEAD(fd);
+ if(!sd->state.gmaster_flag)
+ return;
+
for(i = 4; i < RFIFOW(fd,2); i += 40 ){
- guild_change_position(sd, 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));
}
}
@@ -10624,6 +10628,9 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) {
void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) {
int i;
RFIFOHEAD(fd);
+
+ if(!sd->state.gmaster_flag)
+ return;
for(i=4;i<RFIFOW(fd,2);i+=12){
guild_change_memberposition(sd->status.guild_id,
@@ -10649,6 +10656,10 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) {
*/
void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
+
+ if(!sd->state.gmaster_flag)
+ return;
+
guild_change_emblem(sd,RFIFOW(fd,2)-4,(char*)RFIFOP(fd,4));
}
@@ -10658,6 +10669,10 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) {
*/
void clif_parse_GuildChangeNotice(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
+
+ if(!sd->state.gmaster_flag)
+ return;
+
guild_change_notice(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6),(char*)RFIFOP(fd,66));
}
diff --git a/src/map/guild.c b/src/map/guild.c
index 0b3be181b..6ad15968e 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -638,6 +638,9 @@ int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
if(tsd==NULL || g==NULL)
return 0;
+ if( (i=guild_getposition(sd,g))<0 || !(g->position[i].mode&0x0001) )
+ return 0; //Invite permission.
+
if(!battle_config.invite_request_check) {
if (tsd->party_invite>0 || tsd->trade_partner) { // 相手が取引中かどうか
clif_guild_inviteack(sd,0);
@@ -651,7 +654,7 @@ int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
clif_guild_inviteack(sd,0);
return 0;
}
-
+
// 定員確認
for(i=0;i<g->max_member;i++)
if(g->member[i].account_id==0)
@@ -770,7 +773,6 @@ int guild_leave(struct map_session_data *sd,int guild_id,
int account_id,int char_id,const char *mes)
{
struct guild *g;
- int i;
nullpo_retr(0, sd);
@@ -779,18 +781,12 @@ int guild_leave(struct map_session_data *sd,int guild_id,
if(g==NULL)
return 0;
- if( sd->status.account_id!=account_id ||
+ if(sd->status.account_id!=account_id ||
sd->status.char_id!=char_id || sd->status.guild_id!=guild_id ||
map[sd->bl.m].flag.gvg_castle) //Can't leave inside guild castles.
return 0;
- for(i=0;i<g->max_member;i++){ // 所属しているか
- if( g->member[i].account_id==sd->status.account_id &&
- g->member[i].char_id==sd->status.char_id ){
- intif_guild_leave(g->guild_id,sd->status.account_id,sd->status.char_id,0,mes);
- return 0;
- }
- }
+ intif_guild_leave(sd->status.guild_id, sd->status.account_id, sd->status.char_id,0,mes);
return 0;
}
// ギルド追放要求
@@ -811,15 +807,14 @@ int guild_expulsion(struct map_session_data *sd,int guild_id,
return 0;
if( (ps=guild_getposition(sd,g))<0 || !(g->position[ps].mode&0x0010) )
- return 0; // 処罰権限無し
+ return 0; //Expulsion permission
for(i=0;i<g->max_member;i++){ // 所属しているか
- if( g->member[i].account_id==account_id &&
+ if(g->member[i].account_id==account_id &&
g->member[i].char_id==char_id ){
+ if(!strcmp(g->member[i].name,g->master))
+ return 0; //Can't expel the GM!
intif_guild_leave(g->guild_id,account_id,char_id,1,mes);
- //It's wrong way, member info will erased later
- //see guild_member_leaved [LuzZza]
- //malloc_set(&g->member[i],0,sizeof(struct guild_member));
return 0;
}
}
@@ -1023,21 +1018,19 @@ int guild_memberposition_changed(struct guild *g,int idx,int pos)
return 0;
}
// ギルド役職変更
-int guild_change_position(struct map_session_data *sd,int idx,
+int guild_change_position(int guild_id,int idx,
int mode,int exp_mode,const char *name)
{
struct guild_position p;
- nullpo_retr(0, sd);
-
- if(exp_mode>battle_config.guild_exp_limit)
- exp_mode=battle_config.guild_exp_limit;
- if(exp_mode<0)exp_mode=0;
- p.mode=mode;
+ exp_mode = cap_value(exp_mode, 0, battle_config.guild_exp_limit);
+ //Mode 0x01 <- Invite
+ //Mode 0x10 <- Expel.
+ p.mode=mode&0x11;
p.exp_mode=exp_mode;
memcpy(p.name,name,NAME_LENGTH-1);
p.name[NAME_LENGTH-1] = '\0'; //Security check... [Skotlex]
- return intif_guild_position(sd->status.guild_id,idx,&p);
+ return intif_guild_position(guild_id,idx,&p);
}
// ギルド役職変更通知
int guild_position_changed(int guild_id,int idx,struct guild_position *p)
@@ -1658,7 +1651,7 @@ int guild_break(struct map_session_data *sd,char *name)
return 0;
if(strcmp(g->name,name)!=0)
return 0;
- if(strcmp(sd->status.name,g->master)!=0)
+ if(!sd->state.gmaster_flag)
return 0;
for(i=0;i<g->max_member;i++){
if( g->member[i].account_id>0 && (
diff --git a/src/map/guild.h b/src/map/guild.h
index 69174e021..7de747b8d 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -63,8 +63,7 @@ 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,int idx);
int guild_memberposition_changed(struct guild *g,int idx,int pos);
-int guild_change_position(struct map_session_data *sd,int idx,
- int mode,int exp_mode,const char *name);
+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);