From 1d34b1d90999a9dda263c8235e5036d7b6179fa5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 10 Jan 2015 12:03:35 +0300 Subject: map: overload job/class related functions. --- src/map/init.c | 5 +++++ src/map/pc.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/map/pc.h | 10 ++++++++++ 3 files changed, 57 insertions(+) (limited to 'src/map') diff --git a/src/map/init.c b/src/map/init.c index 3219c61..5906c86 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -109,6 +109,11 @@ HPExport void plugin_init (void) addHookPre("pc->unequipitem_pos", epc_unequipitem_pos); addHookPre("pc->can_attack", epc_can_attack); addHookPre("pc->takeitem", epc_takeitem); + addHookPre("pc->class2idx", epc_class2idx); + addHookPre("pc->jobid2mapid", epc_jobid2mapid); + addHookPre("pc->mapid2jobid", epc_mapid2jobid); + addHookPre("pc->db_checkid", epc_db_checkid); + addHookPre("pc->calc_skilltree_normalize_job", epc_calc_skilltree_normalize_job); addHookPre("npc->parse_unknown_mapflag", enpc_parse_unknown_mapflag); addHookPre("npc->buysellsel", enpc_buysellsel); addHookPre("npc->db_checkid", enpc_db_checkid); diff --git a/src/map/pc.c b/src/map/pc.c index fba2441..bead6b4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -165,3 +165,45 @@ int epc_takeitem(struct map_session_data *sd __attribute__ ((unused)), } return 1; } + +int epc_class2idx(int *classPtr) +{ + int class_ = *classPtr; + if (class_ >= 30) + class_ -= 30; + if (class_ < 0) + class_ = 0; + if (class_ >= CLASS_COUNT) + class_ = 0; + return class_; +} + +int epc_jobid2mapid(unsigned short *b_class) +{ + hookStop(); + return *b_class; +} + +int epc_mapid2jobid(unsigned short *class_, int *sex __attribute__ ((unused))) +{ + hookStop(); + return *class_; +} + +bool epc_db_checkid(unsigned int *class_) +{ + if (*class_ >= 30 && *class_ < 100) + { + hookStop(); + return true; + } + return false; +} + +int epc_calc_skilltree_normalize_job(struct map_session_data *sd) +{ + hookStop(); + if (!sd) + return 0; + return sd->class_; +} diff --git a/src/map/pc.h b/src/map/pc.h index cfc37a0..632456d 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -21,4 +21,14 @@ bool epc_can_attack (struct map_session_data *sd, int *target_id); int epc_takeitem(struct map_session_data *sd, struct flooritem_data *fitem); +int epc_class2idx(int *classPtr); + +int epc_jobid2mapid(unsigned short *b_class); + +int epc_mapid2jobid(unsigned short *class_, int *sex); + +bool epc_db_checkid(unsigned int *class_); + +int epc_calc_skilltree_normalize_job(struct map_session_data *sd); + #endif // EVOL_MAP_PC -- cgit v1.2.3-70-g09d2