Browse Source

* Prevented MDEF damage reduction from dividing by zero. (bugreport:8064)
* Added a new battle_config to increase all items drop rate by 0.01%. (bugreport:8005)
* Moved OnInit to load before OnInstanceInit in npc_reload(). (bugreport:8043)
* Fixed homunculus causing the map-server to crash. (bugreport:8036)

aleos89 11 years ago
parent
commit
c154fe1e35
7 changed files with 20 additions and 4 deletions
  1. 7 0
      conf/battle/drops.conf
  2. 1 1
      conf/battle/gm.conf
  3. 4 0
      src/map/battle.c
  4. 1 0
      src/map/battle.h
  5. 1 1
      src/map/homunculus.c
  6. 4 0
      src/map/mob.c
  7. 2 2
      src/map/npc.c

+ 7 - 0
conf/battle/drops.conf

@@ -107,6 +107,13 @@ item_logarithmic_drops: no
 // Default: no (as in official servers).
 drop_rate0item: no
 
+// Increase item drop rate +0.01%? (Note 1)
+// On official servers it is possible to get 0.00% drop chance so all items are increased by 0.01%.
+// NOTE: This is viewed as a bug to rAthena.
+// NOTE2: This only applies if RENEWAL_DROP (src/config/renewal.h) is disabled.
+// Default: no
+drop_rateincrease: no
+
 // Makes your LUK value affect drop rates on an absolute basis.
 // Setting to 100 means each luk adds 0.01% chance to find items
 // (regardless of item's base drop rate).

+ 1 - 1
conf/battle/gm.conf

@@ -26,7 +26,7 @@ atcommand_max_stat_bypass: no
 // Duration of the ban, in minutes (default: 5). To disable the ban, set 0.
 ban_hack_trade: 5
 
-// requires RENEWAL_EXP or RENEWAL_DROP to be enabled (src/map/config/renewal.h)
+// requires RENEWAL_EXP or RENEWAL_DROP to be enabled (src/config/renewal.h)
 // modifies @mobinfo to display the users' real drop rate as per renewal_drop formula
 // modifies @iteminfo to not display the minimum item drop rate (since it can't tell the mob level)
 // modifies @whodrops to display the users' real drop rate as per renewal_drop formula

+ 4 - 0
src/map/battle.c

@@ -5188,6 +5188,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 			 * RE MDEF Reduction
 			 * Damage = Magic Attack * (1000+eMDEF)/(1000+eMDEF) - sMDEF
 			 **/
+			if (mdef < -100)
+				mdef = -99; // Avoid divide by 0
+
 			ad.damage = ad.damage * (1000 + mdef) / (1000 + mdef * 10) - mdef2;
 #else
 			if(battle_config.magic_defense_type)
@@ -7063,6 +7066,7 @@ static const struct _battle_data {
 	{ "item_enabled_npc",                   &battle_config.item_enabled_npc,                1,      0,      1,              },
 	{ "item_flooritem_check",               &battle_config.item_onfloor,                    1,      0,      1,              },
 	{ "bowling_bash_area",                  &battle_config.bowling_bash_area,               0,      0,      20,             },
+	{ "drop_rateincrease",                  &battle_config.drop_rateincrease,               0,      0,      1,              },
 };
 #ifndef STATS_OPT_OUT
 /**

+ 1 - 0
src/map/battle.h

@@ -494,6 +494,7 @@ extern struct Battle_Config
 	int item_enabled_npc;
 	int item_onfloor; // Whether to drop an undroppable item on the map or destroy it if inventory is full.
 	int bowling_bash_area;
+	int drop_rateincrease;
 
 } battle_config;
 

+ 1 - 1
src/map/homunculus.c

@@ -265,7 +265,7 @@ int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve)
 int merc_hom_checkskill(struct homun_data *hd,uint16 skill_id)
 {
 	int i = skill_id - HM_SKILLBASE;
-	if(!hd)
+	if(!hd || !&hd->homunculus)
 		return 0;
 
 	if(hd->homunculus.hskill[i].id == skill_id)

+ 4 - 0
src/map/mob.c

@@ -3805,6 +3805,10 @@ static bool mob_parse_dbrow(char** str)
 		id = itemdb_search(db->dropitem[i].nameid);
 		type = id->type;
 		rate = atoi(str[k+1]);
+		#ifndef RENEWAL_DROP
+			if (battle_config.drop_rateincrease)
+				if (rate < 5000) rate++;
+		#endif
 		if( (class_ >= 1324 && class_ <= 1363) || (class_ >= 1938 && class_ <= 1946) )
 		{	//Treasure box drop rates [Skotlex]
 			rate_adjust = battle_config.item_rate_treasure;

+ 2 - 2
src/map/npc.c

@@ -3830,8 +3830,6 @@ int npc_reload(void) {
 	//Re-read the NPC Script Events cache.
 	npc_read_event_script();
 
-	do_reload_instance();
-
 	/* refresh guild castle flags on both woe setups */
 	npc_event_doall("OnAgitInit");
 	npc_event_doall("OnAgitInit2");
@@ -3839,6 +3837,8 @@ int npc_reload(void) {
 	//Execute the OnInit event for freshly loaded npcs. [Skotlex]
 	ShowStatus("Event '"CL_WHITE"OnInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n",npc_event_doall("OnInit"));
 
+	do_reload_instance();
+
 	// Execute rest of the startup events if connected to char-server. [Lance]
 	if(!CheckForCharServer()){
 		ShowStatus("Event '"CL_WHITE"OnInterIfInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc_event_doall("OnInterIfInit"));