Преглед изворни кода

- Cleaned up @grind2
- Updated @monsterbig, @monstersmall to use the event 2 and 4 rather than the max_mob_db code check.
- Modified override_mobs_names to work only on the mob spawn files.


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

skotlex пре 19 година
родитељ
комит
e8e49ec9be
4 измењених фајлова са 25 додато и 9 уклоњено
  1. 4 0
      Changelog-Trunk.txt
  2. 9 7
      src/map/atcommand.c
  3. 2 2
      src/map/mob.c
  4. 10 0
      src/map/npc.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 2006/04/24
+	* Cleaned up @grind2, @monsterbig, @monstersmall. [Skotlex]
+	* Modified override_mobs_names to work only on the mob spawn files instead
+	  of everywhere (so now script-summoned mobs should keep their custom names
+	  intact) [Skotlex]
 	* Added logging of deleted characters when the char_log is enabled.
 	  [Skotlex]
 	* Fixed skill_delayfix not altering delay at all after you reached 150.

+ 9 - 7
src/map/atcommand.c

@@ -3532,7 +3532,7 @@ int atcommand_monstersmall(
 			my = sd->bl.y + (rand() % 11 - 5);
 		else
 			my = y;
-		count += (mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id+MAX_MOB_DB, 1, "") != 0) ? 1 : 0;
+		count += (mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id, 1, "2") != 0) ? 1 : 0;
 	}
 
 	if (count != 0)
@@ -3609,7 +3609,7 @@ int atcommand_monsterbig(
 			my = sd->bl.y + (rand() % 11 - 5);
 		else
 			my = y;
-		count += (mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id+2*MAX_MOB_DB, 1, "") != 0) ? 1 : 0;
+		count += (mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id, 1, "4") != 0) ? 1 : 0;
 	}
 
 	if (count != 0)
@@ -7526,12 +7526,14 @@ int
 atcommand_grind2(const int fd, struct map_session_data* sd,
 	const char* command, const char* message)
 {
-	int i, x, y, id;
+	int i;
+	short x, y;
 
-	for (i =  1000; i <2000; i++) {
-		x = sd->bl.x + (rand() % 10 - 5);
-		y = sd->bl.y + (rand() % 10 - 5);
-		id = mob_once_spawn(sd, "this", x, y, "--ja--", i, 1, "");
+	for (i = 1000; i < MAX_MOB_DB; i++) {
+		if (!mobdb_checkid(i))
+			continue;
+		map_search_freecell(&sd->bl, 0, &x,  &y, 5, 5, 0);
+		mob_once_spawn(sd, "this", x, y, "--ja--", i, 1, "");
 	}
 
 	return 0;

+ 2 - 2
src/map/mob.c

@@ -174,9 +174,9 @@ int mob_parse_dataset(struct spawn_data *data) {
 	if (!data->level)
 		data->level = mob_db(data->class_)->lv;
 
-	if(battle_config.override_mob_names==1 || strcmp(data->name,"--en--")==0)
+	if(strcmp(data->name,"--en--")==0)
 		strncpy(data->name,mob_db(data->class_)->name,NAME_LENGTH-1);
-	else if(battle_config.override_mob_names==2 || strcmp(data->name,"--ja--")==0)
+	else if(strcmp(data->name,"--ja--")==0)
 		strncpy(data->name,mob_db(data->class_)->jname,NAME_LENGTH-1);
 
 	return 1;

+ 10 - 0
src/map/npc.c

@@ -2175,7 +2175,17 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
 		return 1;
 	}
 
+	//Use db names instead of the spawn file ones.
+	if(battle_config.override_mob_names==1)
+		strcpy(mob.name,"--en--");
+	else if (battle_config.override_mob_names==2)
+		strcpy(mob.name,"--ja--");
+	else
+		strncpy(data->name,mob_db(data->class_)->jname,NAME_LENGTH-1);
+
+
 	strncpy(mob.name, mobname, NAME_LENGTH-1);
+
 	if (!mob_parse_dataset(&mob)) //Verify dataset.
 		return 1;