summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-17 00:57:42 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-17 00:57:42 +0000
commitd687aeea66fc315611127a757a80b708bd66270e (patch)
tree528d101d4a9baf204b9840ab16c211b409ee775e /src/map
parent29390f511f5b6340a11c2f33ba5746e91f94616e (diff)
downloadhercules-d687aeea66fc315611127a757a80b708bd66270e.tar.gz
hercules-d687aeea66fc315611127a757a80b708bd66270e.tar.bz2
hercules-d687aeea66fc315611127a757a80b708bd66270e.tar.xz
hercules-d687aeea66fc315611127a757a80b708bd66270e.zip
- Changed the npc_id mismatch warning to be more informative.
- Modified @monster command to use map_search_freecell (prevents mobs spawning on non-walkable tiles) - Modified @nuke to invoke skill_cast_nodamage_id instead of the damage_id version (fixes sprite and splash damage for the skill) - Corrected Venom Knife's requiring two knives per use. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6124 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c38
-rw-r--r--src/map/npc.c2
2 files changed, 13 insertions, 27 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d32d0fa66..d6a7e12ef 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3386,10 +3386,9 @@ int atcommand_monster(
char monster[NAME_LENGTH];
int mob_id;
int number = 0;
- int x = 0, y = 0;
int count;
- int i, j, k;
- int mx, my, range;
+ int i, k, range;
+ short mx, my;
nullpo_retr(-1, sd);
memset(name, '\0', sizeof(name));
@@ -3400,14 +3399,14 @@ int atcommand_monster(
clif_displaymessage(fd, msg_table[80]); // Give a display name and monster name/id please.
return -1;
}
- if (sscanf(message, "\"%23[^\"]\" %23s %d %d %d", name, monster, &number, &x, &y) > 1 ||
- sscanf(message, "%23s \"%23[^\"]\" %d %d %d", monster, name, &number, &x, &y) > 1) {
+ if (sscanf(message, "\"%23[^\"]\" %23s %d", name, monster, &number) > 1 ||
+ sscanf(message, "%23s \"%23[^\"]\" %d", monster, name, &number) > 1) {
//All data can be left as it is.
- } else if ((count=sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y)) > 1) {
+ } else if ((count=sscanf(message, "%23s %d %23s", monster, &number, name)) > 1) {
//Here, it is possible name was not given and we are using monster for it.
if (count < 3) //Blank mob's name.
name[0] = '\0';
- } else if (sscanf(message, "%23s %23s %d %d %d", name, monster, &number, &x, &y) > 1) {
+ } else if (sscanf(message, "%23s %23s %d", name, monster, &number) > 1) {
//All data can be left as it is.
} else if (sscanf(message, "%23s", monster) > 0) {
//As before, name may be already filled.
@@ -3437,29 +3436,17 @@ int atcommand_monster(
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)
+ if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit)
number = battle_config.atc_spawn_quantity_limit;
if (battle_config.etc_log)
- ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, x, y);
+ ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y);
count = 0;
- range = (int)sqrt(number) / 2;
- range = range * 2 + 5; // calculation of an odd number (+ 4 area around)
+ range = (int)sqrt(number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
- j = 0;
- k = 0;
- while(j++ < 8 && k == 0) { // try 8 times to spawn the monster (needed for close area)
- if (x <= 0)
- mx = sd->bl.x + (rand() % range - (range / 2));
- else
- mx = x;
- if (y <= 0)
- my = sd->bl.y + (rand() % range - (range / 2));
- else
- my = y;
- k = mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id, 1, "");
- }
+ map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
+ k = mob_once_spawn(sd, "this", mx, my, name, mob_id, 1, "");
count += (k != 0) ? 1 : 0;
}
@@ -6005,8 +5992,7 @@ int atcommand_nuke(
if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) {
if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can kill only lower or same GM level
- clif_skill_nodamage(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, -1, 1);
- skill_castend_damage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0);
+ skill_castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0);
clif_displaymessage(fd, msg_table[109]); // Player has been nuked!
} else {
clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
diff --git a/src/map/npc.c b/src/map/npc.c
index a5014de51..f09a4a367 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1072,7 +1072,7 @@ int npc_scriptcont(struct map_session_data *sd,int id)
nullpo_retr(1, sd);
if (id!=sd->npc_id){
- ShowWarning("npc_scriptcont: sd->npc_id is not id.\n");
+ ShowWarning("npc_scriptcont: sd->npc_id (%d) is not id (%d).\n", sd->npc_id, id);
return 1;
}
if (npc_checknear(sd,id)){