From cdab2778ae73dcad36fbeac8d827732440a321e3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 9 Jul 2016 21:03:52 +0300 Subject: Add array and functions for skill extended data. --- src/Makefile.am | 4 ++++ src/emap/const/skilldmaxeffects.h | 9 +++++++++ src/emap/data/skilld.c | 38 ++++++++++++++++++++++++++++++++++++++ src/emap/data/skilld.h | 13 +++++++++++++ src/emap/init.c | 4 ++++ src/emap/struct/skilldext.h | 14 ++++++++++++++ 6 files changed, 82 insertions(+) create mode 100644 src/emap/const/skilldmaxeffects.h create mode 100644 src/emap/data/skilld.c create mode 100644 src/emap/data/skilld.h create mode 100644 src/emap/struct/skilldext.h diff --git a/src/Makefile.am b/src/Makefile.am index 072c20c..8dea93b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -89,6 +89,7 @@ MAP_SRC = emap/atcommand.c \ emap/unit.c \ emap/unit.h \ emap/const/craft.h \ + emap/const/skilldmaxeffects.h \ emap/data/bgd.c \ emap/data/bgd.h \ emap/data/itemd.c \ @@ -101,6 +102,8 @@ MAP_SRC = emap/atcommand.c \ emap/data/npcd.h \ emap/data/session.c \ emap/data/session.h \ + emap/data/skilld.c \ + emap/data/skilld.h \ emap/struct/bgdext.h \ emap/struct/craft.h \ emap/struct/itemdext.h \ @@ -108,6 +111,7 @@ MAP_SRC = emap/atcommand.c \ emap/struct/mobdext.h \ emap/struct/npcdext.h \ emap/struct/sessionext.h \ + emap/struct/skilldext.h \ emap/utils/formatutils.c \ emap/utils/formatutils.h \ ecommon/config.c \ diff --git a/src/emap/const/skilldmaxeffects.h b/src/emap/const/skilldmaxeffects.h new file mode 100644 index 0000000..94c0814 --- /dev/null +++ b/src/emap/const/skilldmaxeffects.h @@ -0,0 +1,9 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 - 2015 Evol developers + +#ifndef EVOL_MAP_CONST_CRAFT_SKILLDMAXMISCEFFECTS +#define EVOL_MAP_CONST_CRAFT_SKILLDMAXMISCEFFECTS + +#define SKILLD_MAXMISCEFFECTS 2 + +#endif // EVOL_MAP_CONST_CRAFT_SKILLDMAXMISCEFFECTS diff --git a/src/emap/data/skilld.c b/src/emap/data/skilld.c new file mode 100644 index 0000000..ce39993 --- /dev/null +++ b/src/emap/data/skilld.c @@ -0,0 +1,38 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 - 2015 Evol developers + +#include "common/hercules.h" + +#include +#include +#include + +#include "common/HPMi.h" +#include "common/memmgr.h" +#include "common/mmo.h" +#include "common/nullpo.h" +#include "common/socket.h" +#include "common/strlib.h" +#include "map/skill.h" + +#include "emap/data/skilld.h" +#include "emap/struct/skilldext.h" + +struct SkilldExt skilld_arr[MAX_SKILL_DB]; + +struct SkilldExt *skilld_init(void) +{ + for (int f = 0; f < MAX_SKILL_DB; f ++) + { + for (int d = 0; d < SKILLD_MAXMISCEFFECTS; d ++) + { + skilld_arr[f].miscEffects[d] = -1; + } + } +} + +struct SkilldExt *skilld_get(const int skill_idx) +{ + Assert_retr(NULL, skill_idx >= 0 && skill_idx < MAX_SKILL_DB); + return &skilld_arr[skill_idx]; +} diff --git a/src/emap/data/skilld.h b/src/emap/data/skilld.h new file mode 100644 index 0000000..0039c47 --- /dev/null +++ b/src/emap/data/skilld.h @@ -0,0 +1,13 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 - 2015 Evol developers + +#ifndef EVOL_MAP_SKILLD +#define EVOL_MAP_SKILLD + +struct SkilldExt; + +struct SkilldExt *skilld_init(void); + +struct SkilldExt *skilld_get(const int skill_idx); + +#endif // EVOL_MAP_SKILLD diff --git a/src/emap/init.c b/src/emap/init.c index 8f2de51..a8a8ecd 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -66,6 +66,8 @@ #include "emap/skill.h" #include "emap/status.h" +#include "emap/data/skilld.h" + #include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */ @@ -85,6 +87,7 @@ HPExport void plugin_init (void) { isInit = false; htreg_init(); + skilld_init(); addAtcommand("setskill", setSkill); addAtcommand("slide", slide); @@ -304,6 +307,7 @@ HPExport void plugin_init (void) skill->check_condition_castend_unknown = eskill_check_condition_castend_unknown; skill->get_requirement_unknown = eskill_get_requirement_unknown; skill->castend_pos2_unknown = eskill_castend_pos2_unknown; + skill->validate_additional_fields = eskill_validate_additional_fields; langScriptId = script->add_str("Lang"); mountScriptId = script->add_str("mount"); diff --git a/src/emap/struct/skilldext.h b/src/emap/struct/skilldext.h new file mode 100644 index 0000000..f7dd52e --- /dev/null +++ b/src/emap/struct/skilldext.h @@ -0,0 +1,14 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 - 2015 Evol developers + +#ifndef EVOL_MAP_SKILLDEXT +#define EVOL_MAP_SKILLDEXT + +#include "emap/const/skilldmaxeffects.h" + +struct SkilldExt +{ + int miscEffects[SKILLD_MAXMISCEFFECTS]; +}; + +#endif // EVOL_MAP_SKILLDEXT -- cgit v1.2.3-60-g2f50