|
@@ -18067,24 +18067,32 @@ BUILDIN_FUNC(delmonsterdrop)
|
|
|
* Returns some values of a monster [Lupus]
|
|
|
* Name, Level, race, size, etc...
|
|
|
getmonsterinfo(monsterID,queryIndex);
|
|
|
+ getmonsterinfo(monsterName,queryIndex);
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(getmonsterinfo)
|
|
|
{
|
|
|
- int mob_id;
|
|
|
+ std::shared_ptr<s_mob_db> mob = nullptr;
|
|
|
|
|
|
- mob_id = script_getnum(st,2);
|
|
|
- if (!mobdb_checkid(mob_id)) {
|
|
|
+ if (script_isstring(st, 2))
|
|
|
+ mob = mobdb_search_aegisname(script_getstr(st, 2));
|
|
|
+ else {
|
|
|
+ uint16 mob_id = script_getnum(st, 2);
|
|
|
+
|
|
|
+ if (!mob_is_clone(mob_id)) {
|
|
|
+ mob = mob_db.find(mob_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mob == nullptr) {
|
|
|
//ShowError("buildin_getmonsterinfo: Wrong Monster ID: %i\n", mob_id);
|
|
|
- if ( script_getnum(st,3) == MOB_NAME ) // requested the name
|
|
|
- script_pushconststr(st,"null");
|
|
|
+ if (script_getnum(st, 3) == MOB_NAME) // requested the name
|
|
|
+ script_pushconststr(st, "null");
|
|
|
else
|
|
|
- script_pushint(st,-1);
|
|
|
+ script_pushint(st, -1);
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
|
- std::shared_ptr<s_mob_db> mob = mob_db.find(mob_id);
|
|
|
-
|
|
|
- switch ( script_getnum(st,3) ) {
|
|
|
+ switch ( script_getnum(st, 3) ) {
|
|
|
case MOB_NAME: script_pushstrcopy(st,mob->jname.c_str()); break;
|
|
|
case MOB_LV: script_pushint(st,mob->lv); break;
|
|
|
case MOB_MAXHP: script_pushint(st,mob->status.max_hp); break;
|
|
@@ -18110,6 +18118,7 @@ BUILDIN_FUNC(getmonsterinfo)
|
|
|
case MOB_ELEMENT: script_pushint(st,mob->status.def_ele); break;
|
|
|
case MOB_MODE: script_pushint(st,mob->status.mode); break;
|
|
|
case MOB_MVPEXP: script_pushint(st,mob->mexp); break;
|
|
|
+ case MOB_ID: script_pushint(st,mob->id); break;
|
|
|
default: script_pushint(st,-1); //wrong Index
|
|
|
}
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
@@ -26724,7 +26733,7 @@ struct script_function buildin_func[] = {
|
|
|
BUILDIN_DEF(setitemscript,"is?"), //Set NEW item bonus script. Lupus
|
|
|
BUILDIN_DEF(disguise,"i?"), //disguise player. Lupus
|
|
|
BUILDIN_DEF(undisguise,"?"), //undisguise player. Lupus
|
|
|
- BUILDIN_DEF(getmonsterinfo,"ii"), //Lupus
|
|
|
+ BUILDIN_DEF(getmonsterinfo,"vi"), //Lupus
|
|
|
BUILDIN_DEF(addmonsterdrop,"vii??"), //Akinari [Lupus]
|
|
|
BUILDIN_DEF(delmonsterdrop,"vi"), //Akinari [Lupus]
|
|
|
BUILDIN_DEF(axtoi,"s"),
|