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 | |
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
-rw-r--r-- | Changelog.txt | 4 | ||||
-rw-r--r-- | conf-tmpl/atcommand_athena.conf | 4 | ||||
-rw-r--r-- | src/map/atcommand.c | 158 | ||||
-rw-r--r-- | src/map/atcommand.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 17 |
5 files changed, 185 insertions, 0 deletions
diff --git a/Changelog.txt b/Changelog.txt index c89d03821..51e85e8d3 100644 --- a/Changelog.txt +++ b/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. diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index f0add1f2e..e65219fa4 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/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 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; +} /*========================================== * diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 6f199cf2b..396261a9c 100644 --- a/src/map/atcommand.h +++ b/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, diff --git a/src/map/clif.c b/src/map/clif.c index e44222baf..ac7261b79 100644 --- a/src/map/clif.c +++ b/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); + + } /*========================================== |