diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-02-26 21:27:12 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-02-26 21:27:12 +0000 |
commit | 071be58854f037749f5ec160f1a0d50fc41b78eb (patch) | |
tree | 08a389d812e1ad88b84dd9638e2a155c5d948f9a /src/map/mob.c | |
parent | b4b0462ea9eac4718cae3efc099579dcd14f2eed (diff) | |
download | hercules-071be58854f037749f5ec160f1a0d50fc41b78eb.tar.gz hercules-071be58854f037749f5ec160f1a0d50fc41b78eb.tar.bz2 hercules-071be58854f037749f5ec160f1a0d50fc41b78eb.tar.xz hercules-071be58854f037749f5ec160f1a0d50fc41b78eb.zip |
- Fixed item Nemesis.
- Fixed Tarot Card being used on Emperium.
- First Part of BattleGround Implementation (please wait).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13550 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 2691dc45f..634df71ab 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -662,6 +662,51 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam } /*========================================== + * Summoning BattleGround [Zephyrus] + *------------------------------------------*/ +int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int bg_id) +{ + struct mob_data *md = NULL; + struct spawn_data data; + int m; + + if( (m = map_mapname2mapid(mapname)) < 0 ) + { + ShowWarning("mob_spawn_bg: Map [%s] not found.\n", mapname); + return 0; + } + + memset(&data, 0, sizeof(struct spawn_data)); + data.m = m; + data.num = 1; + if( class_ <= 0 ) + { + class_ = mob_get_random_id(-class_-1,1,99); + if( !class_ ) return 0; + } + + data.class_ = class_; + if( (x <= 0 || y <= 0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 0) ) + { + ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, map[m].name); + return 0; + } + + data.x = x; + data.y = y; + safestrncpy(data.name, mobname, sizeof(data.name)); + safestrncpy(data.eventname, event, sizeof(data.eventname)); + if( !mob_parse_dataset(&data) ) + return 0; + + md = mob_spawn_dataset(&data); + mob_spawn(md); + md->state.bg_id = bg_id; // BG Team ID + + return md->bl.id; +} + +/*========================================== * Reachability to a Specification ID existence place * state indicates type of 'seek' mob should do: * - MSS_LOOT: Looking for item, path must be easy. |