summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-10 12:03:35 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-10 12:03:35 +0300
commit1d34b1d90999a9dda263c8235e5036d7b6179fa5 (patch)
treee36226f3b75ec24ca41342d819cb3a22ef10fc34
parent8aeb5afe7d8c3cb9f2d3aad45d573cbb59566412 (diff)
downloadevol-hercules-1d34b1d90999a9dda263c8235e5036d7b6179fa5.tar.gz
evol-hercules-1d34b1d90999a9dda263c8235e5036d7b6179fa5.tar.bz2
evol-hercules-1d34b1d90999a9dda263c8235e5036d7b6179fa5.tar.xz
evol-hercules-1d34b1d90999a9dda263c8235e5036d7b6179fa5.zip
map: overload job/class related functions.
-rw-r--r--src/map/init.c5
-rw-r--r--src/map/pc.c42
-rw-r--r--src/map/pc.h10
3 files changed, 57 insertions, 0 deletions
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