From 4fcb7d5f3bd12d99a1183bf16a23f6b1f22195f2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 10 Jul 2016 03:23:36 +0300 Subject: Add bit field 0x100 into sc_config.txt for allow see sc effect for all players. Also move status based enums into separate files. And add sc shield into constants. --- src/Makefile.am | 2 ++ src/emap/enum/esctype.h | 12 ++++++++++++ src/emap/enum/esitype.h | 12 ++++++++++++ src/emap/init.c | 1 + src/emap/skill_const.c | 7 +++++++ src/emap/status.c | 26 ++++++++++++++++++++++++++ src/emap/status.h | 13 +++++-------- 7 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 src/emap/enum/esctype.h create mode 100644 src/emap/enum/esitype.h diff --git a/src/Makefile.am b/src/Makefile.am index 8dea93b..05ebf01 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -104,6 +104,8 @@ MAP_SRC = emap/atcommand.c \ emap/data/session.h \ emap/data/skilld.c \ emap/data/skilld.h \ + emap/enum/esctype.h \ + emap/enum/esitype.h \ emap/struct/bgdext.h \ emap/struct/craft.h \ emap/struct/itemdext.h \ diff --git a/src/emap/enum/esctype.h b/src/emap/enum/esctype.h new file mode 100644 index 0000000..3e6e5d4 --- /dev/null +++ b/src/emap/enum/esctype.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 - 2015 Evol developers + +#ifndef EVOL_MAP_ENUM_ESCTYPE +#define EVOL_MAP_ENUM_ESCTYPE + +typedef enum esc_type +{ + SC_PHYSICAL_SHIELD = 642, +} esc_type; + +#endif // EVOL_MAP_ENUM_ESCTYPE diff --git a/src/emap/enum/esitype.h b/src/emap/enum/esitype.h new file mode 100644 index 0000000..d1213ad --- /dev/null +++ b/src/emap/enum/esitype.h @@ -0,0 +1,12 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 - 2015 Evol developers + +#ifndef EVOL_MAP_ENUM_ESITYPE +#define EVOL_MAP_ENUM_ESITYPE + +enum esi_type +{ + SI_PHYSICAL_SHIELD = 966, +}; + +#endif // EVOL_MAP_ENUM_ESITYPE diff --git a/src/emap/init.c b/src/emap/init.c index a8a8ecd..0c5707e 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -277,6 +277,7 @@ HPExport void plugin_init (void) addHookPost(status, calc_fix_aspd, estatus_calc_fix_aspd_post); addHookPost(status, change_start, estatus_change_start_post); addHookPost(status, change_end_, estatus_change_end__post); + addHookPost(status, readdb_scconfig, estatus_readdb_scconfig_post); addHookPost(map, addflooritem, emap_addflooritem_post); addHookPost(mob, read_db_mode_sub, emob_read_db_mode_sub_post); addHookPost(npc, get_viewdata, enpc_get_viewdata_post); diff --git a/src/emap/skill_const.c b/src/emap/skill_const.c index 1684ceb..6161e64 100644 --- a/src/emap/skill_const.c +++ b/src/emap/skill_const.c @@ -7,14 +7,21 @@ #include "emap/effects.h" #include "emap/skill_const.h" +#include "emap/enum/esctype.h" void eskill_addskill_conststants(void) { script->constdb_comment("Evol skills"); + // skills script->set_constant("EVOL_MASS_PROVOKE", EVOL_MASS_PROVOKE, false, false); script->set_constant("EVOL_PHYSICAL_SHIELD", EVOL_PHYSICAL_SHIELD, false, false); + + // effects script->set_constant("EFFECT_PROVOKE", EFFECT_PROVOKE, false, false); script->set_constant("EFFECT_MAGIC_SHIELD", EFFECT_MAGIC_SHIELD, false, false); script->set_constant("EFFECT_MAGIC_SHIELD_ENDS", EFFECT_MAGIC_SHIELD_ENDS, false, false); + + // sc + script->set_constant("SC_PHYSICAL_SHIELD", SC_PHYSICAL_SHIELD, false, false); script->constdb_comment(NULL); } diff --git a/src/emap/status.c b/src/emap/status.c index ee45ab2..1e75161 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -34,6 +34,9 @@ #include "emap/struct/itemdext.h" #include "emap/struct/npcdext.h" +#include "emap/enum/esctype.h" +#include "emap/enum/esitype.h" + int class_move_speed[CLASS_COUNT]; void eInitChangeTables(void) @@ -42,6 +45,8 @@ void eInitChangeTables(void) (sc_type)SC_PHYSICAL_SHIELD, SI_PHYSICAL_SHIELD, SCB_DEF | SCB_DEF2 | SCB_ASPD); + +// status->dbs->DisplayType[SC_PHYSICAL_SHIELD] = true; } int estatus_init_post(int retVal, @@ -241,3 +246,24 @@ int estatus_change_end__post(int retVal, */ return retVal; } + +bool estatus_readdb_scconfig_post(bool retVal, + char* fields[], + int columns, + int current) +{ + if (retVal == true) + { + char *type = fields[0]; + int val = 0; + script->get_constant(type, &val); + // own field in sc_config.txt + if (status->dbs->sc_conf[val] & 0x100) + { + // allow show this sc always + status->dbs->DisplayType[val] = true; + } + } + + return retVal; +} diff --git a/src/emap/status.h b/src/emap/status.h index 8ad69ed..b8d77f5 100644 --- a/src/emap/status.h +++ b/src/emap/status.h @@ -4,14 +4,6 @@ #ifndef EVOL_MAP_STATUS #define EVOL_MAP_STATUS -typedef enum esc_type { - SC_PHYSICAL_SHIELD = 642, -} esc_type; - -enum esi_type { - SI_PHYSICAL_SHIELD = 966, -}; - int estatus_init_post(int retVal, bool minimal); void estatus_set_viewdata_pre(struct block_list **blPtr, int *classPtr_ __attribute__ ((unused))); @@ -52,4 +44,9 @@ int estatus_change_end__post(int retVal, enum sc_type type, int tid, const char* file, int line); +bool estatus_readdb_scconfig_post(bool retVal, + char* fields[], + int columns, + int current); + #endif // EVOL_MAP_STATUS -- cgit v1.2.3-70-g09d2