summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt6
-rw-r--r--conf-tmpl/battle/guild.conf4
-rw-r--r--conf-tmpl/char_athena.conf6
-rw-r--r--src/char/char.c3
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/int_guild.c22
-rw-r--r--src/char_sql/char.c3
-rw-r--r--src/char_sql/char.h2
-rw-r--r--src/char_sql/int_guild.c31
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/guild.c27
13 files changed, 69 insertions, 44 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 38b3da6b9..4dac143ab 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,12 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/09
+ * Fixed @mapinfo displaying incorrectly maps with nosave which send you
+ back to your last savepoint. [Skotlex]
+ * Moved guild_exp_rate from a mapserver battle config setting to a char
+ server config. It no longer modifies the total taxed exp as seen on the
+ guild information window, but directly modifies the exp that the guild
+ earns. [Skotlex]
* Added an error report and correction when the map server receives a guild
from the char-server with more guild members than MAX_GUILD. [Skotlex]
* Changed the interval between waterballs back to 125 [MasterOfMuppets]
diff --git a/conf-tmpl/battle/guild.conf b/conf-tmpl/battle/guild.conf
index c02f4ce96..c63ca79ea 100644
--- a/conf-tmpl/battle/guild.conf
+++ b/conf-tmpl/battle/guild.conf
@@ -30,10 +30,6 @@
// When making a guild, an Emperium is consumed? (Note 1)
guild_emperium_check: yes
-// Rate at which taxed experience is earned. (Note 2)
-// For example, if set to 200, all experience that is taxed from players is doubled before adding it to the guild.
-guild_exp_rate: 100
-
// Maximum tax limit on a guild member.
guild_exp_limit: 50
diff --git a/conf-tmpl/char_athena.conf b/conf-tmpl/char_athena.conf
index 68f7113aa..576d6e757 100644
--- a/conf-tmpl/char_athena.conf
+++ b/conf-tmpl/char_athena.conf
@@ -139,6 +139,12 @@ fame_list_alchemist: 10
fame_list_blacksmith: 10
fame_list_taekwon: 10
+// Guild earned exp modifier.
+// Adjusts taxed exp before adding it to the guild's exp. For example, if set
+// to 200, the guild receives double the player's taxed exp.
+guild_exp_rate: 100
+
+
// Name used for unknown characters
unknown_char_name: Unknown
diff --git a/src/char/char.c b/src/char/char.c
index 78ad37146..5a9b2668a 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -127,6 +127,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;
@@ -4107,6 +4108,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/char.h b/src/char/char.h
index dfec9104f..773532035 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -44,5 +44,5 @@ extern int char_name_option;
extern char char_name_letters[];
extern int autosave_interval;
extern char db_path[];
-
+extern int guild_exp_rate;
#endif
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 3cd5572d9..a676de285 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include "../common/mmo.h"
#include "../common/socket.h"
@@ -1205,12 +1206,21 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
g->member[i].position = *((int *)data);
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アップ判断
- mapif_guild_basicinfochanged(guild_id, GBI_EXP, &g->exp, 4);
+ {
+ 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);
+ }
break;
}
case GMI_HAIR:
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アップ判断
- 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);
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 5f5b61370..0b9a0808f 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5696,7 +5696,9 @@ int atcommand_mapinfo(
clif_displaymessage(fd, atcmd_output);
if (map[m_id].flag.nosave) {
- if (map[m_id].save.x == -1 || map[m_id].save.y == -1 )
+ if (!map[m_id].save.map)
+ sprintf(atcmd_output, "No Save (Return to last Save Point)");
+ else if (map[m_id].save.x == -1 || map[m_id].save.y == -1 )
sprintf(atcmd_output, "No Save, Save Point: %s,Random",mapindex_id2name(map[m_id].save.map));
else
sprintf(atcmd_output, "No Save, Save Point: %s,%d,%d",
diff --git a/src/map/battle.c b/src/map/battle.c
index 487c65c14..c9245e7fa 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3326,7 +3326,6 @@ static const struct battle_data_short {
{ "quest_skill_reset", &battle_config.quest_skill_reset },
{ "basic_skill_check", &battle_config.basic_skill_check },
{ "guild_emperium_check", &battle_config.guild_emperium_check },
- { "guild_exp_rate", &battle_config.guild_exp_rate },
{ "guild_exp_limit", &battle_config.guild_exp_limit },
{ "player_invincible_time", &battle_config.pc_invincible_time },
{ "pet_catch_rate", &battle_config.pet_catch_rate },
@@ -3721,7 +3720,6 @@ void battle_set_defaults() {
battle_config.basic_skill_check=1;
battle_config.guild_emperium_check=1;
battle_config.guild_exp_limit=50;
- battle_config.guild_exp_rate=100;
battle_config.pc_invincible_time = 5000;
battle_config.pet_catch_rate=100;
battle_config.pet_rename=0;
diff --git a/src/map/battle.h b/src/map/battle.h
index 4980ecceb..8cbc15031 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -165,7 +165,6 @@ extern struct Battle_Config {
unsigned short quest_skill_reset;
unsigned short basic_skill_check;
unsigned short guild_emperium_check;
- unsigned short guild_exp_rate; //[Skotlex]
unsigned short guild_exp_limit;
unsigned short guild_max_castles;
unsigned short pc_invincible_time;
diff --git a/src/map/guild.c b/src/map/guild.c
index bef4f0c31..8e4a16901 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1141,8 +1141,6 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
struct guild *g;
struct guild_expcache *c;
int per;
- unsigned int exp2;
- double tmp;
nullpo_retr(0, sd);
@@ -1150,32 +1148,23 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
if (sd->status.guild_id == 0 ||
(g = guild_search(sd->status.guild_id)) == NULL ||
- (per = g->position[guild_getposition(sd,g)].exp_mode) <= 0)
+ (per = guild_getposition(sd,g)) < 0 ||
+ (per = g->position[per].exp_mode) < 1)
return 0;
- if (per > 100) per = 100;
- else
- if (per < 1) return 0;
-
-
- tmp = exp * per / 100;
- if (tmp <= 0)
- return 0;
-
- exp2 = (unsigned int)tmp;
+ if (per < 100)
+ exp = (unsigned int) exp * per / 100;
+ //Otherwise tax everything.
- if (battle_config.guild_exp_rate != 100)
- tmp = tmp*battle_config.guild_exp_rate/100;
-
c = guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
- if (c->exp > UINT_MAX - (unsigned int)tmp)
+ if (c->exp > UINT_MAX - exp)
c->exp = UINT_MAX;
else
- c->exp += (unsigned int)tmp;
+ c->exp += exp;
- return exp2;
+ return exp;
}
// Celest