summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-11-30 02:58:47 +0100
committerHaru <haru@dotalux.com>2016-12-03 15:38:55 +0100
commitcfa4ae95efca5557d085c56815259f47e6f380fb (patch)
treee08b55a2c9fb546f7f2ed41977f1e0bb8041e445 /src/map/itemdb.c
parentb0fde17b0ee155f1123e9ae6148ddd2df88cd965 (diff)
downloadhercules-cfa4ae95efca5557d085c56815259f47e6f380fb.tar.gz
hercules-cfa4ae95efca5557d085c56815259f47e6f380fb.tar.bz2
hercules-cfa4ae95efca5557d085c56815259f47e6f380fb.tar.xz
hercules-cfa4ae95efca5557d085c56815259f47e6f380fb.zip
Clarify some Job Class vs MapID confusion (1/2)
This commit ensures that `sd->status.class` and related variables only contain Job Classes (i.e. the client-compatible values, where High Novice 4001) and are never checked against the bitmask-based MapID values. As a rule of thumb, from now on, when a variable is named `class`, it is intended to contain a Job Class ID and not a MapID. The type of such variable shall be a signed `int16` or `int`. To ensure that related third party code is also verified when this commit is merged, the variable `struct mmo_charstatus::class_ (i.e. `sd->status.class_`) is renamed to `class`. Some issues in related lines are also fixed, including: - A wrong check in the char server would prevent the correct detection of babies in code related to the family exp sharing. - Baby Arch Bishops would not be affected by Eucharistica. - A wrong check would cause the `questinfo()` script command not to display its information for most classes (except 1-1 classes). - Map IDs and Job Classes were mixed up in `itemdb_jobid2mapid()` and `itemdb_jobmask2mapid()` for 1-1 classes (causing currently no harm, since they just happen to coincide). - The Baby Sura class would not cause parties to be marked as containing a monk type character (for SLS Team Up purposes). - Baby Geneticists would bypass the cart check when trying to equip ammunitions. - Baby Mechanics would bypass the Mado Gear check when trying to equip ammunitions. - Transcendent Shadow Chasers would lose the Stalkers' ability to clone transcendent skills. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 58397a2ee..445307aeb 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -352,14 +352,14 @@ const char* itemdb_typename(int type)
*
* @author Dastgir
*/
-void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable)
+void itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable)
{
uint64 mask[3] = { 0 };
int i;
nullpo_retv(bclass);
- switch(job_id) {
+ switch (job_class) {
// Base Classes
case JOB_NOVICE:
case JOB_SUPER_NOVICE:
@@ -367,12 +367,22 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable)
mask[1] = 1ULL << MAPID_NOVICE;
break;
case JOB_SWORDMAN:
+ mask[0] = 1ULL << MAPID_SWORDMAN;
+ break;
case JOB_MAGE:
+ mask[0] = 1ULL << MAPID_MAGE;
+ break;
case JOB_ARCHER:
+ mask[0] = 1ULL << MAPID_ARCHER;
+ break;
case JOB_ACOLYTE:
+ mask[0] = 1ULL << MAPID_ACOLYTE;
+ break;
case JOB_MERCHANT:
+ mask[0] = 1ULL << MAPID_MERCHANT;
+ break;
case JOB_THIEF:
- mask[0] = 1ULL << (MAPID_NOVICE+job_id);
+ mask[0] = 1ULL << MAPID_THIEF;
break;
// 2-1 Classes
case JOB_KNIGHT:
@@ -471,7 +481,6 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable)
*/
void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask)
{
- int i;
nullpo_retv(bclass);
bclass[0] = bclass[1] = bclass[2] = 0;
//Base classes
@@ -480,10 +489,18 @@ void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask)
bclass[0] |= 1ULL<<MAPID_NOVICE;
bclass[1] |= 1ULL<<MAPID_NOVICE;
}
- for (i = JOB_NOVICE+1; i <= JOB_THIEF; i++) {
- if (jobmask & 1ULL<<i)
- bclass[0] |= 1ULL<<(MAPID_NOVICE+i);
- }
+ if (jobmask & 1ULL<<JOB_SWORDMAN)
+ bclass[0] |= 1ULL<<MAPID_SWORDMAN;
+ if (jobmask & 1ULL<<JOB_MAGE)
+ bclass[0] |= 1ULL<<MAPID_MAGE;
+ if (jobmask & 1ULL<<JOB_ARCHER)
+ bclass[0] |= 1ULL<<MAPID_ARCHER;
+ if (jobmask & 1ULL<<JOB_ACOLYTE)
+ bclass[0] |= 1ULL<<MAPID_ACOLYTE;
+ if (jobmask & 1ULL<<JOB_MERCHANT)
+ bclass[0] |= 1ULL<<MAPID_MERCHANT;
+ if (jobmask & 1ULL<<JOB_THIEF)
+ bclass[0] |= 1ULL<<MAPID_THIEF;
//2-1 classes
if (jobmask & 1ULL<<JOB_KNIGHT)
bclass[1] |= 1ULL<<MAPID_SWORDMAN;