summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-03 03:35:42 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-03 03:35:42 +0000
commit7bb91031c6b244781f6637dc87dafa5835326888 (patch)
tree0b762a50ccba3c0c83bb53b106726d8341963215 /src/map/npc.c
parent4e2dfb05f4cd0743b4b49d2c9c9b9422fa8603e5 (diff)
downloadhercules-7bb91031c6b244781f6637dc87dafa5835326888.tar.gz
hercules-7bb91031c6b244781f6637dc87dafa5835326888.tar.bz2
hercules-7bb91031c6b244781f6637dc87dafa5835326888.tar.xz
hercules-7bb91031c6b244781f6637dc87dafa5835326888.zip
- Merged @whereis from my server (displays normal spawn maps for given mobs). This command should be working correctly considering I've been using it since July. I was meant to merge it as soon as I got my hard-drive back, but I kinda forgot @_@
- bonus3 autospell (and autospell when hit) will change the target to self when the skill to be casted is inf&4 (self skill). - Corrected script homevolution not making the homunculus /swt if it is invoked when not loyal. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11110 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 40df4b678..c2ab39446 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2341,6 +2341,7 @@ int npc_parse_mob(char* w1, char* w2, char* w3, char* w4)
char mapname[MAP_NAME_LENGTH_EXT];
char mobname[NAME_LENGTH];
struct spawn_data mob, *data;
+ struct mob_db* db;
memset(&mob, 0, sizeof(struct spawn_data));
@@ -2397,8 +2398,9 @@ int npc_parse_mob(char* w1, char* w2, char* w3, char* w4)
mob.xs = mob.ys = -1;
}
+ db = mob_db(class_);
//Apply the spawn delay fix [Skotlex]
- mode = mob_db(class_)->status.mode;
+ mode = db->status.mode;
if (mode & MD_BOSS) { //Bosses
if (battle_config.boss_spawn_delay != 100)
{ // Divide by 100 first to prevent overflows
@@ -2438,6 +2440,32 @@ int npc_parse_mob(char* w1, char* w2, char* w3, char* w4)
if (!mob_parse_dataset(&mob)) //Verify dataset.
return 1;
+ for(x=0; x < ARRAYLENGTH(db->spawn); x++)
+ {
+ if (map[mob.m].index == db->spawn[x].mapindex)
+ { //Update total
+ db->spawn[x].qty += mob.num;
+ //Re-sort list
+ for (y = x; y>0 && db->spawn[y-1].qty < db->spawn[x].qty; y--);
+ if (y != x)
+ {
+ xs = db->spawn[x].mapindex;
+ ys = db->spawn[x].qty;
+ memmove(&db->spawn[y+1], &db->spawn[y], (x-y)*sizeof(db->spawn[0]));
+ db->spawn[y].mapindex = xs;
+ db->spawn[y].qty = ys;
+ }
+ break;
+ }
+ if (mob.num > db->spawn[x].qty)
+ { //Insert into list
+ memmove(&db->spawn[x+1], &db->spawn[x], sizeof(db->spawn) -(x+1)*sizeof(db->spawn[0]));
+ db->spawn[x].mapindex = map[mob.m].index;
+ db->spawn[x].qty = mob.num;
+ break;
+ }
+ }
+
//Now that all has been validated. We allocate the actual memory
//that the re-spawn data will use.
data = aMalloc(sizeof(struct spawn_data));
@@ -2940,6 +2968,7 @@ int npc_reload(void)
if (map[m].npc_num > 0 && battle_config.error_log)
ShowWarning("npc_reload: %d npcs weren't removed at map %s!\n", map[m].npc_num, map[m].name);
}
+ mob_clear_spawninfo();
// anything else we should cleanup?
// Reloading npc's now