diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-14 17:58:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-14 17:58:29 +0300 |
commit | 2ed4142dfcde097648857f41f8064b0a19c350c7 (patch) | |
tree | 5777014a74b30081ac39cda28ea9c64280cbebb5 /src/emap/status.c | |
parent | f8b3342f690816022d26038389431002e9cf3648 (diff) | |
download | evol-hercules-2ed4142dfcde097648857f41f8064b0a19c350c7.tar.gz evol-hercules-2ed4142dfcde097648857f41f8064b0a19c350c7.tar.bz2 evol-hercules-2ed4142dfcde097648857f41f8064b0a19c350c7.tar.xz evol-hercules-2ed4142dfcde097648857f41f8064b0a19c350c7.zip |
Add basic support for charm items (If item present in inventory it give own bonuses)
For char item in items.conf need add attribute "Charm: true"
Diffstat (limited to 'src/emap/status.c')
-rw-r--r-- | src/emap/status.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/emap/status.c b/src/emap/status.c index 6f853d5..912a96c 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -16,7 +16,9 @@ #include "map/pc.h" #include "map/status.h" +#include "emap/data/itemd.h" #include "emap/data/npcd.h" +#include "emap/struct/itemdext.h" #include "emap/struct/npcdext.h" int class_move_speed[CLASS_COUNT]; @@ -68,3 +70,42 @@ int estatus_calc_pc_(int retVal, } return retVal; } + +int estatus_calc_pc_additional(struct map_session_data* sd, + enum e_status_calc_opt *opt __attribute__ ((unused))) +{ + hookStop(); + + for (int f = 0; f < MAX_INVENTORY; f ++) + { + struct item_data *const item = sd->inventory_data[f]; + if (!item) + continue; + + struct ItemdExt *data = itemd_get(item); + if (!data || !data->charmItem) + continue; + + int k; + for (k = 0; k < map->list[sd->bl.m].zone->disabled_items_count; k ++) + { + if (map->list[sd->bl.m].zone->disabled_items[k] == item->nameid) + break; + } + + if (k < map->list[sd->bl.m].zone->disabled_items_count) + continue; + + if (!pc->isequip(sd, f)) + continue; + + + struct status_data *bstatus = &sd->base_status; + bstatus->def += item->def; + + script->run_use_script(sd, item, 0); + + // here can be refine bonuses + } + return 0; +} |