Selaa lähdekoodia

- Fixed @mapinfo displaying incorrectly maps with nosave which send you back to your last savepoint.
- 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.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7074 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 vuotta sitten
vanhempi
commit
2e5660ec68

+ 6 - 0
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]

+ 0 - 4
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
 

+ 6 - 0
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
 

+ 3 - 0
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);
 		}

+ 1 - 1
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

+ 16 - 6
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ƒAƒbƒv”»’f
-		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:

+ 3 - 0
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);
 		}

+ 2 - 0
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

+ 21 - 10
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);

+ 3 - 1
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",

+ 0 - 2
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;

+ 0 - 1
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;

+ 8 - 19
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