diff options
author | valaris <valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-15 08:15:30 +0000 |
---|---|---|
committer | valaris <valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-15 08:15:30 +0000 |
commit | aa2ac66b46df3fd890f5d2288ec9cc423b6172be (patch) | |
tree | 59e86b29c8511e4bc4727ab4dd16f4a64ba7aba0 /src/map/atcommand.c | |
parent | c161174bedba0cb6d6200b667ef7d245dfcb46d6 (diff) | |
download | hercules-aa2ac66b46df3fd890f5d2288ec9cc423b6172be.tar.gz hercules-aa2ac66b46df3fd890f5d2288ec9cc423b6172be.tar.bz2 hercules-aa2ac66b46df3fd890f5d2288ec9cc423b6172be.tar.xz hercules-aa2ac66b46df3fd890f5d2288ec9cc423b6172be.zip |
* 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://rathena.svn.sourceforge.net/svnroot/rathena/athena@188 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ecdec12d9..6edbeba69 100644 --- a/src/map/atcommand.c +++ b/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; +} /*========================================== * |