Migrated all getmonsterinfo constants to source exports
Created the respective enum on source side and changed the script doc to only refer to the constants not the direct values. Additionally adjusted the sample script.
This commit is contained in:
parent
a68ab0c88d
commit
28e337127e
24
db/const.txt
24
db/const.txt
@ -468,30 +468,6 @@ IG_Sanctuary_Lucky_Egg 450
|
||||
IG_Cyborg_Lucky_Egg 451
|
||||
IG_Undine_Lucky_Egg 452
|
||||
|
||||
MOB_NAME 0
|
||||
MOB_LV 1
|
||||
MOB_MAXHP 2
|
||||
MOB_BASEEXP 3
|
||||
MOB_JOBEXP 4
|
||||
MOB_ATK1 5
|
||||
MOB_ATK2 6
|
||||
MOB_DEF 7
|
||||
MOB_MDEF 8
|
||||
MOB_STR 9
|
||||
MOB_AGI 10
|
||||
MOB_VIT 11
|
||||
MOB_INT 12
|
||||
MOB_DEX 13
|
||||
MOB_LUK 14
|
||||
MOB_RANGE 15
|
||||
MOB_RANGE2 16
|
||||
MOB_RANGE3 17
|
||||
MOB_SIZE 18
|
||||
MOB_RACE 19
|
||||
MOB_ELEMENT 20
|
||||
MOB_MODE 21
|
||||
MOB_MVPEXP 22
|
||||
|
||||
EF_NONE -1
|
||||
EF_HIT1 0
|
||||
EF_HIT2 1
|
||||
|
@ -17,7 +17,7 @@ prontera,156,179,6 script test_getmonsterinfo 117,{
|
||||
}
|
||||
mes "Monster ID: "+.@value+" '"+getmonsterinfo(.@value,MOB_NAME)+"'";
|
||||
mes "Current Monster info:";
|
||||
for (.@i = 0; .@i < 23; .@i++)
|
||||
for (.@i = MOB_NAME; .@i <= MOB_MVPEXP; .@i++)
|
||||
mes " getmonsterinfo("+.@value+","+.@i+") = "+getmonsterinfo(.@value,.@i);
|
||||
close;
|
||||
}
|
@ -3255,32 +3255,31 @@ mob database and return the info set by TYPE argument.
|
||||
It will return -1 if there is no such monster (or the type value is invalid),
|
||||
or "null" if you requested the monster's name.
|
||||
|
||||
Valid types are listed in 'db/const.txt':
|
||||
MOB_NAME 0
|
||||
MOB_LV 1
|
||||
MOB_MAXHP 2
|
||||
MOB_BASEEXP 3
|
||||
MOB_JOBEXP 4
|
||||
MOB_ATK1 5
|
||||
MOB_ATK2 6
|
||||
MOB_DEF 7
|
||||
MOB_MDEF 8
|
||||
MOB_STR 9
|
||||
MOB_AGI 10
|
||||
MOB_VIT 11
|
||||
MOB_INT 12
|
||||
MOB_DEX 13
|
||||
MOB_LUK 14
|
||||
MOB_RANGE 15
|
||||
MOB_RANGE2 16
|
||||
MOB_RANGE3 17
|
||||
MOB_SIZE 18
|
||||
MOB_RACE 19
|
||||
MOB_ELEMENT 20
|
||||
MOB_MODE 21
|
||||
MOB_MVPEXP 22
|
||||
Valid types are:
|
||||
MOB_NAME - monster's name, if there is no such monster "null" is returned
|
||||
MOB_LV - monster's level
|
||||
MOB_MAXHP - monster's maximum hp
|
||||
MOB_BASEEXP - monster's base experience
|
||||
MOB_JOBEXP - monster's job experience
|
||||
MOB_ATK1 - monster's atk
|
||||
MOB_ATK2 - monster's atk2
|
||||
MOB_DEF - monster's def
|
||||
MOB_MDEF - monster's mdef
|
||||
MOB_STR - monster's str
|
||||
MOB_AGI - monster's agi
|
||||
MOB_VIT - monster's vit
|
||||
MOB_INT - monster's int
|
||||
MOB_DEX - monster's dex
|
||||
MOB_LUK - monster's luk
|
||||
MOB_RANGE - monster's range
|
||||
MOB_RANGE2 - monster's range2
|
||||
MOB_RANGE3 - monster's range3
|
||||
MOB_SIZE - monster's size
|
||||
MOB_RACE - monster's race
|
||||
MOB_ELEMENT - monster's element(doesn't return the element level, only the element ID)
|
||||
MOB_MODE - monster's mode
|
||||
MOB_MVPEXP - monster's mvp experience
|
||||
|
||||
Note: MOB_ELEMENT doesn't return the element level, only the element ID.
|
||||
For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
|
||||
|
||||
---------------------------------------
|
||||
|
@ -16474,7 +16474,7 @@ BUILDIN_FUNC(getmonsterinfo)
|
||||
mob_id = script_getnum(st,2);
|
||||
if (!mobdb_checkid(mob_id)) {
|
||||
//ShowError("buildin_getmonsterinfo: Wrong Monster ID: %i\n", mob_id);
|
||||
if ( !script_getnum(st,3) ) //requested a string
|
||||
if ( script_getnum(st,3) == MOB_NAME ) // requested the name
|
||||
script_pushconststr(st,"null");
|
||||
else
|
||||
script_pushint(st,-1);
|
||||
@ -16482,29 +16482,29 @@ BUILDIN_FUNC(getmonsterinfo)
|
||||
}
|
||||
mob = mob_db(mob_id);
|
||||
switch ( script_getnum(st,3) ) {
|
||||
case 0: script_pushstrcopy(st,mob->jname); break;
|
||||
case 1: script_pushint(st,mob->lv); break;
|
||||
case 2: script_pushint(st,mob->status.max_hp); break;
|
||||
case 3: script_pushint(st,mob->base_exp); break;
|
||||
case 4: script_pushint(st,mob->job_exp); break;
|
||||
case 5: script_pushint(st,mob->status.rhw.atk); break;
|
||||
case 6: script_pushint(st,mob->status.rhw.atk2); break;
|
||||
case 7: script_pushint(st,mob->status.def); break;
|
||||
case 8: script_pushint(st,mob->status.mdef); break;
|
||||
case 9: script_pushint(st,mob->status.str); break;
|
||||
case 10: script_pushint(st,mob->status.agi); break;
|
||||
case 11: script_pushint(st,mob->status.vit); break;
|
||||
case 12: script_pushint(st,mob->status.int_); break;
|
||||
case 13: script_pushint(st,mob->status.dex); break;
|
||||
case 14: script_pushint(st,mob->status.luk); break;
|
||||
case 15: script_pushint(st,mob->status.rhw.range); break;
|
||||
case 16: script_pushint(st,mob->range2); break;
|
||||
case 17: script_pushint(st,mob->range3); break;
|
||||
case 18: script_pushint(st,mob->status.size); break;
|
||||
case 19: script_pushint(st,mob->status.race); break;
|
||||
case 20: script_pushint(st,mob->status.def_ele); break;
|
||||
case 21: script_pushint(st,mob->status.mode); break;
|
||||
case 22: script_pushint(st,mob->mexp); break;
|
||||
case MOB_NAME: script_pushstrcopy(st,mob->jname); break;
|
||||
case MOB_LV: script_pushint(st,mob->lv); break;
|
||||
case MOB_MAXHP: script_pushint(st,mob->status.max_hp); break;
|
||||
case MOB_BASEEXP: script_pushint(st,mob->base_exp); break;
|
||||
case MOB_JOBEXP: script_pushint(st,mob->job_exp); break;
|
||||
case MOB_ATK1: script_pushint(st,mob->status.rhw.atk); break;
|
||||
case MOB_ATK2: script_pushint(st,mob->status.rhw.atk2); break;
|
||||
case MOB_DEF: script_pushint(st,mob->status.def); break;
|
||||
case MOB_MDEF: script_pushint(st,mob->status.mdef); break;
|
||||
case MOB_STR: script_pushint(st,mob->status.str); break;
|
||||
case MOB_AGI: script_pushint(st,mob->status.agi); break;
|
||||
case MOB_VIT: script_pushint(st,mob->status.vit); break;
|
||||
case MOB_INT: script_pushint(st,mob->status.int_); break;
|
||||
case MOB_DEX: script_pushint(st,mob->status.dex); break;
|
||||
case MOB_LUK: script_pushint(st,mob->status.luk); break;
|
||||
case MOB_RANGE: script_pushint(st,mob->status.rhw.range); break;
|
||||
case MOB_RANGE2: script_pushint(st,mob->range2); break;
|
||||
case MOB_RANGE3: script_pushint(st,mob->range3); break;
|
||||
case MOB_SIZE: script_pushint(st,mob->status.size); break;
|
||||
case MOB_RACE: script_pushint(st,mob->status.race); break;
|
||||
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;
|
||||
default: script_pushint(st,-1); //wrong Index
|
||||
}
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
@ -297,6 +297,32 @@ enum script_parse_options {
|
||||
SCRIPT_RETURN_EMPTY_SCRIPT = 0x4// returns the script object instead of NULL for empty scripts
|
||||
};
|
||||
|
||||
enum monsterinfo_types {
|
||||
MOB_NAME = 0,
|
||||
MOB_LV,
|
||||
MOB_MAXHP,
|
||||
MOB_BASEEXP,
|
||||
MOB_JOBEXP,
|
||||
MOB_ATK1,
|
||||
MOB_ATK2,
|
||||
MOB_DEF,
|
||||
MOB_MDEF,
|
||||
MOB_STR,
|
||||
MOB_AGI,
|
||||
MOB_VIT,
|
||||
MOB_INT,
|
||||
MOB_DEX,
|
||||
MOB_LUK,
|
||||
MOB_RANGE,
|
||||
MOB_RANGE2,
|
||||
MOB_RANGE3,
|
||||
MOB_SIZE,
|
||||
MOB_RACE,
|
||||
MOB_ELEMENT,
|
||||
MOB_MODE,
|
||||
MOB_MVPEXP
|
||||
};
|
||||
|
||||
enum petinfo_types {
|
||||
PETINFO_ID = 0,
|
||||
PETINFO_CLASS,
|
||||
|
@ -2539,6 +2539,31 @@
|
||||
export_constant(A_CANNONBALL);
|
||||
export_constant(A_THROWWEAPON);
|
||||
|
||||
/* monsterinfo types */
|
||||
export_constant(MOB_NAME);
|
||||
export_constant(MOB_LV);
|
||||
export_constant(MOB_MAXHP);
|
||||
export_constant(MOB_BASEEXP);
|
||||
export_constant(MOB_JOBEXP);
|
||||
export_constant(MOB_ATK1);
|
||||
export_constant(MOB_ATK2);
|
||||
export_constant(MOB_DEF);
|
||||
export_constant(MOB_MDEF);
|
||||
export_constant(MOB_STR);
|
||||
export_constant(MOB_AGI);
|
||||
export_constant(MOB_VIT);
|
||||
export_constant(MOB_INT);
|
||||
export_constant(MOB_DEX);
|
||||
export_constant(MOB_LUK);
|
||||
export_constant(MOB_RANGE);
|
||||
export_constant(MOB_RANGE2);
|
||||
export_constant(MOB_RANGE3);
|
||||
export_constant(MOB_SIZE);
|
||||
export_constant(MOB_RACE);
|
||||
export_constant(MOB_ELEMENT);
|
||||
export_constant(MOB_MODE);
|
||||
export_constant(MOB_MVPEXP);
|
||||
|
||||
/* petinfo types */
|
||||
export_constant(PETINFO_ID);
|
||||
export_constant(PETINFO_CLASS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user