Jump to content
  • 0

implemen spesialitemdrop.patch on last rev


LearningRO

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  778
  • Reputation:   73
  • Joined:  02/10/12
  • Last Seen:  

somebody can help me to make spesialitemdrop.patch for last rev because in last rev have different

structure
Index: mob.c
===================================================================
--- mob.c	(revision 14722)
+++ mob.c	(working copy)
@@ -65,7 +65,7 @@
 
 static struct eri *item_drop_ers; //For loot drops delay structures.
 static struct eri *item_drop_list_ers;
-
+int ind_drop[32000];//[Ind/ro-resources.net] - Change it to whatever your max item db is...
 static struct {
 	int qty;
 	int class_[350];
@@ -3613,7 +3613,9 @@
 			break;
 		}
 		db->dropitem[i].p = mob_drop_adjust(rate, rate_adjust, ratemin, ratemax);
-		
+		if ( ind_drop[db->dropitem[i].nameid] ) { //[Ind/ro-resources.net]
+			db->dropitem[i].p = ind_drop[db->dropitem[i].nameid] * 10;
+		}
 		//calculate and store Max available drop chance of the item
 		if( db->dropitem[i].p && (class_ < 1324 || class_ > 1363) && (class_ < 1938 || class_ > 1946) )
 		{ //Skip treasure chests.
@@ -3637,7 +3639,64 @@
 	
 	return true;
 }
-
+//[Ind/ro-resources.net]
+static bool ind_parse_drop(char** str) {
+	int itemid = atoi(str[0]);
+	int ratio = atoi(str[1]);
+	if( itemid == 0 )
+		return false; //???
+	if( itemdb_exists(itemid) == NULL )
+		return false; //???
+	if( ratio <= 0 )
+		return false;// what the fuck.
+	if( ratio > 10000 ) {
+		ratio = 10000;//100% and relay a warning. - HELLO SOMEONE TYPO'D
+		ShowWarning("[RR] itemID %d drop ratio is higher than 10k",itemid);
+	}
+	ind_drop[ itemid ] = ratio;//add.
+	return true;
+}
+void ind_mob_specdrop(void) {
+		uint32 lines = 0, count = 0;
+		char line[1024];
+		char path[256];
+		FILE* fp;
+		sprintf(path, "%s/ind_item_drop.txt", db_path);
+		fp = fopen(path, "r");
+		if(fp == NULL) {
+			ShowWarning("[RR] Failed to process fopen request in db/ind_item_drop.txt");
+			return;
+		}
+		
+		// process rows one by one
+		while(fgets(line, sizeof(line), fp))
+		{
+			char *str[2], *p, *np;
+			int i;
+			
+			lines++;
+			if(line[0] == '/' && line[1] == '/')
+				continue;
+			for(i = 0, p = line; i < 2; i++)
+			{
+				str[i] = p;
+				if((np = strchr(p, ',')) != NULL) {
+					*np = '\0'; p = np + 1;
+				}
+			}
+			if(i < 2) {
+				ShowWarning("ind_mob_specdrop: Insufficient columns for itemID: %d, skipping.\n", atoi(str[0]));
+				continue;
+			}
+			
+			if (!ind_parse_drop(str))
+				continue;	
+			count++;
+		}
+		fclose(fp);
+		ShowStatus("[RR] Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"ind_item_drop.txt"CL_RESET"'.\n", count);
+	return;
+}
 /*==========================================
  * mob_db.txt reading
  *------------------------------------------*/
@@ -4265,6 +4324,8 @@
 
 static void mob_load(void)
 {
+	//[Ind/ro-resources.net]
+	ind_mob_specdrop();
 #ifndef TXT_ONLY
 	if(db_use_sqldbs)
 		mob_read_sqldb();
@@ -4282,7 +4343,9 @@
 void mob_reload(void)
 {
 	int i;
-
+	//[Ind/ro-resources.net] drops need to be rehashed before reloading.
+	for(i = 0; i < 32000; i++)
+		if( ind_drop[ i ] ) ind_drop[ i ] = 0;
 	//Mob skills need to be cleared before re-reading them. [Skotlex]
 	for (i = 0; i < MAX_MOB_DB; i++)
 		if (mob_db_data[i])

 

ex: 

on old Rev : db->dropitem.p = mob_drop_adjust(rate, rate_adjust, ratemin, ratemax);

on las rev : rate = mob_drop_adjust( rate, rate_adjust, battle_config.item_drop_mvp_min, battle_config.item_drop_mvp_max );

 

 

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  778
  • Reputation:   73
  • Joined:  02/10/12
  • Last Seen:  

sory for bump :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...