Explorar o código

* Added small and big mob sprite spawning. [Valaris]
-Added @monstersmall and @monstersmall commands.
-For using in scripts, use id +2000 for small and id +4000 for big.
(Example: 3002 for small poring and 5002 for big poring)

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

valaris %!s(int64=20) %!d(string=hai) anos
pai
achega
342cbebbd1
Modificáronse 5 ficheiros con 185 adicións e 0 borrados
  1. 4 0
      Changelog.txt
  2. 4 0
      conf-tmpl/atcommand_athena.conf
  3. 158 0
      src/map/atcommand.c
  4. 2 0
      src/map/atcommand.h
  5. 17 0
      src/map/clif.c

+ 4 - 0
Changelog.txt

@@ -1,5 +1,9 @@
 Date	Added
 11/15
+	* Added small and big mob sprite spawning. [Valaris]
+	  -Added @monstersmall and @monstersmall commands.
+	  -For using in scripts, use id +2000 for small and id +4000 for big.
+	   (Example: 3002 for small poring and 5002 for big poring)
 	* Added mobs_level_up option. [Valaris]
 	  -Everytime a monster kills a play their level will increase and show levelup animation.
 	  -Their 6 main stats and speed will increase as they level.

+ 4 - 0
conf-tmpl/atcommand_athena.conf

@@ -307,6 +307,10 @@ spawn: 50
 monster: 50
 summon: 50
 
+// Spawns monster in small or big size.
+monstersmall: 50
+monsterbig: 50
+
 // Spawns a monster with parameters not in same order of @spawn.
 monster2: 50
 

+ 158 - 0
src/map/atcommand.c

@@ -80,6 +80,8 @@ ATCOMMAND_FUNC(gvgon);
 ATCOMMAND_FUNC(model);
 ATCOMMAND_FUNC(go);
 ATCOMMAND_FUNC(monster);
+ATCOMMAND_FUNC(monstersmall);
+ATCOMMAND_FUNC(monsterbig);
 ATCOMMAND_FUNC(spawn);
 ATCOMMAND_FUNC(killmonster);
 ATCOMMAND_FUNC(killmonster2);
@@ -289,6 +291,8 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_Spawn,				"@spawn",			50, atcommand_spawn },
 //	{ AtCommand_Spawn,				"@summon",			50, atcommand_spawn },
 	{ AtCommand_Monster,			"@monster2",		50, atcommand_monster },
+	{ AtCommand_MonsterSmall,               "@monstersmall",         50, atcommand_monstersmall },
+	{ AtCommand_MonsterBig,               "@monsterbig",         50, atcommand_monsterbig },
 	{ AtCommand_KillMonster,		"@killmonster",		60, atcommand_killmonster },
 	{ AtCommand_KillMonster2,		"@killmonster2",	40, atcommand_killmonster2 },
 	{ AtCommand_Refine,				"@refine",			60, atcommand_refine },
@@ -2949,6 +2953,160 @@ int atcommand_spawn(
 
 	return 0;
 }
+// small monster spawning [Valaris]
+int atcommand_monstersmall(
+	const int fd, struct map_session_data* sd,
+	const char* command, const char* message) {
+	char name[100] = "";
+	char monster[100] = "";
+	int mob_id = 0;
+	int number = 0;
+	int x = 0;
+	int y = 0;
+	int count;
+	int i;
+
+	nullpo_retr(-1, sd);
+
+	if (!message || !*message) {
+		clif_displaymessage(fd, "Give a monster name/id please.");
+		return 0;
+	}
+
+	if (sscanf(message, "\"%[^\"]\" %99s %d %d %d", name, monster, &number, &x, &y) < 2 &&
+	    sscanf(message, "%99s \"%[^\"]\" %d %d %d", monster, name, &number, &x, &y) < 2 &&
+	    sscanf(message, "%99s %d %99s %d %d", monster, &number, name, &x, &y) < 1) {
+		clif_displaymessage(fd, "Give a monster name/id please.");
+		return 0;
+	}
+
+	// If monster identifier/name argument is a name
+	if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)
+		mob_id = atoi(monster);
+
+	if (mob_id == 0) {
+		clif_displaymessage(fd, "Monster name hasn't been found.");
+		return 0;
+	}
+
+	if (mob_id == 1288) {
+		clif_displaymessage(fd, "Cannot spawn emperium.");
+		return 0;
+	}
+
+	if (mob_id > 2000) {
+		clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID.
+		return 0;
+	}
+
+	if (number <= 0)
+		number = 1;
+
+	if (strlen(name) < 1)
+		strcpy(name, "--ja--");
+
+	// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
+	if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit)
+		number = battle_config.atc_spawn_quantity_limit;
+
+	count = 0;
+	for (i = 0; i < number; i++) {
+		int mx, my;
+		if (x <= 0)
+			mx = sd->bl.x + (rand() % 11 - 5);
+		else
+			mx = x;
+		if (y <= 0)
+			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+2000, 1, "") != 0) ? 1 : 0;
+	}
+
+	if (count != 0)
+		clif_displaymessage(fd, msg_table[39]); // Monster Summoned!!
+	else
+		clif_displaymessage(fd, msg_table[40]); // Invalid Monster ID.
+
+	return 0;
+}
+// big monster spawning [Valaris]
+int atcommand_monsterbig(
+	const int fd, struct map_session_data* sd,
+	const char* command, const char* message) {
+	char name[100] = "";
+	char monster[100] = "";
+	int mob_id = 0;
+	int number = 0;
+	int x = 0;
+	int y = 0;
+	int count;
+	int i;
+
+	nullpo_retr(-1, sd);
+
+	if (!message || !*message) {
+		clif_displaymessage(fd, "Give a monster name/id please.");
+		return 0;
+	}
+
+	if (sscanf(message, "\"%[^\"]\" %99s %d %d %d", name, monster, &number, &x, &y) < 2 &&
+	    sscanf(message, "%99s \"%[^\"]\" %d %d %d", monster, name, &number, &x, &y) < 2 &&
+	    sscanf(message, "%99s %d %99s %d %d", monster, &number, name, &x, &y) < 1) {
+		clif_displaymessage(fd, "Give a monster name/id please.");
+		return 0;
+	}
+
+	// If monster identifier/name argument is a name
+	if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)
+		mob_id = atoi(monster);
+
+	if (mob_id == 0) {
+		clif_displaymessage(fd, "Monster name hasn't been found.");
+		return 0;
+	}
+
+	if (mob_id == 1288) {
+		clif_displaymessage(fd, "Cannot spawn emperium.");
+		return 0;
+	}
+
+	if (mob_id > 2000) {
+		clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID.
+		return 0;
+	}
+
+	if (number <= 0)
+		number = 1;
+
+	if (strlen(name) < 1)
+		strcpy(name, "--ja--");
+
+	// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
+	if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit)
+		number = battle_config.atc_spawn_quantity_limit;
+
+	count = 0;
+	for (i = 0; i < number; i++) {
+		int mx, my;
+		if (x <= 0)
+			mx = sd->bl.x + (rand() % 11 - 5);
+		else
+			mx = x;
+		if (y <= 0)
+			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+4000, 1, "") != 0) ? 1 : 0;
+	}
+
+	if (count != 0)
+		clif_displaymessage(fd, msg_table[39]); // Monster Summoned!!
+	else
+		clif_displaymessage(fd, msg_table[40]); // Invalid Monster ID.
+
+	return 0;
+}
 
 /*==========================================
  *

+ 2 - 0
src/map/atcommand.h

@@ -54,6 +54,8 @@ enum AtCommandType {
 	AtCommand_Go,
 	AtCommand_Spawn,
 	AtCommand_Monster,
+	AtCommand_MonsterSmall,
+	AtCommand_MonsterBig,
 	AtCommand_KillMonster,
 	AtCommand_KillMonster2,
 	AtCommand_Refine,

+ 17 - 0
src/map/clif.c

@@ -1363,6 +1363,11 @@ int clif_spawnmob(struct mob_data *md)
 	if (mob_get_equip(md->class) > 0) // mob equipment [Valaris]
 		clif_mob_equip(md,mob_get_equip(md->class));
 
+	if(md->size==2) // tiny/big mobs [Valaris]
+		clif_specialeffect(&md->bl,423,0);
+	else if(md->size==1)
+		clif_specialeffect(&md->bl,421,0);
+
 	return 0;
 }
 
@@ -3570,6 +3575,11 @@ int clif_movemob(struct mob_data *md)
 	if(mob_get_equip(md->class) > 0) // mob equipment [Valaris]
 		clif_mob_equip(md,mob_get_equip(md->class));
 
+	if(md->size==2) // tiny/big mobs [Valaris]
+		clif_specialeffect(&md->bl,423,0);
+	else if(md->size==1)
+		clif_specialeffect(&md->bl,421,0);
+
 	return 0;
 }
 
@@ -3720,6 +3730,13 @@ void clif_getareachar_mob(struct map_session_data* sd,struct mob_data* md)
 
 	if(mob_get_equip(md->class) > 0) // mob equipment [Valaris]
 		clif_mob_equip(md,mob_get_equip(md->class));
+
+	if(md->size==2) // tiny/big mobs [Valaris]
+		clif_specialeffect(&md->bl,423,0);
+	else if(md->size==1)
+		clif_specialeffect(&md->bl,421,0);
+	
+
 }
 
 /*==========================================