Corrected guild level increases (#4094)

* Resolves guild levels being capped to various hard coded limits rather than using the constant.
Thanks to @datleeroy!
This commit is contained in:
Aleos 2019-04-10 09:15:54 -04:00 committed by GitHub
parent 26ebaf732c
commit c772262469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -758,7 +758,7 @@ int inter_guild_sql_init(void)
//Read exp file
for(i = 0; i<ARRAYLENGTH(filename); i++){
sv_readdb(db_path, filename[i], ',', 1, 1, 100, exp_guild_parse_row, i > 0);
sv_readdb(db_path, filename[i], ',', 1, 1, MAX_GUILDLEVEL, exp_guild_parse_row, i > 0);
}
add_timer_func_list(guild_save_timer, "guild_save_timer");
@ -829,7 +829,10 @@ unsigned int guild_nextexp(int level)
{
if (level == 0)
return 1;
return level < 100 && level > 0 ? guild_exp[level-1] : 0;
if (level < 0 || level > MAX_GUILDLEVEL)
return 0;
return guild_exp[level-1];
}
int guild_checkskill(struct guild *g,int id)
@ -867,7 +870,7 @@ int guild_calcinfo(struct guild *g)
g->max_member = MAX_GUILD;
}
// Compute the guild average level level
// Compute the guild average level
g->average_lv=0;
g->connect_member=0;
for(i=c=0;i<g->max_member;i++)
@ -1451,23 +1454,22 @@ int mapif_parse_GuildMessage(int fd,int guild_id,uint32 account_id,char *mes,int
// Modification of the guild
int mapif_parse_GuildBasicInfoChange(int fd,int guild_id,int type,const char *data,int len)
{
struct guild * g;
short dw=*((short *)data);
g = inter_guild_fromsql(guild_id);
if(g==NULL)
struct guild *g = inter_guild_fromsql(guild_id);
if (!g)
return 0;
switch(type)
{
short data_value = *((short *)data);
switch(type) {
case GBI_GUILDLV:
if(dw>0 && g->guild_lv+dw<=50)
{
g->guild_lv+=dw;
g->skill_point+=dw;
}
else if(dw<0 && g->guild_lv+dw>=1)
g->guild_lv+=dw;
mapif_guild_info(-1,g);
if (data_value > 0 && g->guild_lv + data_value <= MAX_GUILDLEVEL) {
g->guild_lv += data_value;
g->skill_point += data_value;
} else if (data_value < 0 && g->guild_lv + data_value >= 1)
g->guild_lv += data_value;
mapif_guild_info(-1, g);
g->save_flag |= GS_LEVEL;
return 0;
default: