瀏覽代碼

Set proper limits to drop rates to prevent integer overflow.
Minor details cleanup.

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

ultramage 18 年之前
父節點
當前提交
e476015e82
共有 5 個文件被更改,包括 21 次插入26 次删除
  1. 1 0
      Changelog-Trunk.txt
  2. 3 10
      doc/script_commands.txt
  3. 1 1
      npc/sample/monster_controller.txt
  4. 13 13
      src/map/battle.c
  5. 3 2
      src/map/mob.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ 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.
 
 2007/08/19
+	* Set proper limits to drop rates, prevents int overflow during calc
 	* Cleaned/clarified some #include relationships between headers
 	- TODO: pc_read_gm_account() still accessses the RFIFO directly!
 	* Again removed the IG_ list from itemdb.h (see r10100 and r10113)

+ 3 - 10
doc/script_commands.txt

@@ -9,7 +9,7 @@
 //= Maeki Rika - A section on general concepts and lots of
 //=              other updates and additions.
 //===== Version ===========================================
-//= 3.05.20070423
+//= 3.05.20070819
 //=========================================================
 //= 1.0 - First release, filled will as much info as I could
 //=       remember or figure out, most likely there are errors,
@@ -76,6 +76,8 @@
 //= 3.05.20070423
 //=       menu/select/prompt produce consistent results for grouped and empty 
 //=       options [FlavioJS]
+//= 3.05.20070819
+//=       Removed the messy 'unitdeadsit' command reference [ultramage]
 //===== Description =======================================
 //= A reference manual for the eAthena scripting language,
 //= sorted out depending on their functionality.
@@ -4672,18 +4674,9 @@ Example(s):
 * unitstop <GID>;
 * unittalk <GID>,<Text>;
 * unitemote <GID>,<Emote>;
-* unitdeadsit <GID>,<Action?>;
 
 Okay, these commands should be fairly self explaining.
-
 For the emotions, you can look in db/const.txt for prefixes with e_
-The unitdeadsit uses an action, not exactly sure why it's named unitdeadsit...
-
-Anyhoo: actions are
-0: normal attack
-1: pick stone like
-2: normal sit	
-3: nothing?
 
 ---------------------------------------
 

+ 1 - 1
npc/sample/monster_controller.txt

@@ -144,7 +144,7 @@ L_MainMenu:
 	}
 
 L_AttackMenu:
-	switch(select("Walk","Follow","Attack","Stop","Defend","Talk","Emote","Random Walk","Callback","Back","Sit")){
+	switch(select("Walk","Follow","Attack","Stop","Defend","Talk","Emote","Random Walk","Callback","Back")){
 		case 1: // Walk
 			set .@src, make_menu();
 			input .@x;

+ 13 - 13
src/map/battle.c

@@ -3571,19 +3571,19 @@ static const struct _battle_data {
 	{ "item_drop_add_max",                  &battle_config.item_drop_adddrop_max,           10000,  1,      10000,          },
 	{ "item_drop_treasure_min",             &battle_config.item_drop_treasure_min,          1,      1,      10000,          },
 	{ "item_drop_treasure_max",             &battle_config.item_drop_treasure_max,          10000,  1,      10000,          },
-	{ "item_rate_mvp",                      &battle_config.item_rate_mvp,                   100,    0,      INT_MAX,        },
-	{ "item_rate_common",                   &battle_config.item_rate_common,                100,    0,      INT_MAX,        },
-	{ "item_rate_common_boss",              &battle_config.item_rate_common_boss,           100,    0,      INT_MAX,        },
-	{ "item_rate_equip",                    &battle_config.item_rate_equip,                 100,    0,      INT_MAX,        },
-	{ "item_rate_equip_boss",               &battle_config.item_rate_equip_boss,            100,    0,      INT_MAX,        },
-	{ "item_rate_card",                     &battle_config.item_rate_card,                  100,    0,      INT_MAX,        },
-	{ "item_rate_card_boss",                &battle_config.item_rate_card_boss,             100,    0,      INT_MAX,        },
-	{ "item_rate_heal",                     &battle_config.item_rate_heal,                  100,    0,      INT_MAX,        },
-	{ "item_rate_heal_boss",                &battle_config.item_rate_heal_boss,             100,    0,      INT_MAX,        },
-	{ "item_rate_use",                      &battle_config.item_rate_use,                   100,    0,      INT_MAX,        },
-	{ "item_rate_use_boss",                 &battle_config.item_rate_use_boss,              100,    0,      INT_MAX,        },
-	{ "item_rate_adddrop",                  &battle_config.item_rate_adddrop,               100,    0,      INT_MAX,        },
-	{ "item_rate_treasure",                 &battle_config.item_rate_treasure,              100,    0,      INT_MAX,        },
+	{ "item_rate_mvp",                      &battle_config.item_rate_mvp,                   100,    0,      10000,          },
+	{ "item_rate_common",                   &battle_config.item_rate_common,                100,    0,      10000,          },
+	{ "item_rate_common_boss",              &battle_config.item_rate_common_boss,           100,    0,      10000,          },
+	{ "item_rate_equip",                    &battle_config.item_rate_equip,                 100,    0,      10000,          },
+	{ "item_rate_equip_boss",               &battle_config.item_rate_equip_boss,            100,    0,      10000,          },
+	{ "item_rate_card",                     &battle_config.item_rate_card,                  100,    0,      10000,          },
+	{ "item_rate_card_boss",                &battle_config.item_rate_card_boss,             100,    0,      10000,          },
+	{ "item_rate_heal",                     &battle_config.item_rate_heal,                  100,    0,      10000,          },
+	{ "item_rate_heal_boss",                &battle_config.item_rate_heal_boss,             100,    0,      10000,          },
+	{ "item_rate_use",                      &battle_config.item_rate_use,                   100,    0,      10000,          },
+	{ "item_rate_use_boss",                 &battle_config.item_rate_use_boss,              100,    0,      10000,          },
+	{ "item_rate_adddrop",                  &battle_config.item_rate_adddrop,               100,    0,      10000,          },
+	{ "item_rate_treasure",                 &battle_config.item_rate_treasure,              100,    0,      10000,          },
 	{ "prevent_logout",                     &battle_config.prevent_logout,                  10000,  0,      60000,          },
 	{ "alchemist_summon_reward",            &battle_config.alchemist_summon_reward,         1,      0,      2,              },
 	{ "drops_by_luk",                       &battle_config.drops_by_luk,                    0,      0,      INT_MAX,        },

+ 3 - 2
src/map/mob.c

@@ -3170,8 +3170,9 @@ static unsigned int mob_drop_adjust(int rate, int rate_adjust, unsigned short ra
 		//Equation: Droprate(x,y) = x * (5 - log(x)) ^ (ln(y) / ln(5))
 		//x is the normal Droprate, y is the Modificator.
 		rate = (int)(rate * pow((5.0 - log10(rate)), (log(rate_adjust/100.) / log(5.0))) + 0.5);
-	else	//Classical linear rate adjustment.
-		rate = rate*rate_adjust/100;
+	else
+		//Classical linear rate adjustment.
+		rate = rate * rate_adjust/100;
 	return cap_value(rate,rate_min,rate_max);
 }