diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 24bfef7d01..d1fe123146 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -7149,71 +7149,97 @@ Changing a homunculus or pet name will be permanent. This is used to get and set special data related to the unit. With getunitdata, the array given will be filled with the current data. In setunitdata -the indexes in the array would be used to set that data on the unit. +the indexes in the array would be used to set that data on the unit. + +Note: When adjusting a unit's stat (STR, AGI, etc) the unit's respective statuses are + recalculated (HIT, FLEE, etc) automatically. Keep in mind that some stats don't + affect a unit's status and will have to directly be modified. Parameters (indexes) for monsters are: + UMOB_SIZE UMOB_Y UMOB_HAIRSTYLE UMOB_WEAPON UMOB_LUK UMOB_MDEF UMOB_ELELEVEL + UMOB_LEVEL UMOB_SPEED UMOB_HAIRCOLOR UMOB_LOOKDIR UMOB_SLAVECPYMSTRMD UMOB_HIT UMOB_AMOTION + UMOB_HP UMOB_MODE UMOB_HEADBOTTOM UMOB_STR UMOB_DMGIMMUNE UMOB_FLEE UMOB_ADELAY + UMOB_MAXHP UMOB_AI UMOB_HEADMIDDLE UMOB_AGI UMOB_ATKRANGE UMOB_PDODGE UMOB_DMOTION + UMOB_MASTERAID UMOB_SCOPTION UMOB_HEADTOP UMOB_VIT UMOB_ATK UMOB_CRIT + UMOB_MAPID UMOB_SEX UMOB_CLOTHCOLOR UMOB_INT UMOB_MATK UMOB_RACE + UMOB_X UMOB_CLASS UMOB_SHIELD UMOB_DEX UMOB_DEF UMOB_ELETYPE - 0 - size (big, small, normal) 7 - y 14 - hair style 21 - weapon 28 - LUK - 1 - level 8 - speed 15 - hair color 22 - looking dir 29 - for slave to copy master's mode - 2 - HP 9 - mode 16 - head gear bottom 23 - STR 30 - immune from attacks state - 3 - max HP 10 - special AI state 17 - head gear middle 24 - AGI - 4 - master AID 11 - SC option 18 - head gear top 25 - VIT - 5 - map ID 12 - sex 19 - cloth color 26 - INT - 6 - x 13 - class (Monster ID, Job ID) 20 - shield 27 - DEX +----- Parameter (indexes) for homunculi are: + UHOM_SIZE UHOM_MAPID UHOM_CANMOVETICK UHOM_DMGIMMUNE UHOM_FLEE UHOM_ADELAY + UHOM_LEVEL UHOM_X UHOM_STR UHOM_ATKRANGE UHOM_PDODGE UHOM_DMOTION + UHOM_HP UHOM_Y UHOM_AGI UHOM_ATK UHOM_CRIT + UHOM_MAXHP UHOM_HUNGER UHOM_VIT UHOM_MATK UHOM_RACE + UHOM_SP UHOM_INTIMACY UHOM_INT UHOM_DEF UHOM_ELETYPE + UHOM_MAXSP UHOM_SPEED UHOM_DEX UHOM_MDEF UHOM_ELELEVEL + UHOM_MASTERCID UHOM_LOOKDIR UHOM_LUK UHOM_HIT UHOM_AMOTION - 0 - size (big, small, normal) 7 - map ID 14 - canmove_tick 21 - immune from attacks state - 1 - level 8 - x 15 - STR - 2 - HP 9 - y 16 - AGI - 3 - max HP 10 - hunger 17 - VIT - 4 - SP 11 - intimacy 18 - INT - 5 - max SP 12 - speed 19 - DEX - 6 - master Character ID 13 - looking dir 20 - LUK +----- Parameter (indexes) for pets are: + UPET_SIZE UPET_Y UPET_AGI UPET_ATK UPET_CRIT + UPET_LEVEL UPET_HUNGER UPET_VIT UPET_MATK UPET_RACE + UPET_HP UPET_INTIMACY UPET_INT UPET_DEF UPET_ELETYPE + UPET_MAXHP UPET_SPEED UPET_DEX UPET_MDEF UPET_ELELEVEL + UPET_MASTERAID UPET_LOOKDIR UPET_LUK UPET_HIT UPET_AMOTION + UPET_MAPID UPET_CANMOVETICK UPET_DMGIMMUNE UPET_FLEE UPET_ADELAY + UPET_X UPET_STR UPET_ATKRANGE UPET_PDODGE UPET_DMOTION - 0 - size (big, small, normal) 7 - y 14 - AGI - 1 - level 8 - hunger 15 - VIT - 2 - HP 9 - intimacy 16 - INT - 3 - max HP 10 - speed 17 - DEX - 4 - master AID 11 - looking dir 18 - LUK - 5 - map ID 12 - canmove_tick 19 - immune from attacks state - 6 - x 13 - STR +----- Parameter (indexes) for mercenaries are: + UMER_SIZE UMER_KILLCOUNT UMER_VIT UMER_MATK UMER_RACE + UMER_HP UMER_LIFETIME UMER_INT UMER_DEF UMER_ELETYPE + UMER_MAXHP UMER_SPEED UMER_DEX UMER_MDEF UMER_ELELEVEL + UMER_MASTERCID UMER_LOOKDIR UMER_LUK UMER_HIT UMER_AMOTION + UMER_MAPID UMER_CANMOVETICK UMER_DMGIMMUNE UMER_FLEE UMER_ADELAY + UMER_X UMER_STR UMER_ATKRANGE UMER_PDODGE UMER_DMOTION + UMER_Y UMER_AGI UMER_ATK UMER_CRIT - 0 - size (big, small, normal) 7 - kill count 14 - VIT - 1 - HP 8 - life time 15 - INT - 2 - max HP 9 - speed 16 - DEX - 3 - master Character ID 10 - looking dir 17 - LUK - 4 - map ID 11 - canmove_tick 18 - immune from attacks state - 5 - x 12 - STR - 6 - y 13 - AGI +----- Parameter (indexes) for elementals are: + UELE_SIZE UELE_X UELE_STR UELE_ATKRANGE UELE_PDODGE UELE_DMOTION + UELE_HP UELE_Y UELE_AGI UELE_ATK UELE_CRIT + UELE_MAXHP UELE_LIFETIME UELE_VIT UELE_MATK UELE_RACE + UELE_SP UELE_MODE UELE_INT UELE_DEF UELE_ELETYPE + UELE_MAXSP UELE_SPEED UELE_DEX UELE_MDEF UELE_ELELEVEL + UELE_MASTERCID UELE_LOOKDIR UELE_LUK UELE_HIT UELE_AMOTION + UELE_MAPID UELE_CANMOVETICK UELE_DMGIMMUNE UELE_FLEE ELE_ADELAY - 0 - size (big, small, normal) 7 - x 14 - STR - 1 - HP 8 - y 15 - AGI - 2 - max HP 9 - life time 16 - VIT - 3 - SP 10 - mode 17 - INT - 4 - max SP 11 - speed 18 - DEX - 5 - master Character ID 12 - looking dir 19 - LUK - 6 - map ID 13 - canmove_tick 20 - immune from attacks state +----- Parameter (indexes) for NPCs are: + UNPC_DISPLAY UNPC_LOOKDIR UNPC_PLUSALLSTAT UNPC_HIT UNPC_AMOTION + UNPC_LEVEL UNPC_STR UNPC_DMGIMMUNE UNPC_FLEE UNPC_ADELAY + UNPC_HP UNPC_AGI UNPC_ATKRANGE UNPC_PDODGE UNPC_DMOTION + UNPC_MAXHP UNPC_VIT UNPC_ATK UNPC_CRIT + UNPC_MAPID UNPC_INT UNPC_MATK UNPC_RACE + UNPC_X UNPC_DEX UNPC_DEF UNPC_ELETYPE + UNPC_Y UNPC_LUK UNPC_MDEF UNPC_ELELEVEL - 0 - display 7 - looking dir - 1 - level 8 - STR - 2 - HP 9 - AGI - 3 - max HP 10 - VIT - 4 - map ID 11 - INT - 5 - x 12 - DEX - 6 - y 13 - LUK +*Notes: + - *_SIZE: small (0); medium (1); large (2) + - *_MAPID: this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c) + -- For 'setunitdata', map name can also be passed in as a valid value instead of map ID + - *_SPEED: 20 - 1000 + - *_MODE: see doc/mob_db_mode_list.txt + - *_LOOKDIR: north (0), northwest (1), west (2), etc + - *_CANMOVETICK: seconds * 1000 the unit will be unable to move + - *_DMGIMMUNE: unit will be immune to damage (1), or will receive damage (0) + - *_HUNGER: 0 - 100 + - *_INTIMACY: 0 - 1000 + - *_LIFETIME: seconds * 1000 the unit will be 'alive' for + - *_AMOTION: see doc/mob_db.txt + - *_ADELAY: see doc/mob_db.txt + - *_DMOTION: see doc/mob_db.txt -*Notes: For mode, see doc/mob_db_mode_list.txt - For map ID, this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c) - For 'setunitdata', map name can also be passed in as a valid value instead of map ID + - UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6) + - UMOB_SCOPTION: see the 'Variables' section at the top of this document + - UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0) + + - UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreses all stats by given amount Example: // Spawn some Porings and save the Game ID. @@ -7228,7 +7254,7 @@ Example: getunitdata .GID,@por_arr; // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000). - setunitdata .GID,3,1000; + setunitdata .GID,UMOB_MAXHP,1000; --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 326f3c091f..01002798d3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2291,6 +2291,237 @@ void script_hardcoded_constants(void) { script_set_constant("SCSTART_LOADED",SCSTART_LOADED,false); script_set_constant("SCSTART_NORATEDEF",SCSTART_NORATEDEF,false); script_set_constant("SCSTART_NOICON",SCSTART_NOICON,false); + + /* unit control - mob */ + script_set_constant("UMOB_SIZE",UMOB_SIZE,false); + script_set_constant("UMOB_LEVEL",UMOB_LEVEL,false); + script_set_constant("UMOB_HP",UMOB_HP,false); + script_set_constant("UMOB_MAXHP",UMOB_MAXHP,false); + script_set_constant("UMOB_MASTERAID",UMOB_MASTERAID,false); + script_set_constant("UMOB_MAPID",UMOB_MAPID,false); + script_set_constant("UMOB_X",UMOB_X,false); + script_set_constant("UMOB_Y",UMOB_Y,false); + script_set_constant("UMOB_SPEED",UMOB_SPEED,false); + script_set_constant("UMOB_MODE",UMOB_MODE,false); + script_set_constant("UMOB_AI",UMOB_AI,false); + script_set_constant("UMOB_SCOPTION",UMOB_SCOPTION,false); + script_set_constant("UMOB_SEX",UMOB_SEX,false); + script_set_constant("UMOB_CLASS",UMOB_CLASS,false); + script_set_constant("UMOB_HAIRSTYLE",UMOB_HAIRSTYLE,false); + script_set_constant("UMOB_HAIRCOLOR",UMOB_HAIRCOLOR,false); + script_set_constant("UMOB_HEADBOTTOM",UMOB_HEADBOTTOM,false); + script_set_constant("UMOB_HEADMIDDLE",UMOB_HEADMIDDLE,false); + script_set_constant("UMOB_HEADTOP",UMOB_HEADTOP,false); + script_set_constant("UMOB_CLOTHCOLOR",UMOB_CLOTHCOLOR,false); + script_set_constant("UMOB_SHIELD",UMOB_SHIELD,false); + script_set_constant("UMOB_WEAPON",UMOB_WEAPON,false); + script_set_constant("UMOB_LOOKDIR",UMOB_LOOKDIR,false); + script_set_constant("UMOB_STR",UMOB_STR,false); + script_set_constant("UMOB_AGI",UMOB_AGI,false); + script_set_constant("UMOB_VIT",UMOB_VIT,false); + script_set_constant("UMOB_INT",UMOB_INT,false); + script_set_constant("UMOB_DEX",UMOB_DEX,false); + script_set_constant("UMOB_LUK",UMOB_LUK,false); + script_set_constant("UMOB_SLAVECPYMSTRMD",UMOB_SLAVECPYMSTRMD,false); + script_set_constant("UMOB_DMGIMMUNE",UMOB_DMGIMMUNE,false); + script_set_constant("UMOB_ATKRANGE",UMOB_ATKRANGE,false); + script_set_constant("UMOB_ATK",UMOB_ATK,false); + script_set_constant("UMOB_MATK",UMOB_MATK,false); + script_set_constant("UMOB_DEF",UMOB_DEF,false); + script_set_constant("UMOB_MDEF",UMOB_MDEF,false); + script_set_constant("UMOB_HIT",UMOB_HIT,false); + script_set_constant("UMOB_FLEE",UMOB_FLEE,false); + script_set_constant("UMOB_PDODGE",UMOB_PDODGE,false); + script_set_constant("UMOB_CRIT",UMOB_CRIT,false); + script_set_constant("UMOB_RACE",UMOB_RACE,false); + script_set_constant("UMOB_ELETYPE",UMOB_ELETYPE,false); + script_set_constant("UMOB_ELELEVEL",UMOB_ELELEVEL,false); + script_set_constant("UMOB_AMOTION",UMOB_AMOTION,false); + script_set_constant("UMOB_ADELAY",UMOB_ADELAY,false); + script_set_constant("UMOB_DMOTION",UMOB_DMOTION,false); + + /* unit control - homunculus */ + script_set_constant("UHOM_SIZE",UHOM_SIZE,false); + script_set_constant("UHOM_LEVEL",UHOM_LEVEL,false); + script_set_constant("UHOM_HP",UHOM_HP,false); + script_set_constant("UHOM_MAXHP",UHOM_MAXHP,false); + script_set_constant("UHOM_SP",UHOM_SP,false); + script_set_constant("UHOM_MAXSP",UHOM_MAXSP,false); + script_set_constant("UHOM_MASTERCID",UHOM_MASTERCID,false); + script_set_constant("UHOM_MAPID",UHOM_MAPID,false); + script_set_constant("UHOM_X",UHOM_X,false); + script_set_constant("UHOM_Y",UHOM_Y,false); + script_set_constant("UHOM_HUNGER",UHOM_HUNGER,false); + script_set_constant("UHOM_INTIMACY",UHOM_INTIMACY,false); + script_set_constant("UHOM_SPEED",UHOM_SPEED,false); + script_set_constant("UHOM_LOOKDIR",UHOM_LOOKDIR,false); + script_set_constant("UHOM_CANMOVETICK",UHOM_CANMOVETICK,false); + script_set_constant("UHOM_STR",UHOM_STR,false); + script_set_constant("UHOM_AGI",UHOM_AGI,false); + script_set_constant("UHOM_VIT",UHOM_VIT,false); + script_set_constant("UHOM_INT",UHOM_INT,false); + script_set_constant("UHOM_DEX",UHOM_DEX,false); + script_set_constant("UHOM_LUK",UHOM_LUK,false); + script_set_constant("UHOM_DMGIMMUNE",UHOM_DMGIMMUNE,false); + script_set_constant("UHOM_ATKRANGE",UHOM_ATKRANGE,false); + script_set_constant("UHOM_ATK",UHOM_ATK,false); + script_set_constant("UHOM_MATK",UHOM_MATK,false); + script_set_constant("UHOM_DEF",UHOM_DEF,false); + script_set_constant("UHOM_MDEF",UHOM_MDEF,false); + script_set_constant("UHOM_HIT",UHOM_HIT,false); + script_set_constant("UHOM_FLEE",UHOM_FLEE,false); + script_set_constant("UHOM_PDODGE",UHOM_PDODGE,false); + script_set_constant("UHOM_CRIT",UHOM_CRIT,false); + script_set_constant("UHOM_RACE",UHOM_RACE,false); + script_set_constant("UHOM_ELETYPE",UHOM_ELETYPE,false); + script_set_constant("UHOM_ELELEVEL",UHOM_ELELEVEL,false); + script_set_constant("UHOM_AMOTION",UHOM_AMOTION,false); + script_set_constant("UHOM_ADELAY",UHOM_ADELAY,false); + script_set_constant("UHOM_DMOTION",UHOM_DMOTION,false); + + /* unit control - pet */ + script_set_constant("UPET_SIZE",UPET_SIZE,false); + script_set_constant("UPET_LEVEL",UPET_LEVEL,false); + script_set_constant("UPET_HP",UPET_HP,false); + script_set_constant("UPET_MAXHP",UPET_MAXHP,false); + script_set_constant("UPET_MASTERAID",UPET_MASTERAID,false); + script_set_constant("UPET_MAPID",UPET_MAPID,false); + script_set_constant("UPET_X",UPET_X,false); + script_set_constant("UPET_Y",UPET_Y,false); + script_set_constant("UPET_HUNGER",UPET_HUNGER,false); + script_set_constant("UPET_INTIMACY",UPET_INTIMACY,false); + script_set_constant("UPET_SPEED",UPET_SPEED,false); + script_set_constant("UPET_LOOKDIR",UPET_LOOKDIR,false); + script_set_constant("UPET_CANMOVETICK",UPET_CANMOVETICK,false); + script_set_constant("UPET_STR",UPET_STR,false); + script_set_constant("UPET_AGI",UPET_AGI,false); + script_set_constant("UPET_VIT",UPET_VIT,false); + script_set_constant("UPET_INT",UPET_INT,false); + script_set_constant("UPET_DEX",UPET_DEX,false); + script_set_constant("UPET_LUK",UPET_LUK,false); + script_set_constant("UPET_DMGIMMUNE",UPET_DMGIMMUNE,false); + script_set_constant("UPET_ATKRANGE",UPET_ATKRANGE,false); + script_set_constant("UPET_ATK",UPET_ATK,false); + script_set_constant("UPET_MATK",UPET_MATK,false); + script_set_constant("UPET_DEF",UPET_DEF,false); + script_set_constant("UPET_MDEF",UPET_MDEF,false); + script_set_constant("UPET_HIT",UPET_HIT,false); + script_set_constant("UPET_FLEE",UPET_FLEE,false); + script_set_constant("UPET_PDODGE",UPET_PDODGE,false); + script_set_constant("UPET_CRIT",UPET_CRIT,false); + script_set_constant("UPET_RACE",UPET_RACE,false); + script_set_constant("UPET_ELETYPE",UPET_ELETYPE,false); + script_set_constant("UPET_ELELEVEL",UPET_ELELEVEL,false); + script_set_constant("UPET_AMOTION",UPET_AMOTION,false); + script_set_constant("UPET_ADELAY",UPET_ADELAY,false); + script_set_constant("UPET_DMOTION",UPET_DMOTION,false); + + /* unit control - mercenary */ + script_set_constant("UMER_SIZE",UMER_SIZE,false); + script_set_constant("UMER_HP",UMER_HP,false); + script_set_constant("UMER_MAXHP",UMER_MAXHP,false); + script_set_constant("UMER_MASTERCID",UMER_MASTERCID,false); + script_set_constant("UMER_MAPID",UMER_MAPID,false); + script_set_constant("UMER_X",UMER_X,false); + script_set_constant("UMER_Y",UMER_Y,false); + script_set_constant("UMER_KILLCOUNT",UMER_KILLCOUNT,false); + script_set_constant("UMER_LIFETIME",UMER_LIFETIME,false); + script_set_constant("UMER_SPEED",UMER_SPEED,false); + script_set_constant("UMER_LOOKDIR",UMER_LOOKDIR,false); + script_set_constant("UMER_CANMOVETICK",UMER_CANMOVETICK,false); + script_set_constant("UMER_STR",UMER_STR,false); + script_set_constant("UMER_AGI",UMER_AGI,false); + script_set_constant("UMER_VIT",UMER_VIT,false); + script_set_constant("UMER_INT",UMER_INT,false); + script_set_constant("UMER_DEX",UMER_DEX,false); + script_set_constant("UMER_LUK",UMER_LUK,false); + script_set_constant("UMER_DMGIMMUNE",UMER_DMGIMMUNE,false); + script_set_constant("UMER_ATKRANGE",UMER_ATKRANGE,false); + script_set_constant("UMER_ATK",UMER_ATK,false); + script_set_constant("UMER_MATK",UMER_MATK,false); + script_set_constant("UMER_DEF",UMER_DEF,false); + script_set_constant("UMER_MDEF",UMER_MDEF,false); + script_set_constant("UMER_HIT",UMER_HIT,false); + script_set_constant("UMER_FLEE",UMER_FLEE,false); + script_set_constant("UMER_PDODGE",UMER_PDODGE,false); + script_set_constant("UMER_CRIT",UMER_CRIT,false); + script_set_constant("UMER_RACE",UMER_RACE,false); + script_set_constant("UMER_ELETYPE",UMER_ELETYPE,false); + script_set_constant("UMER_ELELEVEL",UMER_ELELEVEL,false); + script_set_constant("UMER_AMOTION",UMER_AMOTION,false); + script_set_constant("UMER_ADELAY",UMER_ADELAY,false); + script_set_constant("UMER_DMOTION",UMER_DMOTION,false); + + /* unit control - elemental */ + script_set_constant("UELE_SIZE",UELE_SIZE,false); + script_set_constant("UELE_HP",UELE_HP,false); + script_set_constant("UELE_MAXHP",UELE_MAXHP,false); + script_set_constant("UELE_SP",UELE_SP,false); + script_set_constant("UELE_MAXSP",UELE_MAXSP,false); + script_set_constant("UELE_MASTERCID",UELE_MASTERCID,false); + script_set_constant("UELE_MAPID",UELE_MAPID,false); + script_set_constant("UELE_X",UELE_X,false); + script_set_constant("UELE_Y",UELE_Y,false); + script_set_constant("UELE_LIFETIME",UELE_LIFETIME,false); + script_set_constant("UELE_MODE",UELE_MODE,false); + script_set_constant("UELE_SPEED",UELE_SPEED,false); + script_set_constant("UELE_LOOKDIR",UELE_LOOKDIR,false); + script_set_constant("UELE_CANMOVETICK",UELE_CANMOVETICK,false); + script_set_constant("UELE_STR",UELE_STR,false); + script_set_constant("UELE_AGI",UELE_AGI,false); + script_set_constant("UELE_VIT",UELE_VIT,false); + script_set_constant("UELE_INT",UELE_INT,false); + script_set_constant("UELE_DEX",UELE_DEX,false); + script_set_constant("UELE_LUK",UELE_LUK,false); + script_set_constant("UELE_DMGIMMUNE",UELE_DMGIMMUNE,false); + script_set_constant("UELE_ATKRANGE",UELE_ATKRANGE,false); + script_set_constant("UELE_ATK",UELE_ATK,false); + script_set_constant("UELE_MATK",UELE_MATK,false); + script_set_constant("UELE_DEF",UELE_DEF,false); + script_set_constant("UELE_MDEF",UELE_MDEF,false); + script_set_constant("UELE_HIT",UELE_HIT,false); + script_set_constant("UELE_FLEE",UELE_FLEE,false); + script_set_constant("UELE_PDODGE",UELE_PDODGE,false); + script_set_constant("UELE_CRIT",UELE_CRIT,false); + script_set_constant("UELE_RACE",UELE_RACE,false); + script_set_constant("UELE_ELETYPE",UELE_ELETYPE,false); + script_set_constant("UELE_ELELEVEL",UELE_ELELEVEL,false); + script_set_constant("UELE_AMOTION",UELE_AMOTION,false); + script_set_constant("UELE_ADELAY",UELE_ADELAY,false); + script_set_constant("UELE_DMOTION",UELE_DMOTION,false); + + /* unit control - NPC */ + script_set_constant("UNPC_DISPLAY",UNPC_DISPLAY,false); + script_set_constant("UNPC_LEVEL",UNPC_LEVEL,false); + script_set_constant("UNPC_HP",UNPC_HP,false); + script_set_constant("UNPC_MAXHP",UNPC_MAXHP,false); + script_set_constant("UNPC_MAPID",UNPC_MAPID,false); + script_set_constant("UNPC_X",UNPC_X,false); + script_set_constant("UNPC_Y",UNPC_Y,false); + script_set_constant("UNPC_LOOKDIR",UNPC_LOOKDIR,false); + script_set_constant("UNPC_STR",UNPC_STR,false); + script_set_constant("UNPC_AGI",UNPC_AGI,false); + script_set_constant("UNPC_VIT",UNPC_VIT,false); + script_set_constant("UNPC_INT",UNPC_INT,false); + script_set_constant("UNPC_DEX",UNPC_DEX,false); + script_set_constant("UNPC_LUK",UNPC_LUK,false); + script_set_constant("UNPC_PLUSALLSTAT",UNPC_PLUSALLSTAT,false); + script_set_constant("UNPC_DMGIMMUNE",UNPC_DMGIMMUNE,false); + script_set_constant("UNPC_ATKRANGE",UNPC_ATKRANGE,false); + script_set_constant("UNPC_ATK",UNPC_ATK,false); + script_set_constant("UNPC_MATK",UNPC_MATK,false); + script_set_constant("UNPC_DEF",UNPC_DEF,false); + script_set_constant("UNPC_MDEF",UNPC_MDEF,false); + script_set_constant("UNPC_HIT",UNPC_HIT,false); + script_set_constant("UNPC_FLEE",UNPC_FLEE,false); + script_set_constant("UNPC_PDODGE",UNPC_PDODGE,false); + script_set_constant("UNPC_CRIT",UNPC_CRIT,false); + script_set_constant("UNPC_RACE",UNPC_RACE,false); + script_set_constant("UNPC_ELETYPE",UNPC_ELETYPE,false); + script_set_constant("UNPC_ELELEVEL",UNPC_ELELEVEL,false); + script_set_constant("UNPC_AMOTION",UNPC_AMOTION,false); + script_set_constant("UNPC_ADELAY",UNPC_ADELAY,false); + script_set_constant("UNPC_DMOTION",UNPC_DMOTION,false); } /*========================================== @@ -16845,37 +17076,52 @@ BUILDIN_FUNC(getunitdata) ShowWarning("buildin_getunitdata: Error in finding object BL_MOB!\n"); return SCRIPT_CMD_FAILURE; } - getunitdata_sub(0, md->status.size); - getunitdata_sub(1, md->level); - getunitdata_sub(2, md->status.hp); - getunitdata_sub(3, md->status.max_hp); - getunitdata_sub(4, md->master_id); - getunitdata_sub(5, md->bl.m); - getunitdata_sub(6, md->bl.x); - getunitdata_sub(7, md->bl.y); - getunitdata_sub(8, md->status.speed); - getunitdata_sub(9, md->status.mode); - getunitdata_sub(10,md->special_state.ai); - getunitdata_sub(11,md->sc.option); - getunitdata_sub(12,md->vd->sex); - getunitdata_sub(13,md->vd->class_); - getunitdata_sub(14,md->vd->hair_style); - getunitdata_sub(15,md->vd->hair_color); - getunitdata_sub(16,md->vd->head_bottom); - getunitdata_sub(17,md->vd->head_mid); - getunitdata_sub(18,md->vd->head_top); - getunitdata_sub(19,md->vd->cloth_color); - getunitdata_sub(20,md->vd->shield); - getunitdata_sub(21,md->vd->weapon); - getunitdata_sub(22,md->ud.dir); - getunitdata_sub(23,md->status.str); - getunitdata_sub(24,md->status.agi); - getunitdata_sub(25,md->status.vit); - getunitdata_sub(26,md->status.int_); - getunitdata_sub(27,md->status.dex); - getunitdata_sub(28,md->status.luk); - getunitdata_sub(29,md->state.copy_master_mode); - getunitdata_sub(30,md->ud.immune_attack); + getunitdata_sub(UMOB_SIZE, md->status.size); + getunitdata_sub(UMOB_LEVEL, md->level); + getunitdata_sub(UMOB_HP, md->status.hp); + getunitdata_sub(UMOB_MAXHP, md->status.max_hp); + getunitdata_sub(UMOB_MASTERAID, md->master_id); + getunitdata_sub(UMOB_MAPID, md->bl.m); + getunitdata_sub(UMOB_X, md->bl.x); + getunitdata_sub(UMOB_Y, md->bl.y); + getunitdata_sub(UMOB_SPEED, md->status.speed); + getunitdata_sub(UMOB_MODE, md->status.mode); + getunitdata_sub(UMOB_AI, md->special_state.ai); + getunitdata_sub(UMOB_SCOPTION, md->sc.option); + getunitdata_sub(UMOB_SEX, md->vd->sex); + getunitdata_sub(UMOB_CLASS, md->vd->class_); + getunitdata_sub(UMOB_HAIRSTYLE, md->vd->hair_style); + getunitdata_sub(UMOB_HAIRCOLOR, md->vd->hair_color); + getunitdata_sub(UMOB_HEADBOTTOM, md->vd->head_bottom); + getunitdata_sub(UMOB_HEADMIDDLE, md->vd->head_mid); + getunitdata_sub(UMOB_HEADTOP, md->vd->head_top); + getunitdata_sub(UMOB_CLOTHCOLOR, md->vd->cloth_color); + getunitdata_sub(UMOB_SHIELD, md->vd->shield); + getunitdata_sub(UMOB_WEAPON, md->vd->weapon); + getunitdata_sub(UMOB_LOOKDIR, md->ud.dir); + getunitdata_sub(UMOB_STR, md->status.str); + getunitdata_sub(UMOB_AGI, md->status.agi); + getunitdata_sub(UMOB_VIT, md->status.vit); + getunitdata_sub(UMOB_INT, md->status.int_); + getunitdata_sub(UMOB_DEX, md->status.dex); + getunitdata_sub(UMOB_LUK, md->status.luk); + getunitdata_sub(UMOB_SLAVECPYMSTRMD, md->state.copy_master_mode); + getunitdata_sub(UMOB_DMGIMMUNE, md->ud.immune_attack); + getunitdata_sub(UMOB_ATKRANGE, md->status.rhw.range); + getunitdata_sub(UMOB_ATK, md->status.rhw.atk); + getunitdata_sub(UMOB_MATK, md->status.rhw.atk2); + getunitdata_sub(UMOB_DEF, md->status.def); + getunitdata_sub(UMOB_MDEF, md->status.mdef); + getunitdata_sub(UMOB_HIT, md->status.hit); + getunitdata_sub(UMOB_FLEE, md->status.flee); + getunitdata_sub(UMOB_PDODGE, md->status.flee2); + getunitdata_sub(UMOB_CRIT, md->status.cri); + getunitdata_sub(UMOB_RACE, md->status.race); + getunitdata_sub(UMOB_ELETYPE, md->status.def_ele); + getunitdata_sub(UMOB_ELELEVEL, md->status.ele_lv); + getunitdata_sub(UMOB_AMOTION, md->status.amotion); + getunitdata_sub(UMOB_ADELAY, md->status.adelay); + getunitdata_sub(UMOB_DMOTION, md->status.dmotion); break; case BL_HOM: @@ -16883,28 +17129,43 @@ BUILDIN_FUNC(getunitdata) ShowWarning("buildin_getunitdata: Error in finding object BL_HOM!\n"); return SCRIPT_CMD_FAILURE; } - getunitdata_sub(0, hd->base_status.size); - getunitdata_sub(1, hd->homunculus.level); - getunitdata_sub(2, hd->homunculus.hp); - getunitdata_sub(3, hd->homunculus.max_hp); - getunitdata_sub(4, hd->homunculus.sp); - getunitdata_sub(5, hd->homunculus.max_sp); - getunitdata_sub(6, hd->homunculus.char_id); - getunitdata_sub(7, hd->bl.m); - getunitdata_sub(8, hd->bl.x); - getunitdata_sub(9, hd->bl.y); - getunitdata_sub(10,hd->homunculus.hunger); - getunitdata_sub(11,hd->homunculus.intimacy); - getunitdata_sub(12,hd->base_status.speed); - getunitdata_sub(13,hd->ud.dir); - getunitdata_sub(14,hd->ud.canmove_tick); - getunitdata_sub(15,hd->base_status.str); - getunitdata_sub(16,hd->base_status.agi); - getunitdata_sub(17,hd->base_status.vit); - getunitdata_sub(18,hd->base_status.int_); - getunitdata_sub(19,hd->base_status.dex); - getunitdata_sub(20,hd->base_status.luk); - getunitdata_sub(21,hd->ud.immune_attack); + getunitdata_sub(UHOM_SIZE, hd->base_status.size); + getunitdata_sub(UHOM_LEVEL, hd->homunculus.level); + getunitdata_sub(UHOM_HP, hd->homunculus.hp); + getunitdata_sub(UHOM_MAXHP, hd->homunculus.max_hp); + getunitdata_sub(UHOM_SP, hd->homunculus.sp); + getunitdata_sub(UHOM_MAXSP, hd->homunculus.max_sp); + getunitdata_sub(UHOM_MASTERCID, hd->homunculus.char_id); + getunitdata_sub(UHOM_MAPID, hd->bl.m); + getunitdata_sub(UHOM_X, hd->bl.x); + getunitdata_sub(UHOM_Y, hd->bl.y); + getunitdata_sub(UHOM_HUNGER, hd->homunculus.hunger); + getunitdata_sub(UHOM_INTIMACY, hd->homunculus.intimacy); + getunitdata_sub(UHOM_SPEED, hd->base_status.speed); + getunitdata_sub(UHOM_LOOKDIR, hd->ud.dir); + getunitdata_sub(UHOM_CANMOVETICK, hd->ud.canmove_tick); + getunitdata_sub(UHOM_STR, hd->base_status.str); + getunitdata_sub(UHOM_AGI, hd->base_status.agi); + getunitdata_sub(UHOM_VIT, hd->base_status.vit); + getunitdata_sub(UHOM_INT, hd->base_status.int_); + getunitdata_sub(UHOM_DEX, hd->base_status.dex); + getunitdata_sub(UHOM_LUK, hd->base_status.luk); + getunitdata_sub(UHOM_DMGIMMUNE, hd->ud.immune_attack); + getunitdata_sub(UHOM_ATKRANGE, hd->battle_status.rhw.range); + getunitdata_sub(UHOM_ATK, hd->battle_status.rhw.atk); + getunitdata_sub(UHOM_MATK, hd->battle_status.rhw.atk2); + getunitdata_sub(UHOM_DEF, hd->battle_status.def); + getunitdata_sub(UHOM_MDEF, hd->battle_status.mdef); + getunitdata_sub(UHOM_HIT, hd->battle_status.hit); + getunitdata_sub(UHOM_FLEE, hd->battle_status.flee); + getunitdata_sub(UHOM_PDODGE, hd->battle_status.flee2); + getunitdata_sub(UHOM_CRIT, hd->battle_status.cri); + getunitdata_sub(UHOM_RACE, hd->battle_status.race); + getunitdata_sub(UHOM_ELETYPE, hd->battle_status.def_ele); + getunitdata_sub(UHOM_ELELEVEL, hd->battle_status.ele_lv); + getunitdata_sub(UHOM_AMOTION, hd->battle_status.amotion); + getunitdata_sub(UHOM_ADELAY, hd->battle_status.adelay); + getunitdata_sub(UHOM_DMOTION, hd->battle_status.dmotion); break; case BL_PET: @@ -16912,26 +17173,41 @@ BUILDIN_FUNC(getunitdata) ShowWarning("buildin_getunitdata: Error in finding object BL_PET!\n"); return SCRIPT_CMD_FAILURE; } - getunitdata_sub(0, pd->status.size); - getunitdata_sub(1, pd->pet.level); - getunitdata_sub(2, pd->status.hp); - getunitdata_sub(3, pd->status.max_hp); - getunitdata_sub(4, pd->pet.account_id); - getunitdata_sub(5, pd->bl.m); - getunitdata_sub(6, pd->bl.x); - getunitdata_sub(7, pd->bl.y); - getunitdata_sub(8, pd->pet.hungry); - getunitdata_sub(9, pd->pet.intimate); - getunitdata_sub(10,pd->status.speed); - getunitdata_sub(11,pd->ud.dir); - getunitdata_sub(12,pd->ud.canmove_tick); - getunitdata_sub(13,pd->status.str); - getunitdata_sub(14,pd->status.agi); - getunitdata_sub(15,pd->status.vit); - getunitdata_sub(16,pd->status.int_); - getunitdata_sub(17,pd->status.dex); - getunitdata_sub(18,pd->status.luk); - getunitdata_sub(19,pd->ud.immune_attack); + getunitdata_sub(UPET_SIZE, pd->status.size); + getunitdata_sub(UPET_LEVEL, pd->pet.level); + getunitdata_sub(UPET_HP, pd->status.hp); + getunitdata_sub(UPET_MAXHP, pd->status.max_hp); + getunitdata_sub(UPET_MASTERAID, pd->pet.account_id); + getunitdata_sub(UPET_MAPID, pd->bl.m); + getunitdata_sub(UPET_X, pd->bl.x); + getunitdata_sub(UPET_Y, pd->bl.y); + getunitdata_sub(UPET_HUNGER, pd->pet.hungry); + getunitdata_sub(UPET_INTIMACY, pd->pet.intimate); + getunitdata_sub(UPET_SPEED, pd->status.speed); + getunitdata_sub(UPET_LOOKDIR, pd->ud.dir); + getunitdata_sub(UPET_CANMOVETICK, pd->ud.canmove_tick); + getunitdata_sub(UPET_STR, pd->status.str); + getunitdata_sub(UPET_AGI, pd->status.agi); + getunitdata_sub(UPET_VIT, pd->status.vit); + getunitdata_sub(UPET_INT, pd->status.int_); + getunitdata_sub(UPET_DEX, pd->status.dex); + getunitdata_sub(UPET_LUK, pd->status.luk); + getunitdata_sub(UPET_DMGIMMUNE, pd->ud.immune_attack); + getunitdata_sub(UPET_ATKRANGE, pd->status.rhw.range); + getunitdata_sub(UPET_ATK, pd->status.rhw.atk); + getunitdata_sub(UPET_MATK, pd->status.rhw.atk2); + getunitdata_sub(UPET_DEF, pd->status.def); + getunitdata_sub(UPET_MDEF, pd->status.mdef); + getunitdata_sub(UPET_HIT, pd->status.hit); + getunitdata_sub(UPET_FLEE, pd->status.flee); + getunitdata_sub(UPET_PDODGE, pd->status.flee2); + getunitdata_sub(UPET_CRIT, pd->status.cri); + getunitdata_sub(UPET_RACE, pd->status.race); + getunitdata_sub(UPET_ELETYPE, pd->status.def_ele); + getunitdata_sub(UPET_ELELEVEL, pd->status.ele_lv); + getunitdata_sub(UPET_AMOTION, pd->status.amotion); + getunitdata_sub(UPET_ADELAY, pd->status.adelay); + getunitdata_sub(UPET_DMOTION, pd->status.dmotion); break; case BL_MER: @@ -16939,25 +17215,40 @@ BUILDIN_FUNC(getunitdata) ShowWarning("buildin_getunitdata: Error in finding object BL_MER!\n"); return SCRIPT_CMD_FAILURE; } - getunitdata_sub(0, mc->base_status.size); - getunitdata_sub(1, mc->base_status.hp); - getunitdata_sub(2, mc->base_status.max_hp); - getunitdata_sub(3, mc->mercenary.char_id); - getunitdata_sub(4, mc->bl.m); - getunitdata_sub(5, mc->bl.x); - getunitdata_sub(6, mc->bl.y); - getunitdata_sub(7, mc->mercenary.kill_count); - getunitdata_sub(8, mc->mercenary.life_time); - getunitdata_sub(9, mc->base_status.speed); - getunitdata_sub(10,mc->ud.dir); - getunitdata_sub(11,mc->ud.canmove_tick); - getunitdata_sub(12,mc->base_status.str); - getunitdata_sub(13,mc->base_status.agi); - getunitdata_sub(14,mc->base_status.vit); - getunitdata_sub(15,mc->base_status.int_); - getunitdata_sub(16,mc->base_status.dex); - getunitdata_sub(17,mc->base_status.luk); - getunitdata_sub(18,mc->ud.immune_attack); + getunitdata_sub(UMER_SIZE, mc->base_status.size); + getunitdata_sub(UMER_HP, mc->base_status.hp); + getunitdata_sub(UMER_MAXHP, mc->base_status.max_hp); + getunitdata_sub(UMER_MASTERCID, mc->mercenary.char_id); + getunitdata_sub(UMER_MAPID, mc->bl.m); + getunitdata_sub(UMER_X, mc->bl.x); + getunitdata_sub(UMER_Y, mc->bl.y); + getunitdata_sub(UMER_KILLCOUNT, mc->mercenary.kill_count); + getunitdata_sub(UMER_LIFETIME, mc->mercenary.life_time); + getunitdata_sub(UMER_SPEED, mc->base_status.speed); + getunitdata_sub(UMER_LOOKDIR, mc->ud.dir); + getunitdata_sub(UMER_CANMOVETICK, mc->ud.canmove_tick); + getunitdata_sub(UMER_STR, mc->base_status.str); + getunitdata_sub(UMER_AGI, mc->base_status.agi); + getunitdata_sub(UMER_VIT, mc->base_status.vit); + getunitdata_sub(UMER_INT, mc->base_status.int_); + getunitdata_sub(UMER_DEX, mc->base_status.dex); + getunitdata_sub(UMER_LUK, mc->base_status.luk); + getunitdata_sub(UMER_DMGIMMUNE, mc->ud.immune_attack); + getunitdata_sub(UMER_ATKRANGE, mc->base_status.rhw.range); + getunitdata_sub(UMER_ATK, mc->base_status.rhw.atk); + getunitdata_sub(UMER_MATK, mc->base_status.rhw.atk2); + getunitdata_sub(UMER_DEF, mc->base_status.def); + getunitdata_sub(UMER_MDEF, mc->base_status.mdef); + getunitdata_sub(UMER_HIT, mc->base_status.hit); + getunitdata_sub(UMER_FLEE, mc->base_status.flee); + getunitdata_sub(UMER_PDODGE, mc->base_status.flee2); + getunitdata_sub(UMER_CRIT, mc->base_status.cri); + getunitdata_sub(UMER_RACE, mc->base_status.race); + getunitdata_sub(UMER_ELETYPE, mc->base_status.def_ele); + getunitdata_sub(UMER_ELELEVEL, mc->base_status.ele_lv); + getunitdata_sub(UMER_AMOTION, mc->base_status.amotion); + getunitdata_sub(UMER_ADELAY, mc->base_status.adelay); + getunitdata_sub(UMER_DMOTION, mc->base_status.dmotion); break; case BL_ELEM: @@ -16965,27 +17256,42 @@ BUILDIN_FUNC(getunitdata) ShowWarning("buildin_getunitdata: Error in finding object BL_ELEM!\n"); return SCRIPT_CMD_FAILURE; } - getunitdata_sub(0, ed->base_status.size); - getunitdata_sub(1, ed->elemental.hp); - getunitdata_sub(2, ed->elemental.max_hp); - getunitdata_sub(3, ed->elemental.sp); - getunitdata_sub(4, ed->elemental.max_sp); - getunitdata_sub(5, ed->elemental.char_id); - getunitdata_sub(6, ed->bl.m); - getunitdata_sub(7, ed->bl.x); - getunitdata_sub(8, ed->bl.y); - getunitdata_sub(9, ed->elemental.life_time); - getunitdata_sub(10,ed->elemental.mode); - getunitdata_sub(11,ed->base_status.speed); - getunitdata_sub(12,ed->ud.dir); - getunitdata_sub(13,ed->ud.canmove_tick); - getunitdata_sub(14,ed->base_status.str); - getunitdata_sub(15,ed->base_status.agi); - getunitdata_sub(16,ed->base_status.vit); - getunitdata_sub(17,ed->base_status.int_); - getunitdata_sub(18,ed->base_status.dex); - getunitdata_sub(19,ed->base_status.luk); - getunitdata_sub(20,ed->ud.immune_attack); + getunitdata_sub(UELE_SIZE, ed->base_status.size); + getunitdata_sub(UELE_HP, ed->elemental.hp); + getunitdata_sub(UELE_MAXHP, ed->elemental.max_hp); + getunitdata_sub(UELE_SP, ed->elemental.sp); + getunitdata_sub(UELE_MAXSP, ed->elemental.max_sp); + getunitdata_sub(UELE_MASTERCID, ed->elemental.char_id); + getunitdata_sub(UELE_MAPID, ed->bl.m); + getunitdata_sub(UELE_X, ed->bl.x); + getunitdata_sub(UELE_Y, ed->bl.y); + getunitdata_sub(UELE_LIFETIME, ed->elemental.life_time); + getunitdata_sub(UELE_MODE, ed->elemental.mode); + getunitdata_sub(UELE_SP, ed->base_status.speed); + getunitdata_sub(UELE_LOOKDIR, ed->ud.dir); + getunitdata_sub(UELE_CANMOVETICK, ed->ud.canmove_tick); + getunitdata_sub(UELE_STR, ed->base_status.str); + getunitdata_sub(UELE_AGI, ed->base_status.agi); + getunitdata_sub(UELE_VIT, ed->base_status.vit); + getunitdata_sub(UELE_INT, ed->base_status.int_); + getunitdata_sub(UELE_DEX, ed->base_status.dex); + getunitdata_sub(UELE_LUK, ed->base_status.luk); + getunitdata_sub(UELE_DMGIMMUNE, ed->ud.immune_attack); + getunitdata_sub(UELE_ATKRANGE, ed->base_status.rhw.range); + getunitdata_sub(UELE_ATK, ed->base_status.rhw.atk); + getunitdata_sub(UELE_MATK, ed->base_status.rhw.atk2); + getunitdata_sub(UELE_DEF, ed->base_status.def); + getunitdata_sub(UELE_MDEF, ed->base_status.mdef); + getunitdata_sub(UELE_HIT, ed->base_status.hit); + getunitdata_sub(UELE_FLEE, ed->base_status.flee); + getunitdata_sub(UELE_PDODGE, ed->base_status.flee2); + getunitdata_sub(UELE_CRIT, ed->base_status.cri); + getunitdata_sub(UELE_RACE, ed->base_status.race); + getunitdata_sub(UELE_ELETYPE, ed->base_status.def_ele); + getunitdata_sub(UELE_ELELEVEL, ed->base_status.ele_lv); + getunitdata_sub(UELE_AMOTION, ed->base_status.amotion); + getunitdata_sub(UELE_ADELAY, ed->base_status.adelay); + getunitdata_sub(UELE_DMOTION, ed->base_status.dmotion); break; case BL_NPC: @@ -16993,20 +17299,37 @@ BUILDIN_FUNC(getunitdata) ShowWarning("buildin_getunitdata: Error in finding object BL_NPC!\n"); return SCRIPT_CMD_FAILURE; } - getunitdata_sub(0, nd->class_); - getunitdata_sub(1, nd->level); - getunitdata_sub(2, nd->status.hp); - getunitdata_sub(3, nd->status.max_hp); - getunitdata_sub(4, nd->bl.m); - getunitdata_sub(5, nd->bl.x); - getunitdata_sub(6, nd->bl.y); - getunitdata_sub(7, nd->ud.dir); - getunitdata_sub(8, nd->status.str); - getunitdata_sub(9, nd->status.agi); - getunitdata_sub(10,nd->status.vit); - getunitdata_sub(11,nd->status.int_); - getunitdata_sub(12,nd->status.dex); - getunitdata_sub(13,nd->status.luk); + getunitdata_sub(UNPC_DISPLAY, nd->class_); + getunitdata_sub(UNPC_LEVEL, nd->level); + getunitdata_sub(UNPC_HP, nd->status.hp); + getunitdata_sub(UNPC_MAXHP, nd->status.max_hp); + getunitdata_sub(UNPC_MAPID, nd->bl.m); + getunitdata_sub(UNPC_X, nd->bl.x); + getunitdata_sub(UNPC_Y, nd->bl.y); + getunitdata_sub(UNPC_LOOKDIR, nd->ud.dir); + getunitdata_sub(UNPC_STR, nd->status.str); + getunitdata_sub(UNPC_AGI, nd->status.agi); + getunitdata_sub(UNPC_VIT, nd->status.vit); + getunitdata_sub(UNPC_INT, nd->status.int_); + getunitdata_sub(UNPC_DEX, nd->status.dex); + getunitdata_sub(UNPC_LUK, nd->status.luk); + getunitdata_sub(UNPC_PLUSALLSTAT, nd->stat_point); + getunitdata_sub(UNPC_DMGIMMUNE, nd->ud.immune_attack); + getunitdata_sub(UNPC_ATKRANGE, nd->status.rhw.range); + getunitdata_sub(UNPC_ATK, nd->status.rhw.atk); + getunitdata_sub(UNPC_MATK, nd->status.rhw.atk2); + getunitdata_sub(UNPC_DEF, nd->status.def); + getunitdata_sub(UNPC_MDEF, nd->status.mdef); + getunitdata_sub(UNPC_HIT, nd->status.hit); + getunitdata_sub(UNPC_FLEE, nd->status.flee); + getunitdata_sub(UNPC_PDODGE, nd->status.flee2); + getunitdata_sub(UNPC_CRIT, nd->status.cri); + getunitdata_sub(UNPC_RACE, nd->status.race); + getunitdata_sub(UNPC_ELETYPE, nd->status.def_ele); + getunitdata_sub(UNPC_ELELEVEL, nd->status.ele_lv); + getunitdata_sub(UNPC_AMOTION, nd->status.amotion); + getunitdata_sub(UNPC_ADELAY, nd->status.adelay); + getunitdata_sub(UNPC_DMOTION, nd->status.dmotion); break; default: @@ -17080,37 +17403,52 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } switch (type) { - case 0: md->status.size = (unsigned char)value; break; - case 1: md->level = (unsigned short)value; break; - case 2: status_set_hp(bl, (unsigned int)value, 0); break; - case 3: status_set_maxhp(bl, (unsigned int)value, 0); break; - case 4: md->master_id = value; break; - case 5: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; - case 6: if (!unit_walktoxy(bl, (short)value, md->bl.y, 2)) unit_movepos(bl, (short)value, md->bl.y, 0, 0); break; - case 7: if (!unit_walktoxy(bl, md->bl.x, (short)value, 2)) unit_movepos(bl, md->bl.x, (short)value, 0, 0); break; - case 8: md->status.speed = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 9: md->status.mode = (enum e_mode)value; status_calc_bl(bl, SCB_MODE); break; - case 10: md->special_state.ai = (enum mob_ai)value; break; - case 11: md->sc.option = (unsigned short)value; break; - case 12: md->vd->sex = (char)value; break; - case 13: status_set_viewdata(bl, (unsigned short)value); break; - case 14: clif_changelook(bl, LOOK_HAIR, (unsigned short)value); break; - case 15: clif_changelook(bl, LOOK_HAIR_COLOR, (unsigned short)value); break; - case 16: clif_changelook(bl, LOOK_HEAD_BOTTOM, (unsigned short)value); break; - case 17: clif_changelook(bl, LOOK_HEAD_MID, (unsigned short)value); break; - case 18: clif_changelook(bl, LOOK_HEAD_TOP, (unsigned short)value); break; - case 19: clif_changelook(bl, LOOK_CLOTHES_COLOR, (unsigned short)value); break; - case 20: clif_changelook(bl, LOOK_SHIELD, (unsigned short)value); break; - case 21: clif_changelook(bl, LOOK_WEAPON, (unsigned short)value); break; - case 22: unit_setdir(bl, (uint8)value); break; - case 23: md->status.str = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 24: md->status.agi = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 25: md->status.vit = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 26: md->status.int_ = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 27: md->status.dex = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 28: md->status.luk = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 29: md->state.copy_master_mode = value > 0 ? 1 : 0; status_calc_bl(bl, SCB_MODE); break; - case 30: md->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UMOB_SIZE: md->status.size = (unsigned char)value; break; + case UMOB_LEVEL: md->level = (unsigned short)value; break; + case UMOB_HP: status_set_hp(bl, (unsigned int)value, 0); clif_charnameack(0, &md->bl); break; + case UMOB_MAXHP: status_set_maxhp(bl, (unsigned int)value, 0); clif_charnameack(0, &md->bl); break; + case UMOB_MASTERAID: md->master_id = value; break; + case UMOB_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; + case UMOB_X: if (!unit_walktoxy(bl, (short)value, md->bl.y, 2)) unit_movepos(bl, (short)value, md->bl.y, 0, 0); break; + case UMOB_Y: if (!unit_walktoxy(bl, md->bl.x, (short)value, 2)) unit_movepos(bl, md->bl.x, (short)value, 0, 0); break; + case UMOB_SPEED: md->status.speed = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_MODE: md->status.mode = (enum e_mode)value; break; + case UMOB_AI: md->special_state.ai = (enum mob_ai)value; break; + case UMOB_SCOPTION: md->sc.option = (unsigned short)value; break; + case UMOB_SEX: md->vd->sex = (char)value; break; + case UMOB_CLASS: status_set_viewdata(bl, (unsigned short)value); break; + case UMOB_HAIRSTYLE: clif_changelook(bl, LOOK_HAIR, (unsigned short)value); break; + case UMOB_HAIRCOLOR: clif_changelook(bl, LOOK_HAIR_COLOR, (unsigned short)value); break; + case UMOB_HEADBOTTOM: clif_changelook(bl, LOOK_HEAD_BOTTOM, (unsigned short)value); break; + case UMOB_HEADMIDDLE: clif_changelook(bl, LOOK_HEAD_MID, (unsigned short)value); break; + case UMOB_HEADTOP: clif_changelook(bl, LOOK_HEAD_TOP, (unsigned short)value); break; + case UMOB_CLOTHCOLOR: clif_changelook(bl, LOOK_CLOTHES_COLOR, (unsigned short)value); break; + case UMOB_SHIELD: clif_changelook(bl, LOOK_SHIELD, (unsigned short)value); break; + case UMOB_WEAPON: clif_changelook(bl, LOOK_WEAPON, (unsigned short)value); break; + case UMOB_LOOKDIR: unit_setdir(bl, (uint8)value); break; + case UMOB_STR: md->status.str = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_AGI: md->status.agi = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_VIT: md->status.vit = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_INT: md->status.int_ = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_DEX: md->status.dex = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_LUK: md->status.luk = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); break; + case UMOB_SLAVECPYMSTRMD: md->state.copy_master_mode = value > 0 ? 1 : 0; if (value > 0) { TBL_MOB *md2 = map_id2md(md->master_id); md->status.mode = md2->status.mode; } break; + case UMOB_DMGIMMUNE: md->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UMOB_ATKRANGE: md->status.rhw.range = (unsigned short)value; break; + case UMOB_ATK: md->status.rhw.atk = (unsigned short)value; break; + case UMOB_MATK: md->status.rhw.atk2 = (unsigned short)value; break; + case UMOB_DEF: md->status.def = (defType)value; break; + case UMOB_MDEF: md->status.mdef = (defType)value; break; + case UMOB_HIT: md->status.hit = (short)value; break; + case UMOB_FLEE: md->status.flee = (short)value; break; + case UMOB_PDODGE: md->status.flee2 = (short)value; break; + case UMOB_CRIT: md->status.cri = (short)value; break; + case UMOB_RACE: md->status.race = (unsigned char)value; break; + case UMOB_ELETYPE: md->status.def_ele = (unsigned char)value; break; + case UMOB_ELELEVEL: md->status.ele_lv = (unsigned char)value; break; + case UMOB_AMOTION: md->status.amotion = (short)value; break; + case UMOB_ADELAY: md->status.adelay = (short)value; break; + case UMOB_DMOTION: md->status.dmotion = (short)value; break; default: ShowError("buildin_setunitdata: Unknown data identifier %d for BL_MOB.\n", type); return SCRIPT_CMD_FAILURE; @@ -17123,28 +17461,43 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } switch (type) { - case 0: hd->base_status.size = (unsigned char)value; break; - case 1: hd->homunculus.level = (unsigned short)value; break; - case 2: status_set_hp(bl, (unsigned int)value, 0); break; - case 3: status_set_maxhp(bl, (unsigned int)value, 0); break; - case 4: status_set_sp(bl, (unsigned int)value, 0); break; - case 5: status_set_maxsp(bl, (unsigned int)value, 0); break; - case 6: hd->homunculus.char_id = (uint32)value; break; - case 7: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; - case 8: if (!unit_walktoxy(bl, (short)value, hd->bl.y, 2)) unit_movepos(bl, (short)value, hd->bl.y, 0, 0); break; - case 9: if (!unit_walktoxy(bl, hd->bl.x, (short)value, 2)) unit_movepos(bl, hd->bl.x, (short)value, 0, 0); break; - case 10: hd->homunculus.hunger = (short)value; clif_send_homdata(map_charid2sd(hd->homunculus.char_id), SP_HUNGRY, hd->homunculus.hunger); break; - case 11: hom_increase_intimacy(hd, (unsigned int)value); clif_send_homdata(map_charid2sd(hd->homunculus.char_id), SP_INTIMATE, hd->homunculus.intimacy / 100); break; - case 12: hd->base_status.speed = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 13: unit_setdir(bl, (uint8)value); break; - case 14: hd->ud.canmove_tick = value > 0 ? 1 : 0; break; - case 15: hd->base_status.str = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 16: hd->base_status.agi = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 17: hd->base_status.vit = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 18: hd->base_status.int_ = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 19: hd->base_status.dex = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 20: hd->base_status.luk = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 21: hd->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UHOM_SIZE: hd->base_status.size = (unsigned char)value; break; + case UHOM_LEVEL: hd->homunculus.level = (unsigned short)value; break; + case UHOM_HP: status_set_hp(bl, (unsigned int)value, 0); break; + case UHOM_MAXHP: status_set_maxhp(bl, (unsigned int)value, 0); break; + case UHOM_SP: status_set_sp(bl, (unsigned int)value, 0); break; + case UHOM_MAXSP: status_set_maxsp(bl, (unsigned int)value, 0); break; + case UHOM_MASTERCID: hd->homunculus.char_id = (uint32)value; break; + case UHOM_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; + case UHOM_X: if (!unit_walktoxy(bl, (short)value, hd->bl.y, 2)) unit_movepos(bl, (short)value, hd->bl.y, 0, 0); break; + case UHOM_Y: if (!unit_walktoxy(bl, hd->bl.x, (short)value, 2)) unit_movepos(bl, hd->bl.x, (short)value, 0, 0); break; + case UHOM_HUNGER: hd->homunculus.hunger = (short)value; clif_send_homdata(map_charid2sd(hd->homunculus.char_id), SP_HUNGRY, hd->homunculus.hunger); break; + case UHOM_INTIMACY: hom_increase_intimacy(hd, (unsigned int)value); clif_send_homdata(map_charid2sd(hd->homunculus.char_id), SP_INTIMATE, hd->homunculus.intimacy / 100); break; + case UHOM_SPEED: hd->base_status.speed = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_LOOKDIR: unit_setdir(bl, (uint8)value); break; + case UHOM_CANMOVETICK: hd->ud.canmove_tick = value > 0 ? (unsigned int)value : 0; break; + case UHOM_STR: hd->base_status.str = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_AGI: hd->base_status.agi = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_VIT: hd->base_status.vit = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_INT: hd->base_status.int_ = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_DEX: hd->base_status.dex = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_LUK: hd->base_status.luk = (unsigned short)value; status_calc_misc(bl, &hd->base_status, hd->homunculus.level); break; + case UHOM_DMGIMMUNE: hd->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UHOM_ATKRANGE: hd->base_status.rhw.range = (unsigned short)value; break; + case UHOM_ATK: hd->base_status.rhw.atk = (unsigned short)value; break; + case UHOM_MATK: hd->base_status.rhw.atk2 = (unsigned short)value; break; + case UHOM_DEF: hd->base_status.def = (defType)value; break; + case UHOM_MDEF: hd->base_status.mdef = (defType)value; break; + case UHOM_HIT: hd->base_status.hit = (short)value; break; + case UHOM_FLEE: hd->base_status.flee = (short)value; break; + case UHOM_PDODGE: hd->base_status.flee2 = (short)value; break; + case UHOM_CRIT: hd->base_status.cri = (short)value; break; + case UHOM_RACE: hd->base_status.race = (unsigned char)value; break; + case UHOM_ELETYPE: hd->base_status.def_ele = (unsigned char)value; break; + case UHOM_ELELEVEL: hd->base_status.ele_lv = (unsigned char)value; break; + case UHOM_AMOTION: hd->base_status.amotion = (short)value; break; + case UHOM_ADELAY: hd->base_status.adelay = (short)value; break; + case UHOM_DMOTION: hd->base_status.dmotion = (short)value; break; default: ShowError("buildin_setunitdata: Unknown data identifier %d for BL_HOM.\n", type); return SCRIPT_CMD_FAILURE; @@ -17157,26 +17510,41 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } switch (type) { - case 0: pd->status.size = (unsigned char)value; break; - case 1: pd->pet.level = (unsigned short)value; break; - case 2: status_set_hp(bl, (unsigned int)value, 0); break; - case 3: status_set_maxhp(bl, (unsigned int)value, 0); break; - case 4: pd->pet.account_id = (unsigned int)value; break; - case 5: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; - case 6: if (!unit_walktoxy(bl, (short)value, pd->bl.y, 2)) unit_movepos(bl, (short)value, md->bl.y, 0, 0); break; - case 7: if (!unit_walktoxy(bl, pd->bl.x, (short)value, 2)) unit_movepos(bl, pd->bl.x, (short)value, 0, 0); break; - case 8: pd->pet.hungry = (short)value; clif_send_petdata(map_id2sd(pd->pet.account_id), pd, 2, pd->pet.hungry); break; - case 9: pet_set_intimate(pd, (unsigned int)value); clif_send_petdata(map_id2sd(pd->pet.account_id), pd, 1, pd->pet.intimate); break; - case 10: pd->status.speed = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 11: unit_setdir(bl, (uint8)value); break; - case 12: pd->ud.canmove_tick = value > 0 ? 1 : 0; break; - case 13: pd->status.str = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 14: pd->status.agi = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 15: pd->status.vit = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 16: pd->status.int_ = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 17: pd->status.dex = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 18: pd->status.luk = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 19: pd->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UPET_SIZE: pd->status.size = (unsigned char)value; break; + case UPET_LEVEL: pd->pet.level = (unsigned short)value; break; + case UPET_HP: status_set_hp(bl, (unsigned int)value, 0); break; + case UPET_MAXHP: status_set_maxhp(bl, (unsigned int)value, 0); break; + case UPET_MASTERAID: pd->pet.account_id = (unsigned int)value; break; + case UPET_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; + case UPET_X: if (!unit_walktoxy(bl, (short)value, pd->bl.y, 2)) unit_movepos(bl, (short)value, md->bl.y, 0, 0); break; + case UPET_Y: if (!unit_walktoxy(bl, pd->bl.x, (short)value, 2)) unit_movepos(bl, pd->bl.x, (short)value, 0, 0); break; + case UPET_HUNGER: pd->pet.hungry = (short)value; clif_send_petdata(map_id2sd(pd->pet.account_id), pd, 2, pd->pet.hungry); break; + case UPET_INTIMACY: pet_set_intimate(pd, (unsigned int)value); clif_send_petdata(map_id2sd(pd->pet.account_id), pd, 1, pd->pet.intimate); break; + case UPET_SPEED: pd->status.speed = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_LOOKDIR: unit_setdir(bl, (uint8)value); break; + case UPET_CANMOVETICK: pd->ud.canmove_tick = value > 0 ? (unsigned int)value : 0; break; + case UPET_STR: pd->status.str = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_AGI: pd->status.agi = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_VIT: pd->status.vit = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_INT: pd->status.int_ = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_DEX: pd->status.dex = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_LUK: pd->status.luk = (unsigned short)value; status_calc_misc(bl, &pd->status, pd->pet.level); break; + case UPET_DMGIMMUNE: pd->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UPET_ATKRANGE: pd->status.rhw.range = (unsigned short)value; break; + case UPET_ATK: pd->status.rhw.atk = (unsigned short)value; break; + case UPET_MATK: pd->status.rhw.atk2 = (unsigned short)value; break; + case UPET_DEF: pd->status.def = (defType)value; break; + case UPET_MDEF: pd->status.mdef = (defType)value; break; + case UPET_HIT: pd->status.hit = (short)value; break; + case UPET_FLEE: pd->status.flee = (short)value; break; + case UPET_PDODGE: pd->status.flee2 = (short)value; break; + case UPET_CRIT: pd->status.cri = (short)value; break; + case UPET_RACE: pd->status.race = (unsigned char)value; break; + case UPET_ELETYPE: pd->status.def_ele = (unsigned char)value; break; + case UPET_ELELEVEL: pd->status.ele_lv = (unsigned char)value; break; + case UPET_AMOTION: pd->status.amotion = (short)value; break; + case UPET_ADELAY: pd->status.adelay = (short)value; break; + case UPET_DMOTION: pd->status.dmotion = (short)value; break; default: ShowError("buildin_setunitdata: Unknown data identifier %d for BL_PET.\n", type); return SCRIPT_CMD_FAILURE; @@ -17189,25 +17557,40 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } switch (type) { - case 0: mc->base_status.size = (unsigned char)value; break; - case 1: status_set_hp(bl, (unsigned int)value, 0); break; - case 2: status_set_maxhp(bl, (unsigned int)value, 0); break; - case 3: mc->mercenary.char_id = (uint32)value; break; - case 4: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; - case 5: if (!unit_walktoxy(bl, (short)value, mc->bl.y, 2)) unit_movepos(bl, (short)value, mc->bl.y, 0, 0); break; - case 6: if (!unit_walktoxy(bl, mc->bl.x, (short)value, 2)) unit_movepos(bl, mc->bl.x, (short)value, 0, 0); break; - case 7: mc->mercenary.kill_count = (unsigned int)value; break; - case 8: mc->mercenary.life_time = (unsigned int)value; break; - case 9: mc->base_status.speed = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 10: unit_setdir(bl, (uint8)value); break; - case 11: mc->ud.canmove_tick = value > 0 ? 1 : 0; break; - case 12: mc->base_status.str = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 13: mc->base_status.agi = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 14: mc->base_status.vit = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 15: mc->base_status.int_ = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 16: mc->base_status.dex = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 17: mc->base_status.luk = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 18: mc->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UMER_SIZE: mc->base_status.size = (unsigned char)value; break; + case UMER_HP: status_set_hp(bl, (unsigned int)value, 0); break; + case UMER_MAXHP: status_set_maxhp(bl, (unsigned int)value, 0); break; + case UMER_MASTERCID: mc->mercenary.char_id = (uint32)value; break; + case UMER_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; + case UMER_X: if (!unit_walktoxy(bl, (short)value, mc->bl.y, 2)) unit_movepos(bl, (short)value, mc->bl.y, 0, 0); break; + case UMER_Y: if (!unit_walktoxy(bl, mc->bl.x, (short)value, 2)) unit_movepos(bl, mc->bl.x, (short)value, 0, 0); break; + case UMER_KILLCOUNT: mc->mercenary.kill_count = (unsigned int)value; break; + case UMER_LIFETIME: mc->mercenary.life_time = (unsigned int)value; break; + case UMER_SPEED: mc->base_status.speed = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_LOOKDIR: unit_setdir(bl, (uint8)value); break; + case UMER_CANMOVETICK: mc->ud.canmove_tick = value > 0 ? (unsigned int)value : 0; break; + case UMER_STR: mc->base_status.str = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_AGI: mc->base_status.agi = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_VIT: mc->base_status.vit = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_INT: mc->base_status.int_ = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_DEX: mc->base_status.dex = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_LUK: mc->base_status.luk = (unsigned short)value; status_calc_misc(bl, &mc->base_status, mc->db->lv); break; + case UMER_DMGIMMUNE: mc->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UMER_ATKRANGE: mc->base_status.rhw.range = (unsigned short)value; break; + case UMER_ATK: mc->base_status.rhw.atk = (unsigned short)value; break; + case UMER_MATK: mc->base_status.rhw.atk2 = (unsigned short)value; break; + case UMER_DEF: mc->base_status.def = (defType)value; break; + case UMER_MDEF: mc->base_status.mdef = (defType)value; break; + case UMER_HIT: mc->base_status.hit = (short)value; break; + case UMER_FLEE: mc->base_status.flee = (short)value; break; + case UMER_PDODGE: mc->base_status.flee2 = (short)value; break; + case UMER_CRIT: mc->base_status.cri = (short)value; break; + case UMER_RACE: mc->base_status.race = (unsigned char)value; break; + case UMER_ELETYPE: mc->base_status.def_ele = (unsigned char)value; break; + case UMER_ELELEVEL: mc->base_status.ele_lv = (unsigned char)value; break; + case UMER_AMOTION: mc->base_status.amotion = (short)value; break; + case UMER_ADELAY: mc->base_status.adelay = (short)value; break; + case UMER_DMOTION: mc->base_status.dmotion = (short)value; break; default: ShowError("buildin_setunitdata: Unknown data identifier %d for BL_MER.\n", type); return SCRIPT_CMD_FAILURE; @@ -17220,27 +17603,42 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } switch (type) { - case 0: ed->base_status.size = (unsigned char)value; break; - case 1: status_set_hp(bl, (unsigned int)value, 0); break; - case 2: status_set_maxhp(bl, (unsigned int)value, 0); break; - case 3: status_set_sp(bl, (unsigned int)value, 0); break; - case 4: status_set_maxsp(bl, (unsigned int)value, 0); break; - case 5: ed->elemental.char_id = (uint32)value; break; - case 6: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; - case 7: if (!unit_walktoxy(bl, (short)value, ed->bl.y, 2)) unit_movepos(bl, (short)value, ed->bl.y, 0, 0); break; - case 8: if (!unit_walktoxy(bl, ed->bl.x, (short)value, 2)) unit_movepos(bl, ed->bl.x, (short)value, 0, 0); break; - case 9: ed->elemental.life_time = (unsigned int)value; break; - case 10: ed->elemental.mode = (unsigned int)value; status_calc_bl(bl, SCB_MODE); break; - case 11: ed->base_status.speed = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 12: unit_setdir(bl, (uint8)value); break; - case 13: ed->ud.canmove_tick = value > 0 ? 1 : 0; break; - case 14: ed->base_status.str = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 15: ed->base_status.agi = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 16: ed->base_status.vit = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 17: ed->base_status.int_ = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 18: ed->base_status.dex = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 19: ed->base_status.luk = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 20: ed->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UELE_SIZE: ed->base_status.size = (unsigned char)value; break; + case UELE_HP: status_set_hp(bl, (unsigned int)value, 0); break; + case UELE_MAXHP: status_set_maxhp(bl, (unsigned int)value, 0); break; + case UELE_SP: status_set_sp(bl, (unsigned int)value, 0); break; + case UELE_MAXSP: status_set_maxsp(bl, (unsigned int)value, 0); break; + case UELE_MASTERCID: ed->elemental.char_id = (uint32)value; break; + case UELE_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; + case UELE_X: if (!unit_walktoxy(bl, (short)value, ed->bl.y, 2)) unit_movepos(bl, (short)value, ed->bl.y, 0, 0); break; + case UELE_Y: if (!unit_walktoxy(bl, ed->bl.x, (short)value, 2)) unit_movepos(bl, ed->bl.x, (short)value, 0, 0); break; + case UELE_LIFETIME: ed->elemental.life_time = (unsigned int)value; break; + case UELE_MODE: ed->elemental.mode = (enum e_mode)value; break; + case UELE_SPEED: ed->base_status.speed = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_LOOKDIR: unit_setdir(bl, (uint8)value); break; + case UELE_CANMOVETICK: ed->ud.canmove_tick = value > 0 ? (unsigned int)value : 0; break; + case UELE_STR: ed->base_status.str = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_AGI: ed->base_status.agi = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_VIT: ed->base_status.vit = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_INT: ed->base_status.int_ = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_DEX: ed->base_status.dex = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_LUK: ed->base_status.luk = (unsigned short)value; status_calc_misc(bl, &ed->base_status, ed->db->lv); break; + case UELE_DMGIMMUNE: ed->ud.immune_attack = (bool)value > 0 ? 1 : 0; break; + case UELE_ATKRANGE: ed->base_status.rhw.range = (unsigned short)value; break; + case UELE_ATK: ed->base_status.rhw.atk = (unsigned short)value; break; + case UELE_MATK: ed->base_status.rhw.atk2 = (unsigned short)value; break; + case UELE_DEF: ed->base_status.def = (defType)value; break; + case UELE_MDEF: ed->base_status.mdef = (defType)value; break; + case UELE_HIT: ed->base_status.hit = (short)value; break; + case UELE_FLEE: ed->base_status.flee = (short)value; break; + case UELE_PDODGE: ed->base_status.flee2 = (short)value; break; + case UELE_CRIT: ed->base_status.cri = (short)value; break; + case UELE_RACE: ed->base_status.race = (unsigned char)value; break; + case UELE_ELETYPE: ed->base_status.def_ele = (unsigned char)value; break; + case UELE_ELELEVEL: ed->base_status.ele_lv = (unsigned char)value; break; + case UELE_AMOTION: ed->base_status.amotion = (short)value; break; + case UELE_ADELAY: ed->base_status.adelay = (short)value; break; + case UELE_DMOTION: ed->base_status.dmotion = (short)value; break; default: ShowError("buildin_setunitdata: Unknown data identifier %d for BL_ELEM.\n", type); return SCRIPT_CMD_FAILURE; @@ -17253,20 +17651,36 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } switch (type) { - case 0: status_set_viewdata(bl, (unsigned short)value); break; - case 1: nd->level = (unsigned int)value; break; - case 2: status_set_hp(bl, (unsigned int)value, 0); break; - case 3: status_set_maxhp(bl, (unsigned int)value, 0); break; - case 4: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; - case 5: if (!unit_walktoxy(bl, (short)value, nd->bl.y, 2)) unit_movepos(bl, (short)value, nd->bl.x, 0, 0); break; - case 6: if (!unit_walktoxy(bl, nd->bl.x, (short)value, 2)) unit_movepos(bl, nd->bl.x, (short)value, 0, 0); break; - case 7: unit_setdir(bl, (uint8)value); break; - case 8: nd->params.str = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 9: nd->params.agi = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 10: nd->params.vit = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 11: nd->params.int_ = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 12: nd->params.dex = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; - case 13: nd->params.luk = (unsigned short)value; status_calc_bl(bl, SCB_ALL); break; + case UNPC_DISPLAY: status_set_viewdata(bl, (unsigned short)value); break; + case UNPC_LEVEL: nd->level = (unsigned int)value; break; + case UNPC_HP: status_set_hp(bl, (unsigned int)value, 0); break; + case UNPC_MAXHP: status_set_maxhp(bl, (unsigned int)value, 0); break; + case UNPC_MAPID: if (mapname) value = map_mapname2mapid(mapname); unit_warp(bl, (short)value, 0, 0, CLR_TELEPORT); break; + case UNPC_X: if (!unit_walktoxy(bl, (short)value, nd->bl.y, 2)) unit_movepos(bl, (short)value, nd->bl.x, 0, 0); break; + case UNPC_Y: if (!unit_walktoxy(bl, nd->bl.x, (short)value, 2)) unit_movepos(bl, nd->bl.x, (short)value, 0, 0); break; + case UNPC_LOOKDIR: unit_setdir(bl, (uint8)value); break; + case UNPC_STR: nd->params.str = (unsigned short)value; status_calc_misc(bl, &nd->status, nd->level); break; + case UNPC_AGI: nd->params.agi = (unsigned short)value; status_calc_misc(bl, &nd->status, nd->level); break; + case UNPC_VIT: nd->params.vit = (unsigned short)value; status_calc_misc(bl, &nd->status, nd->level); break; + case UNPC_INT: nd->params.int_ = (unsigned short)value; status_calc_misc(bl, &nd->status, nd->level); break; + case UNPC_DEX: nd->params.dex = (unsigned short)value; status_calc_misc(bl, &nd->status, nd->level); break; + case UNPC_LUK: nd->params.luk = (unsigned short)value; status_calc_misc(bl, &nd->status, nd->level); break; + case UNPC_PLUSALLSTAT: nd->stat_point = (unsigned int)value; break; + case UNPC_ATKRANGE: nd->status.rhw.range = (unsigned short)value; break; + case UNPC_ATK: nd->status.rhw.atk = (unsigned short)value; break; + case UNPC_MATK: nd->status.rhw.atk2 = (unsigned short)value; break; + case UNPC_DEF: nd->status.def = (defType)value; break; + case UNPC_MDEF: nd->status.mdef = (defType)value; break; + case UNPC_HIT: nd->status.hit = (short)value; break; + case UNPC_FLEE: nd->status.flee = (short)value; break; + case UNPC_PDODGE: nd->status.flee2 = (short)value; break; + case UNPC_CRIT: nd->status.cri = (short)value; break; + case UNPC_RACE: nd->status.race = (unsigned char)value; break; + case UNPC_ELETYPE: nd->status.def_ele = (unsigned char)value; break; + case UNPC_ELELEVEL: nd->status.ele_lv = (unsigned char)value; break; + case UNPC_AMOTION: nd->status.amotion = (short)value; break; + case UNPC_ADELAY: nd->status.adelay = (short)value; break; + case UNPC_DMOTION: nd->status.dmotion = (short)value; break; default: ShowError("buildin_setunitdata: Unknown data identifier %d for BL_NPC.\n", type); return SCRIPT_CMD_FAILURE; @@ -17278,6 +17692,23 @@ BUILDIN_FUNC(setunitdata) return SCRIPT_CMD_FAILURE; } + // Client information updates + switch (bl->type) { + case BL_HOM: + clif_send_homdata(hd->master, SP_ACK, 0); + break; + case BL_PET: + clif_send_petstatus(pd->master); + break; + case BL_MER: + clif_mercenary_info(map_charid2sd(md->master_id)); + clif_mercenary_skillblock(map_charid2sd(md->master_id)); + break; + case BL_ELEM: + clif_elemental_info(ed->master); + break; + } + return SCRIPT_CMD_SUCCESS; } diff --git a/src/map/script.h b/src/map/script.h index 87dc60467d..cd13a20884 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -297,6 +297,243 @@ enum script_parse_options { SCRIPT_RETURN_EMPTY_SCRIPT = 0x4// returns the script object instead of NULL for empty scripts }; +enum unitdata_mobtypes { + UMOB_SIZE = 0, + UMOB_LEVEL, + UMOB_HP, + UMOB_MAXHP, + UMOB_MASTERAID, + UMOB_MAPID, + UMOB_X, + UMOB_Y, + UMOB_SPEED, + UMOB_MODE, + UMOB_AI, + UMOB_SCOPTION, + UMOB_SEX, + UMOB_CLASS, + UMOB_HAIRSTYLE, + UMOB_HAIRCOLOR, + UMOB_HEADBOTTOM, + UMOB_HEADMIDDLE, + UMOB_HEADTOP, + UMOB_CLOTHCOLOR, + UMOB_SHIELD, + UMOB_WEAPON, + UMOB_LOOKDIR, + UMOB_STR, + UMOB_AGI, + UMOB_VIT, + UMOB_INT, + UMOB_DEX, + UMOB_LUK, + UMOB_SLAVECPYMSTRMD, + UMOB_DMGIMMUNE, + UMOB_ATKRANGE, + UMOB_ATK, + UMOB_MATK, + UMOB_DEF, + UMOB_MDEF, + UMOB_HIT, + UMOB_FLEE, + UMOB_PDODGE, + UMOB_CRIT, + UMOB_RACE, + UMOB_ELETYPE, + UMOB_ELELEVEL, + UMOB_AMOTION, + UMOB_ADELAY, + UMOB_DMOTION, +}; + +enum unitdata_homuntypes { + UHOM_SIZE = 0, + UHOM_LEVEL, + UHOM_HP, + UHOM_MAXHP, + UHOM_SP, + UHOM_MAXSP, + UHOM_MASTERCID, + UHOM_MAPID, + UHOM_X, + UHOM_Y, + UHOM_HUNGER, + UHOM_INTIMACY, + UHOM_SPEED, + UHOM_LOOKDIR, + UHOM_CANMOVETICK, + UHOM_STR, + UHOM_AGI, + UHOM_VIT, + UHOM_INT, + UHOM_DEX, + UHOM_LUK, + UHOM_DMGIMMUNE, + UHOM_ATKRANGE, + UHOM_ATK, + UHOM_MATK, + UHOM_DEF, + UHOM_MDEF, + UHOM_HIT, + UHOM_FLEE, + UHOM_PDODGE, + UHOM_CRIT, + UHOM_RACE, + UHOM_ELETYPE, + UHOM_ELELEVEL, + UHOM_AMOTION, + UHOM_ADELAY, + UHOM_DMOTION, +}; + +enum unitdata_pettypes { + UPET_SIZE = 0, + UPET_LEVEL, + UPET_HP, + UPET_MAXHP, + UPET_MASTERAID, + UPET_MAPID, + UPET_X, + UPET_Y, + UPET_HUNGER, + UPET_INTIMACY, + UPET_SPEED, + UPET_LOOKDIR, + UPET_CANMOVETICK, + UPET_STR, + UPET_AGI, + UPET_VIT, + UPET_INT, + UPET_DEX, + UPET_LUK, + UPET_DMGIMMUNE, + UPET_ATKRANGE, + UPET_ATK, + UPET_MATK, + UPET_DEF, + UPET_MDEF, + UPET_HIT, + UPET_FLEE, + UPET_PDODGE, + UPET_CRIT, + UPET_RACE, + UPET_ELETYPE, + UPET_ELELEVEL, + UPET_AMOTION, + UPET_ADELAY, + UPET_DMOTION, +}; + +enum unitdata_merctypes { + UMER_SIZE = 0, + UMER_HP, + UMER_MAXHP, + UMER_MASTERCID, + UMER_MAPID, + UMER_X, + UMER_Y, + UMER_KILLCOUNT, + UMER_LIFETIME, + UMER_SPEED, + UMER_LOOKDIR, + UMER_CANMOVETICK, + UMER_STR, + UMER_AGI, + UMER_VIT, + UMER_INT, + UMER_DEX, + UMER_LUK, + UMER_DMGIMMUNE, + UMER_ATKRANGE, + UMER_ATK, + UMER_MATK, + UMER_DEF, + UMER_MDEF, + UMER_HIT, + UMER_FLEE, + UMER_PDODGE, + UMER_CRIT, + UMER_RACE, + UMER_ELETYPE, + UMER_ELELEVEL, + UMER_AMOTION, + UMER_ADELAY, + UMER_DMOTION, +}; + +enum unitdata_elemtypes { + UELE_SIZE = 0, + UELE_HP, + UELE_MAXHP, + UELE_SP, + UELE_MAXSP, + UELE_MASTERCID, + UELE_MAPID, + UELE_X, + UELE_Y, + UELE_LIFETIME, + UELE_MODE, + UELE_SPEED, + UELE_LOOKDIR, + UELE_CANMOVETICK, + UELE_STR, + UELE_AGI, + UELE_VIT, + UELE_INT, + UELE_DEX, + UELE_LUK, + UELE_DMGIMMUNE, + UELE_ATKRANGE, + UELE_ATK, + UELE_MATK, + UELE_DEF, + UELE_MDEF, + UELE_HIT, + UELE_FLEE, + UELE_PDODGE, + UELE_CRIT, + UELE_RACE, + UELE_ELETYPE, + UELE_ELELEVEL, + UELE_AMOTION, + UELE_ADELAY, + UELE_DMOTION, +}; + +enum unitdata_npctypes { + UNPC_DISPLAY = 0, + UNPC_LEVEL, + UNPC_HP, + UNPC_MAXHP, + UNPC_MAPID, + UNPC_X, + UNPC_Y, + UNPC_LOOKDIR, + UNPC_STR, + UNPC_AGI, + UNPC_VIT, + UNPC_INT, + UNPC_DEX, + UNPC_LUK, + UNPC_PLUSALLSTAT, + UNPC_DMGIMMUNE, + UNPC_ATKRANGE, + UNPC_ATK, + UNPC_MATK, + UNPC_DEF, + UNPC_MDEF, + UNPC_HIT, + UNPC_FLEE, + UNPC_PDODGE, + UNPC_CRIT, + UNPC_RACE, + UNPC_ELETYPE, + UNPC_ELELEVEL, + UNPC_AMOTION, + UNPC_ADELAY, + UNPC_DMOTION, +}; + /** * used to generate quick script_array entries **/