From 9aa5f7d8345d9d89ec9e8b44060e92703f3d43b8 Mon Sep 17 00:00:00 2001 From: Atemo Date: Wed, 10 Apr 2019 15:59:42 +0200 Subject: [PATCH] Added several warning messages (#4062) * enablenpc / disablenpc / hideoffnpc / hideonnpc now display the npc source when the npc named doesn't exist * Added the NPC source to status_set_viewdata when no view data has been found * Added export_deprecated_constant3 to display the constant name replacing the deprecated * Removed the debug message from `@ warp` when the map name is wrong * Added clif_name_area to UMOB_LEVEL on setunitdata and a capvalue to UPET_HUNGER * areamonster now checks if the monster ID exists Thanks to @Normynator and @aleos89 for the review! --- src/common/mapindex.cpp | 3 +- src/map/atcommand.cpp | 4 +- src/map/npc.cpp | 6 +- src/map/npc.hpp | 2 +- src/map/script.cpp | 62 ++++++----- src/map/script.hpp | 3 +- src/map/script_constants.hpp | 195 ++++++++++++++++++----------------- src/map/status.cpp | 8 +- 8 files changed, 153 insertions(+), 130 deletions(-) diff --git a/src/common/mapindex.cpp b/src/common/mapindex.cpp index 3abe8eb17a..89625bb328 100644 --- a/src/common/mapindex.cpp +++ b/src/common/mapindex.cpp @@ -115,7 +115,8 @@ unsigned short mapindex_name2idx(const char* name, const char *func) { if( (i = strdb_iget(mapindex_db, map_name)) ) return i; - ShowDebug("(%s) mapindex_name2id: Map \"%s\" not found in index list!\n", func, map_name); + if (func) + ShowDebug("(%s) mapindex_name2id: Map \"%s\" not found in index list!\n", func, map_name); return 0; } diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index b52ad4c24d..65a96186cd 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -504,11 +504,11 @@ ACMD_FUNC(mapmove) return -1; } - mapindex = mapindex_name2id(map_name); + mapindex = mapindex_name2idx(map_name, nullptr); if (mapindex) m = map_mapindex2mapid(mapindex); - if (!mapindex) { // m < 0 means on different server! [Kevin] + if (m < 0) { // m < 0 means on different server! [Kevin] clif_displaymessage(fd, msg_txt(sd,1)); // Map not found. if (battle_config.warp_suggestions_enabled) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index f88625ffb7..5bd122ce68 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -233,14 +233,14 @@ int npc_enable_sub(struct block_list *bl, va_list ap) /*========================================== * Disable / Enable NPC *------------------------------------------*/ -int npc_enable(const char* name, int flag) +bool npc_enable(const char* name, int flag) { struct npc_data* nd = npc_name2id(name); if (nd==NULL) { ShowError("npc_enable: Attempted to %s a non-existing NPC '%s' (flag=%d).\n", (flag&3) ? "show" : "hide", name, flag); - return 0; + return false; } if (flag&1) { @@ -267,7 +267,7 @@ int npc_enable(const char* name, int flag) if( flag&3 && (nd->u.scr.xs >= 0 || nd->u.scr.ys >= 0) )// check if player standing on a OnTouchArea map_foreachinallarea( npc_enable_sub, nd->bl.m, nd->bl.x-nd->u.scr.xs, nd->bl.y-nd->u.scr.ys, nd->bl.x+nd->u.scr.xs, nd->bl.y+nd->u.scr.ys, BL_PC, nd ); - return 0; + return true; } /*========================================== diff --git a/src/map/npc.hpp b/src/map/npc.hpp index 88688ea1c3..0ce0c96a01 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -1203,7 +1203,7 @@ const char *npc_get_script_event_name(int npce_index); void npc_setcells(struct npc_data* nd); void npc_unsetcells(struct npc_data* nd); bool npc_movenpc(struct npc_data* nd, int16 x, int16 y); -int npc_enable(const char* name, int flag); +bool npc_enable(const char* name, int flag); void npc_setdisplayname(struct npc_data* nd, const char* newname); void npc_setclass(struct npc_data* nd, short class_); struct npc_data* npc_name2id(const char* name); diff --git a/src/map/script.cpp b/src/map/script.cpp index e36cb7313c..d3d98d428c 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -210,8 +210,9 @@ static struct str_data_struct { int (*func)(struct script_state *st); int val; int next; + const char *name; bool deprecated; -} *str_data = NULL; +} *str_data = nullptr; static int str_data_size = 0; // size of the data static int str_num = LABEL_START; // next id to be assigned @@ -481,13 +482,12 @@ static void script_dump_stack(struct script_state* st) /// Reports on the console the src of a script error. static void script_reportsrc(struct script_state *st) { - struct block_list* bl; - if( st->oid == 0 ) return; //Can't report source. - bl = map_id2bl(st->oid); - if( bl == NULL ) + struct block_list* bl = map_id2bl(st->oid); + + if (!bl) return; switch( bl->type ) { @@ -1366,6 +1366,8 @@ const char* parse_simpleexpr(const char *p) if( str_data[l].type == C_INT && str_data[l].deprecated ){ ShowWarning( "Usage of deprecated constant '%s'.\n", get_str(l) ); ShowWarning( "This constant was deprecated and could become unavailable anytime soon.\n" ); + if (str_data[l].name) + ShowWarning( "Please use '%s' instead!\n", str_data[l].name ); } #endif @@ -2303,6 +2305,8 @@ bool script_get_constant(const char* name, int* value) if( str_data[n].deprecated ){ ShowWarning( "Usage of deprecated constant '%s'.\n", name ); ShowWarning( "This constant was deprecated and could become unavailable anytime soon.\n" ); + if (str_data[n].name) + ShowWarning( "Please use '%s' instead!\n", str_data[n].name ); } #endif @@ -2310,7 +2314,7 @@ bool script_get_constant(const char* name, int* value) } /// Creates new constant or parameter with given value. -void script_set_constant(const char* name, int value, bool isparameter, bool deprecated) +void script_set_constant_(const char* name, int value, const char* constant_name, bool isparameter, bool deprecated) { int n = add_str(name); @@ -2319,6 +2323,7 @@ void script_set_constant(const char* name, int value, bool isparameter, bool dep str_data[n].type = isparameter ? C_PARAM : C_INT; str_data[n].val = value; str_data[n].deprecated = deprecated; + str_data[n].name = constant_name; } else if( str_data[n].type == C_PARAM || str_data[n].type == C_INT ) {// existing parameter or constant @@ -10353,6 +10358,11 @@ BUILDIN_FUNC(areamonster) } } + 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) @@ -11255,39 +11265,43 @@ BUILDIN_FUNC(getareadropitem) *------------------------------------------*/ BUILDIN_FUNC(enablenpc) { - const char *str; - str=script_getstr(st,2); - npc_enable(str,1); - return SCRIPT_CMD_SUCCESS; + const char *str = script_getstr(st,2); + if (npc_enable(str,1)) + return SCRIPT_CMD_SUCCESS; + + return SCRIPT_CMD_FAILURE; } /*========================================== *------------------------------------------*/ BUILDIN_FUNC(disablenpc) { - const char *str; - str=script_getstr(st,2); - npc_enable(str,0); - return SCRIPT_CMD_SUCCESS; + const char *str = script_getstr(st,2); + if (npc_enable(str,0)) + return SCRIPT_CMD_SUCCESS; + + return SCRIPT_CMD_FAILURE; } /*========================================== *------------------------------------------*/ BUILDIN_FUNC(hideoffnpc) { - const char *str; - str=script_getstr(st,2); - npc_enable(str,2); - return SCRIPT_CMD_SUCCESS; + const char *str = script_getstr(st,2); + if (npc_enable(str,2)) + return SCRIPT_CMD_SUCCESS; + + return SCRIPT_CMD_FAILURE; } /*========================================== *------------------------------------------*/ BUILDIN_FUNC(hideonnpc) { - const char *str; - str=script_getstr(st,2); - npc_enable(str,4); - return SCRIPT_CMD_SUCCESS; + const char *str = script_getstr(st,2); + if (npc_enable(str,4)) + return SCRIPT_CMD_SUCCESS; + + return SCRIPT_CMD_FAILURE; } /* Starts a status effect on the target unit or on the attached player. @@ -17756,7 +17770,7 @@ BUILDIN_FUNC(setunitdata) switch (type) { case UMOB_SIZE: md->status.size = md->base_status->size = (unsigned char)value; break; - case UMOB_LEVEL: md->level = (unsigned short)value; break; + case UMOB_LEVEL: md->level = (unsigned short)value; clif_name_area(&md->bl); break; case UMOB_HP: md->base_status->hp = (unsigned int)value; status_set_hp(bl, (unsigned int)value, 0); clif_name_area(&md->bl); break; case UMOB_MAXHP: md->base_status->hp = md->base_status->max_hp = (unsigned int)value; status_set_maxhp(bl, (unsigned int)value, 0); clif_name_area(&md->bl); break; case UMOB_MASTERAID: md->master_id = value; break; @@ -17909,7 +17923,7 @@ BUILDIN_FUNC(setunitdata) 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_HUNGER: pd->pet.hungry = cap_value((short)value, 0, 100); 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; diff --git a/src/map/script.hpp b/src/map/script.hpp index 95a831900a..574187d8c2 100644 --- a/src/map/script.hpp +++ b/src/map/script.hpp @@ -1959,7 +1959,8 @@ void script_run_autobonus(const char *autobonus, struct map_session_data *sd, un const char* script_get_constant_str(const char* prefix, int64 value); bool script_get_parameter(const char* name, int* value); bool script_get_constant(const char* name, int* value); -void script_set_constant(const char* name, int value, bool isparameter, bool deprecated); +void script_set_constant_(const char* name, int value, const char* constant_name, bool isparameter, bool deprecated); +#define script_set_constant(name, value, isparameter, deprecated) script_set_constant_(name, value, NULL, isparameter, deprecated) void script_hardcoded_constants(void); void script_cleararray_pc(struct map_session_data* sd, const char* varname, void* value); diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp index 99277ee9f2..c35acbd8f5 100644 --- a/src/map/script_constants.hpp +++ b/src/map/script_constants.hpp @@ -10,6 +10,7 @@ #define export_parameter(a,b) script_set_constant(a,b,true,false) #define export_deprecated_constant(a) script_set_constant(#a,a,false,true) #define export_deprecated_constant2(a,b) script_set_constant(a,b,false,true) + #define export_deprecated_constant3(a,b,c) script_set_constant_(a,b,c,false,true) /* min and maximum variable value */ export_constant(INT_MIN); @@ -420,7 +421,7 @@ export_constant(MF_NORETURN); export_constant(MF_NOWARPTO); export_constant(MF_PVP_NIGHTMAREDROP); - script_set_constant("mf_nightmaredrop",MF_PVP_NIGHTMAREDROP,false,true); + export_deprecated_constant3("mf_nightmaredrop", MF_PVP_NIGHTMAREDROP, "MF_PVP_NIGHTMAREDROP"); export_constant(MF_RESTRICTED); export_constant(MF_NOCOMMAND); export_constant(MF_NODROP); @@ -442,7 +443,7 @@ export_constant(MF_NOUSECART); export_constant(MF_NOITEMCONSUMPTION); export_constant(MF_NOSUNMOONSTARMIRACLE); - script_set_constant("mf_sumstarmiracle",MF_NOSUNMOONSTARMIRACLE,false,true); + export_deprecated_constant3("mf_sumstarmiracle", MF_NOSUNMOONSTARMIRACLE, "MF_NOSUNMOONSTARMIRACLE"); export_constant(MF_NOMINEEFFECT); export_constant(MF_NOLOCKON); export_constant(MF_NOTOMB); @@ -3608,94 +3609,94 @@ export_constant(ET_YUT7); /* emoticons deprecated */ - script_set_constant("E_GASP",ET_SURPRISE,false,true); - script_set_constant("E_WHAT",ET_QUESTION,false,true); - script_set_constant("E_HO",ET_DELIGHT,false,true); - script_set_constant("E_LV",ET_THROB,false,true); - script_set_constant("E_SWT",ET_SWEAT,false,true); - script_set_constant("E_IC",ET_AHA,false,true); - script_set_constant("E_AN",ET_FRET,false,true); - script_set_constant("E_AG",ET_ANGER,false,true); - script_set_constant("E_CASH",ET_MONEY,false,true); - script_set_constant("E_DOTS",ET_THINK,false,true); - script_set_constant("E_SCISSORS",ET_SCISSOR,false,true); - script_set_constant("E_ROCK",ET_ROCK,false,true); - script_set_constant("E_PAPER",ET_WRAP,false,true); - script_set_constant("E_KOREA",ET_FLAG,false,true); - script_set_constant("E_LV2",ET_BIGTHROB,false,true); - script_set_constant("E_THX",ET_THANKS,false,true); - script_set_constant("E_WAH",ET_KEK,false,true); - script_set_constant("E_SRY",ET_SORRY,false,true); - script_set_constant("E_HEH",ET_SMILE,false,true); - script_set_constant("E_SWT2",ET_PROFUSELY_SWEAT,false,true); - script_set_constant("E_HMM",ET_SCRATCH,false,true); - script_set_constant("E_NO1",ET_BEST,false,true); - script_set_constant("E_NO",ET_STARE_ABOUT,false,true); - script_set_constant("E_OMG",ET_HUK,false,true); - script_set_constant("E_OH",ET_O,false,true); - script_set_constant("E_X",ET_X,false,true); - script_set_constant("E_HLP",ET_HELP,false,true); - script_set_constant("E_GO",ET_GO,false,true); - script_set_constant("E_SOB",ET_CRY,false,true); - script_set_constant("E_GG",ET_KIK,false,true); - script_set_constant("E_KIS",ET_CHUP,false,true); - script_set_constant("E_KIS2",ET_CHUPCHUP,false,true); - script_set_constant("E_PIF",ET_HNG,false,true); - script_set_constant("E_OK",ET_OK,false,true); - script_set_constant("E_MUTE",ET_CHAT_PROHIBIT,false,true); - script_set_constant("E_INDONESIA",ET_INDONESIA_FLAG,false,true); - script_set_constant("E_BZZ",ET_STARE,false,true); - script_set_constant("E_RICE",ET_HUNGRY,false,true); - script_set_constant("E_AWSM",ET_COOL,false,true); - script_set_constant("E_MEH",ET_MERONG,false,true); - script_set_constant("E_SHY",ET_SHY,false,true); - script_set_constant("E_PAT",ET_GOODBOY,false,true); - script_set_constant("E_MP",ET_SPTIME,false,true); - script_set_constant("E_SLUR",ET_SEXY,false,true); - script_set_constant("E_COM",ET_COMEON,false,true); - script_set_constant("E_YAWN",ET_SLEEPY,false,true); - script_set_constant("E_GRAT",ET_CONGRATULATION,false,true); - script_set_constant("E_HP",ET_HPTIME,false,true); - script_set_constant("E_PHILIPPINES",ET_PH_FLAG,false,true); - script_set_constant("E_MALAYSIA",ET_MY_FLAG,false,true); - script_set_constant("E_SINGAPORE",ET_SI_FLAG,false,true); - script_set_constant("E_BRAZIL",ET_BR_FLAG,false,true); - script_set_constant("E_FLASH",ET_SPARK,false,true); - script_set_constant("E_SPIN",ET_CONFUSE,false,true); - script_set_constant("E_SIGH",ET_OHNO,false,true); - script_set_constant("E_DUM",ET_HUM,false,true); - script_set_constant("E_LOUD",ET_BLABLA,false,true); - script_set_constant("E_OTL",ET_OTL,false,true); - script_set_constant("E_DICE1",ET_DICE1,false,true); - script_set_constant("E_DICE2",ET_DICE2,false,true); - script_set_constant("E_DICE3",ET_DICE3,false,true); - script_set_constant("E_DICE4",ET_DICE4,false,true); - script_set_constant("E_DICE5",ET_DICE5,false,true); - script_set_constant("E_DICE6",ET_DICE6,false,true); - script_set_constant("E_INDIA",ET_INDIA_FLAG,false,true); - script_set_constant("E_LUV",ET_LUV,false,true); - script_set_constant("E_RUSSIA",ET_FLAG8,false,true); - script_set_constant("E_VIRGIN",ET_FLAG9,false,true); - script_set_constant("E_MOBILE",ET_MOBILE,false,true); - script_set_constant("E_MAIL",ET_MAIL,false,true); - script_set_constant("E_CHINESE",ET_ANTENNA0,false,true); - script_set_constant("E_ANTENNA1",ET_ANTENNA1,false,true); - script_set_constant("E_ANTENNA2",ET_ANTENNA2,false,true); - script_set_constant("E_ANTENNA3",ET_ANTENNA3,false,true); - script_set_constant("E_HUM",ET_HUM2,false,true); - script_set_constant("E_ABS",ET_ABS,false,true); - script_set_constant("E_OOPS",ET_OOPS,false,true); - script_set_constant("E_SPIT",ET_SPIT,false,true); - script_set_constant("E_ENE",ET_ENE,false,true); - script_set_constant("E_PANIC",ET_PANIC,false,true); - script_set_constant("E_WHISP",ET_WHISP,false,true); - script_set_constant("E_YUT1",ET_YUT1,false,true); - script_set_constant("E_YUT2",ET_YUT2,false,true); - script_set_constant("E_YUT3",ET_YUT3,false,true); - script_set_constant("E_YUT4",ET_YUT4,false,true); - script_set_constant("E_YUT5",ET_YUT5,false,true); - script_set_constant("E_YUT6",ET_YUT6,false,true); - script_set_constant("E_YUT7",ET_YUT7,false,true); + export_deprecated_constant3("E_GASP", ET_SURPRISE, "ET_SURPRISE"); + export_deprecated_constant3("E_WHAT", ET_QUESTION, "ET_QUESTION"); + export_deprecated_constant3("E_HO", ET_DELIGHT, "ET_DELIGHT"); + export_deprecated_constant3("E_LV", ET_THROB, "ET_THROB"); + export_deprecated_constant3("E_SWT", ET_SWEAT, "ET_SWEAT"); + export_deprecated_constant3("E_IC", ET_AHA, "ET_AHA"); + export_deprecated_constant3("E_AN", ET_FRET, "ET_FRET"); + export_deprecated_constant3("E_AG", ET_ANGER, "ET_ANGER"); + export_deprecated_constant3("E_CASH", ET_MONEY, "ET_MONEY"); + export_deprecated_constant3("E_DOTS", ET_THINK, "ET_THINK"); + export_deprecated_constant3("E_SCISSORS", ET_SCISSOR, "ET_SCISSOR"); + export_deprecated_constant3("E_ROCK", ET_ROCK, "ET_ROCK"); + export_deprecated_constant3("E_PAPER", ET_WRAP, "ET_WRAP"); + export_deprecated_constant3("E_KOREA", ET_FLAG, "ET_FLAG"); + export_deprecated_constant3("E_LV2", ET_BIGTHROB, "ET_BIGTHROB"); + export_deprecated_constant3("E_THX", ET_THANKS, "ET_THANKS"); + export_deprecated_constant3("E_WAH", ET_KEK, "ET_KEK"); + export_deprecated_constant3("E_SRY", ET_SORRY, "ET_SORRY"); + export_deprecated_constant3("E_HEH", ET_SMILE, "ET_SMILE"); + export_deprecated_constant3("E_SWT2", ET_PROFUSELY_SWEAT, "ET_PROFUSELY_SWEAT"); + export_deprecated_constant3("E_HMM", ET_SCRATCH, "ET_SCRATCH"); + export_deprecated_constant3("E_NO1", ET_BEST, "ET_BEST"); + export_deprecated_constant3("E_NO", ET_STARE_ABOUT, "ET_STARE_ABOUT"); + export_deprecated_constant3("E_OMG", ET_HUK, "ET_HUK"); + export_deprecated_constant3("E_OH", ET_O, "ET_O"); + export_deprecated_constant3("E_X", ET_X, "ET_X"); + export_deprecated_constant3("E_HLP", ET_HELP, "ET_HELP"); + export_deprecated_constant3("E_GO", ET_GO, "ET_GO"); + export_deprecated_constant3("E_SOB", ET_CRY, "ET_CRY"); + export_deprecated_constant3("E_GG", ET_KIK, "ET_KIK"); + export_deprecated_constant3("E_KIS", ET_CHUP, "ET_CHUP"); + export_deprecated_constant3("E_KIS2", ET_CHUPCHUP, "ET_CHUPCHUP"); + export_deprecated_constant3("E_PIF", ET_HNG, "ET_HNG"); + export_deprecated_constant3("E_OK", ET_OK, "ET_OK"); + export_deprecated_constant3("E_MUTE", ET_CHAT_PROHIBIT, "ET_CHAT_PROHIBIT"); + export_deprecated_constant3("E_INDONESIA", ET_INDONESIA_FLAG, "ET_INDONESIA_FLAG"); + export_deprecated_constant3("E_BZZ", ET_STARE, "ET_STARE"); + export_deprecated_constant3("E_RICE", ET_HUNGRY, "ET_HUNGRY"); + export_deprecated_constant3("E_AWSM", ET_COOL, "ET_COOL"); + export_deprecated_constant3("E_MEH", ET_MERONG, "ET_MERONG"); + export_deprecated_constant3("E_SHY", ET_SHY, "ET_SHY"); + export_deprecated_constant3("E_PAT", ET_GOODBOY, "ET_GOODBOY"); + export_deprecated_constant3("E_MP", ET_SPTIME, "ET_SPTIME"); + export_deprecated_constant3("E_SLUR", ET_SEXY, "ET_SEXY"); + export_deprecated_constant3("E_COM", ET_COMEON, "ET_COMEON"); + export_deprecated_constant3("E_YAWN", ET_SLEEPY, "ET_SLEEPY"); + export_deprecated_constant3("E_GRAT", ET_CONGRATULATION, "ET_CONGRATULATION"); + export_deprecated_constant3("E_HP", ET_HPTIME, "ET_HPTIME"); + export_deprecated_constant3("E_PHILIPPINES", ET_PH_FLAG, "ET_PH_FLAG"); + export_deprecated_constant3("E_MALAYSIA", ET_MY_FLAG, "ET_MY_FLAG"); + export_deprecated_constant3("E_SINGAPORE", ET_SI_FLAG, "ET_SI_FLAG"); + export_deprecated_constant3("E_BRAZIL", ET_BR_FLAG, "ET_BR_FLAG"); + export_deprecated_constant3("E_FLASH", ET_SPARK, "ET_SPARK"); + export_deprecated_constant3("E_SPIN", ET_CONFUSE, "ET_CONFUSE"); + export_deprecated_constant3("E_SIGH", ET_OHNO, "ET_OHNO"); + export_deprecated_constant3("E_DUM", ET_HUM, "ET_HUM"); + export_deprecated_constant3("E_LOUD", ET_BLABLA, "ET_BLABLA"); + export_deprecated_constant3("E_OTL", ET_OTL, "ET_OTL"); + export_deprecated_constant3("E_DICE1", ET_DICE1, "ET_DICE1"); + export_deprecated_constant3("E_DICE2", ET_DICE2, "ET_DICE2"); + export_deprecated_constant3("E_DICE3", ET_DICE3, "ET_DICE3"); + export_deprecated_constant3("E_DICE4", ET_DICE4, "ET_DICE4"); + export_deprecated_constant3("E_DICE5", ET_DICE5, "ET_DICE5"); + export_deprecated_constant3("E_DICE6", ET_DICE6, "ET_DICE6"); + export_deprecated_constant3("E_INDIA", ET_INDIA_FLAG, "ET_INDIA_FLAG"); + export_deprecated_constant3("E_LUV", ET_LUV, "ET_LUV"); + export_deprecated_constant3("E_RUSSIA", ET_FLAG8, "ET_FLAG8"); + export_deprecated_constant3("E_VIRGIN", ET_FLAG9, "ET_FLAG9"); + export_deprecated_constant3("E_MOBILE", ET_MOBILE, "ET_MOBILE"); + export_deprecated_constant3("E_MAIL", ET_MAIL, "ET_MAIL"); + export_deprecated_constant3("E_CHINESE", ET_ANTENNA0, "ET_ANTENNA0"); + export_deprecated_constant3("E_ANTENNA1", ET_ANTENNA1, "ET_ANTENNA1"); + export_deprecated_constant3("E_ANTENNA2", ET_ANTENNA2, "ET_ANTENNA2"); + export_deprecated_constant3("E_ANTENNA3", ET_ANTENNA3, "ET_ANTENNA3"); + export_deprecated_constant3("E_HUM", ET_HUM2, "ET_HUM2"); + export_deprecated_constant3("E_ABS", ET_ABS, "ET_ABS"); + export_deprecated_constant3("E_OOPS", ET_OOPS, "ET_OOPS"); + export_deprecated_constant3("E_SPIT", ET_SPIT, "ET_SPIT"); + export_deprecated_constant3("E_ENE", ET_ENE, "ET_ENE"); + export_deprecated_constant3("E_PANIC", ET_PANIC, "ET_PANIC"); + export_deprecated_constant3("E_WHISP", ET_WHISP, "ET_WHISP"); + export_deprecated_constant3("E_YUT1", ET_YUT1, "ET_YUT1"); + export_deprecated_constant3("E_YUT2", ET_YUT2, "ET_YUT2"); + export_deprecated_constant3("E_YUT3", ET_YUT3, "ET_YUT3"); + export_deprecated_constant3("E_YUT4", ET_YUT4, "ET_YUT4"); + export_deprecated_constant3("E_YUT5", ET_YUT5, "ET_YUT5"); + export_deprecated_constant3("E_YUT6", ET_YUT6, "ET_YUT6"); + export_deprecated_constant3("E_YUT7", ET_YUT7, "ET_YUT7"); /* send targets */ export_constant(ALL_CLIENT); @@ -3942,13 +3943,13 @@ /* unit control - types */ /* Send deprecation notice and temporarily replace with new constant value. */ - export_deprecated_constant2("UNITTYPE_PC", BL_PC); - export_deprecated_constant2("UNITTYPE_NPC", BL_NPC); - export_deprecated_constant2("UNITTYPE_PET", BL_PET); - export_deprecated_constant2("UNITTYPE_MOB", BL_MOB); - export_deprecated_constant2("UNITTYPE_HOM", BL_HOM); - export_deprecated_constant2("UNITTYPE_MER", BL_MER); - export_deprecated_constant2("UNITTYPE_ELEM", BL_ELEM); + export_deprecated_constant3("UNITTYPE_PC", BL_PC, "BL_PC"); + export_deprecated_constant3("UNITTYPE_NPC", BL_NPC, "BL_NPC"); + export_deprecated_constant3("UNITTYPE_PET", BL_PET, "BL_PET"); + export_deprecated_constant3("UNITTYPE_MOB", BL_MOB, "BL_MOB"); + export_deprecated_constant3("UNITTYPE_HOM", BL_HOM, "BL_HOM"); + export_deprecated_constant3("UNITTYPE_MER", BL_MER, "BL_MER"); + export_deprecated_constant3("UNITTYPE_ELEM", BL_ELEM, "BL_ELEM"); /* unit control - mob */ export_constant(UMOB_SIZE); diff --git a/src/map/status.cpp b/src/map/status.cpp index 53b9909ca3..e76884ca20 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -7925,8 +7925,14 @@ void status_set_viewdata(struct block_list *bl, int class_) TBL_NPC* nd = (TBL_NPC*)bl; if (vd) nd->vd = vd; - else + else { ShowError("status_set_viewdata (NPC): No view data for class %d\n", class_); + if (bl->m >= 0) + ShowDebug("Source (NPC): %s at %s (%d,%d)\n", nd->name, map_mapid2mapname(bl->m), bl->x, bl->y); + else + ShowDebug("Source (NPC): %s (invisible/not on a map)\n", nd->name); + break; + } } break; case BL_HOM: