diff options
Diffstat (limited to 'src/char_sql')
-rw-r--r-- | src/char_sql/char.c | 3 | ||||
-rw-r--r-- | src/char_sql/char.h | 2 | ||||
-rw-r--r-- | src/char_sql/int_guild.c | 31 |
3 files changed, 26 insertions, 10 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 5897a88ab..494e975f5 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -146,6 +146,7 @@ int save_log = 1; int start_zeny = 500;
int start_weapon = 1201;
int start_armor = 2301;
+int guild_exp_rate = 100;
//Custom limits for the fame lists. [Skotlex]
int fame_list_size_chemist = MAX_FAME_LIST;
@@ -4192,6 +4193,8 @@ int char_config_read(const char *cfgName) { ShowWarning("Max fame list size is %d (fame_list_taekwon)\n", MAX_FAME_LIST);
fame_list_size_taekwon = MAX_FAME_LIST;
}
+ } else if (strcmpi(w1, "guild_exp_rate") == 0) {
+ guild_exp_rate = atoi(w2);
} else if (strcmpi(w1, "import") == 0) {
char_config_read(w2);
}
diff --git a/src/char_sql/char.h b/src/char_sql/char.h index 0eb896d76..2231cbbbf 100644 --- a/src/char_sql/char.h +++ b/src/char_sql/char.h @@ -96,6 +96,8 @@ extern int lowest_gm_level; extern int GM_num;
extern struct gm_account *gm_account;
+extern int guild_exp_rate;
+
extern int debug_mysql_query(char *file, int line, void *mysql, const char *q);
#endif
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c index f0ee8be4d..23cb95bb7 100644 --- a/src/char_sql/int_guild.c +++ b/src/char_sql/int_guild.c @@ -7,6 +7,7 @@ #include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include "char.h"
#include "../common/strlib.h"
@@ -1523,16 +1524,26 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha break;
}
case GMI_EXP:
- { // EXP
- unsigned int exp,oldexp=g->member[i].exp;
- exp=g->member[i].exp=*((unsigned int *)data);
- g->exp+=(exp-oldexp);
- guild_calcinfo(g); // LvƒAƒbƒv”»’f
- mapif_guild_basicinfochanged(guild_id,GBI_EXP,&g->exp,4);
- mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
- g->save_flag |= (GS_BASIC|GS_MEMBER);
- break;
- }
+ { // EXP
+ unsigned int exp, old_exp=g->member[i].exp;
+ g->member[i].exp=*((unsigned int *)data);
+ if (g->member[i].exp > old_exp)
+ {
+ exp = g->member[i].exp - old_exp;
+ if (guild_exp_rate != 100)
+ exp = exp*guild_exp_rate/100;
+ if (exp > UINT_MAX - g->exp)
+ g->exp = UINT_MAX;
+ else
+ g->exp+=exp;
+ guild_calcinfo(g);
+ mapif_guild_basicinfochanged(guild_id,GBI_EXP,&g->exp,4);
+ g->save_flag |= GS_BASIC;
+ }
+ mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
+ g->save_flag |= GS_MEMBER;
+ break;
+ }
case GMI_HAIR:
{
g->member[i].hair=*((int *)data);
|