|
@@ -10935,6 +10935,7 @@ BUILDIN_FUNC(guildchangegm)
|
|
|
/*==========================================
|
|
|
* Spawn a monster:
|
|
|
* *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
|
|
|
+ * *monster "<map name>",<x>,<y>,"<name to show>","<mob name>",<amount>{,"<event label>",<size>,<ai>};
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(monster)
|
|
|
{
|
|
@@ -10942,7 +10943,7 @@ BUILDIN_FUNC(monster)
|
|
|
int x = script_getnum(st,3);
|
|
|
int y = script_getnum(st,4);
|
|
|
const char* str = script_getstr(st,5);
|
|
|
- int class_ = script_getnum(st,6);
|
|
|
+ int class_;
|
|
|
int amount = script_getnum(st,7);
|
|
|
const char* event = "";
|
|
|
unsigned int size = SZ_SMALL;
|
|
@@ -10952,6 +10953,26 @@ BUILDIN_FUNC(monster)
|
|
|
int16 m;
|
|
|
int i;
|
|
|
|
|
|
+ if( script_isstring( st, 6 ) ){
|
|
|
+ const char* name = script_getstr( st, 6 );
|
|
|
+
|
|
|
+ std::shared_ptr<s_mob_db> mob = mobdb_search_aegisname( name );
|
|
|
+
|
|
|
+ if( mob == nullptr ){
|
|
|
+ ShowWarning( "buildin_monster: Attempted to spawn non-existing monster \"%s\"\n", name );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
+ class_ = mob->id;
|
|
|
+ }else{
|
|
|
+ class_ = script_getnum( st, 6 );
|
|
|
+
|
|
|
+ if( class_ >= 0 && !mobdb_checkid( class_ ) ){
|
|
|
+ ShowWarning( "buildin_monster: Attempted to spawn non-existing monster class %d\n", class_ );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (script_hasdata(st, 8)) {
|
|
|
event = script_getstr(st, 8);
|
|
|
check_event(st, event);
|
|
@@ -10973,11 +10994,6 @@ BUILDIN_FUNC(monster)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (class_ >= 0 && !mobdb_checkid(class_)) {
|
|
|
- ShowWarning("buildin_monster: Attempted to spawn non-existing monster class %d\n", class_);
|
|
|
- return SCRIPT_CMD_FAILURE;
|
|
|
- }
|
|
|
-
|
|
|
sd = map_id2sd(st->rid);
|
|
|
|
|
|
if (sd && strcmp(mapn, "this") == 0)
|
|
@@ -11044,7 +11060,7 @@ BUILDIN_FUNC(areamonster)
|
|
|
int x1 = script_getnum(st,5);
|
|
|
int y1 = script_getnum(st,6);
|
|
|
const char* str = script_getstr(st,7);
|
|
|
- int class_ = script_getnum(st,8);
|
|
|
+ int class_;
|
|
|
int amount = script_getnum(st,9);
|
|
|
const char* event = "";
|
|
|
unsigned int size = SZ_SMALL;
|
|
@@ -11054,6 +11070,26 @@ BUILDIN_FUNC(areamonster)
|
|
|
int16 m;
|
|
|
int i;
|
|
|
|
|
|
+ if( script_isstring( st, 8 ) ){
|
|
|
+ const char* name = script_getstr( st, 8 );
|
|
|
+
|
|
|
+ std::shared_ptr<s_mob_db> mob = mobdb_search_aegisname( name );
|
|
|
+
|
|
|
+ if( mob == nullptr ){
|
|
|
+ ShowWarning( "buildin_areamonster: Attempted to spawn non-existing monster \"%s\"\n", name );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
+ class_ = mob->id;
|
|
|
+ }else{
|
|
|
+ class_ = script_getnum( st, 8 );
|
|
|
+
|
|
|
+ if( class_ >= 0 && !mobdb_checkid( class_ ) ){
|
|
|
+ ShowWarning( "buildin_areamonster: Attempted to spawn non-existing monster class %d\n", class_ );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (script_hasdata(st,10)) {
|
|
|
event = script_getstr(st, 10);
|
|
|
check_event(st, event);
|
|
@@ -11062,7 +11098,7 @@ BUILDIN_FUNC(areamonster)
|
|
|
if (script_hasdata(st, 11)) {
|
|
|
size = script_getnum(st, 11);
|
|
|
if (size > 3) {
|
|
|
- ShowWarning("buildin_monster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_);
|
|
|
+ ShowWarning( "buildin_areamonster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_ );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
}
|
|
@@ -11070,16 +11106,11 @@ BUILDIN_FUNC(areamonster)
|
|
|
if (script_hasdata(st, 12)) {
|
|
|
ai = static_cast<enum mob_ai>(script_getnum(st, 12));
|
|
|
if (ai >= AI_MAX) {
|
|
|
- ShowWarning("buildin_monster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_);
|
|
|
+ ShowWarning( "buildin_areamonster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_ );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (class_ >= 0 && !mobdb_checkid(class_)) {
|
|
|
- ShowWarning("buildin_monster: Attempted to spawn non-existing monster class %d\n", class_);
|
|
|
- return SCRIPT_CMD_FAILURE;
|
|
|
- }
|
|
|
-
|
|
|
sd = map_id2sd(st->rid);
|
|
|
|
|
|
if (sd && strcmp(mapn, "this") == 0)
|
|
@@ -21839,13 +21870,12 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
|
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
|
- * areamobuseskill "Map Name",<x>,<y>,<range>,<Mob ID>,"Skill Name"/<Skill ID>,<Skill Lv>,<Cast Time>,<Cancelable>,<Emotion>,<Target Type>;
|
|
|
+ * areamobuseskill "<Map Name>",<x>,<y>,<range>,"<Mob name>"/<Mob ID>,"<Skill Name>"/<Skill ID>,<Skill Lv>,<Cast Time>,<Cancelable>,<Emotion>,<Target Type>;
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(areamobuseskill)
|
|
|
{
|
|
|
struct block_list center;
|
|
|
int16 m;
|
|
|
- int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
|
|
|
|
|
|
if( (m = map_mapname2mapid(script_getstr(st,2))) < 0 ) {
|
|
|
ShowError("areamobuseskill: invalid map name.\n");
|
|
@@ -21855,8 +21885,31 @@ BUILDIN_FUNC(areamobuseskill)
|
|
|
center.m = m;
|
|
|
center.x = script_getnum(st,3);
|
|
|
center.y = script_getnum(st,4);
|
|
|
- range = script_getnum(st,5);
|
|
|
- mobid = script_getnum(st,6);
|
|
|
+ int range = script_getnum( st,5 );
|
|
|
+ uint16 mobid;
|
|
|
+
|
|
|
+ if( script_isstring( st, 6 ) ){
|
|
|
+ const char* name = script_getstr( st, 6 );
|
|
|
+
|
|
|
+ std::shared_ptr<s_mob_db> mob = mobdb_search_aegisname( name );
|
|
|
+
|
|
|
+ if( mob == nullptr ){
|
|
|
+ ShowWarning( "buildin_areamobuseskill: Attempted to use skill of non-existing monster \"%s\"\n", name );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
+ mobid = mob->id;
|
|
|
+ }else{
|
|
|
+ mobid = script_getnum( st, 6 );
|
|
|
+
|
|
|
+ if( !mob_db.exists( mobid ) ){
|
|
|
+ ShowWarning( "buildin_areamobuseskill: Attempted to use skill of non-existing monster class %d\n", mobid );
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int skill_id;
|
|
|
+
|
|
|
if (script_isstring(st, 7)) {
|
|
|
const char *name = script_getstr(st, 7);
|
|
|
|
|
@@ -21872,13 +21925,17 @@ BUILDIN_FUNC(areamobuseskill)
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
}
|
|
|
- if( (skill_lv = script_getnum(st,8)) > battle_config.mob_max_skilllvl )
|
|
|
+
|
|
|
+ int skill_lv = script_getnum( st, 8 );
|
|
|
+
|
|
|
+ if( skill_lv > battle_config.mob_max_skilllvl ){
|
|
|
skill_lv = battle_config.mob_max_skilllvl;
|
|
|
+ }
|
|
|
|
|
|
- casttime = script_getnum(st,9);
|
|
|
- cancel = script_getnum(st,10);
|
|
|
- emotion = script_getnum(st,11);
|
|
|
- target = script_getnum(st,12);
|
|
|
+ int casttime = script_getnum( st, 9 );
|
|
|
+ int cancel = script_getnum( st, 10 );
|
|
|
+ int emotion = script_getnum( st, 11 );
|
|
|
+ int target = script_getnum( st, 12 );
|
|
|
|
|
|
map_foreachinallrange(buildin_mobuseskill_sub, ¢er, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
@@ -26529,9 +26586,9 @@ struct script_function buildin_func[] = {
|
|
|
BUILDIN_DEF(itemskill,"vi?"),
|
|
|
BUILDIN_DEF(produce,"i"),
|
|
|
BUILDIN_DEF(cooking,"i"),
|
|
|
- BUILDIN_DEF(monster,"siisii???"),
|
|
|
+ BUILDIN_DEF(monster,"siisvi???"),
|
|
|
BUILDIN_DEF(getmobdrops,"i"),
|
|
|
- BUILDIN_DEF(areamonster,"siiiisii???"),
|
|
|
+ BUILDIN_DEF(areamonster,"siiiisvi???"),
|
|
|
BUILDIN_DEF(killmonster,"ss?"),
|
|
|
BUILDIN_DEF(killmonsterall,"s?"),
|
|
|
BUILDIN_DEF(clone,"siisi????"),
|
|
@@ -26836,7 +26893,7 @@ struct script_function buildin_func[] = {
|
|
|
BUILDIN_DEF(mercenary_set_faith,"ii"),
|
|
|
BUILDIN_DEF(readbook,"ii"),
|
|
|
BUILDIN_DEF(setfont,"i"),
|
|
|
- BUILDIN_DEF(areamobuseskill,"siiiiviiiii"),
|
|
|
+ BUILDIN_DEF(areamobuseskill,"siiivviiiii"),
|
|
|
BUILDIN_DEF(progressbar,"si"),
|
|
|
BUILDIN_DEF(progressbar_npc, "si?"),
|
|
|
BUILDIN_DEF(pushpc,"ii"),
|