Last active
January 6, 2017 01:31
-
-
Save cydh/01c8c0ce386b19c0f3c19c269f6bb855 to your computer and use it in GitHub Desktop.
To disable certain job in rAthena just comment the job line from db/[pre-]re/job_db1.txt. Example usage to disable 2 Trans, 3rd, Babies, and Expanded for Ragnarok server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/conf/msg_conf/map_msg.conf b/conf/msg_conf/map_msg.conf | |
index f4dfc46..ab14daa 100644 | |
--- a/conf/msg_conf/map_msg.conf | |
+++ b/conf/msg_conf/map_msg.conf | |
@@ -753,7 +753,8 @@ | |
//Skill messages | |
720: %s is required. | |
721: [%s] Poison effect was applied to the weapon. | |
-//722: Free | |
+ | |
+722: This job is unavailable. | |
// @costume | |
723: '%s' is an unknown costume | |
diff --git a/doc/script_commands.txt b/doc/script_commands.txt | |
index f42dd3c..1557d1b 100644 | |
--- a/doc/script_commands.txt | |
+++ b/doc/script_commands.txt | |
@@ -4333,6 +4333,13 @@ See also db/[pre-]re/job_noenter_map.txt | |
--------------------------------------- | |
+*isjob(JobID); | |
+ | |
+Return true if JobID is available in the server. | |
+JobID is constant of Job_*. | |
+ | |
+--------------------------------------- | |
+ | |
*get_revision() | |
This command will return the SVN revision number that the server is currently | |
diff --git a/src/map/atcommand.c b/src/map/atcommand.c | |
index fbbd570..89b599f 100644 | |
--- a/src/map/atcommand.c | |
+++ b/src/map/atcommand.c | |
@@ -1048,6 +1048,11 @@ ACMD_FUNC(jobchange) | |
} | |
} | |
+ if (!pc_job_is_available((enum e_job)job)) { | |
+ clif_displaymessage(fd, msg_txt(sd,722)); // This job is unavailable. | |
+ return -1; | |
+ } | |
+ | |
if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER || job == JOB_HANBOK || job == JOB_OKTOBERFEST | |
|| job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2 | |
|| (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2)) | |
diff --git a/src/map/pc.c b/src/map/pc.c | |
index 7c939f0..8df6169 100755 | |
--- a/src/map/pc.c | |
+++ b/src/map/pc.c | |
@@ -12187,6 +12187,22 @@ bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv) { | |
} | |
/** | |
+ * Check if job is available or not | |
+ * @param jobid Job ID see enum e_job or sd->status.class_ | |
+ * @return True:Available, False:Unavailable | |
+ **/ | |
+bool pc_job_is_available(enum e_job jobid) { | |
+ uint16 idx = 0; | |
+ if (!pcdb_checkid(jobid)) | |
+ return false; | |
+ idx = pc_class2idx(jobid); | |
+ if (job_info[idx].max_weight_base) | |
+ return true; | |
+ return false; | |
+} | |
+ | |
+ | |
+/** | |
* Tells client about player's costume view on mapchange for checking 'nocostume' mapflag. | |
* @param sd | |
**/ | |
diff --git a/src/map/pc.h b/src/map/pc.h | |
index acab411..c3ef62c 100644 | |
--- a/src/map/pc.h | |
+++ b/src/map/pc.h | |
@@ -1294,6 +1294,7 @@ void pc_show_questinfo(struct map_session_data *sd); | |
void pc_show_questinfo_reinit(struct map_session_data *sd); | |
bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv); | |
+bool pc_job_is_available(enum e_job jobid); | |
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) | |
int pc_level_penalty_mod(int level_diff, uint32 mob_class, enum e_mode mode, int type); | |
diff --git a/src/map/script.c b/src/map/script.c | |
index 1d1c044..d35e500 100644 | |
--- a/src/map/script.c | |
+++ b/src/map/script.c | |
@@ -22108,6 +22108,19 @@ BUILDIN_FUNC(openstorage2) { | |
return SCRIPT_CMD_SUCCESS; | |
} | |
+/** | |
+ * Check if job is available in server | |
+ * isjob(jobid); | |
+ **/ | |
+BUILDIN_FUNC(isjob) { | |
+ int job = script_getnum(st, 2); | |
+ if (!pc_job_is_available((enum e_job)job)) | |
+ script_pushint(st, 0); | |
+ else | |
+ script_pushint(st, 1); | |
+ return SCRIPT_CMD_SUCCESS; | |
+} | |
+ | |
#include "../custom/script.inc" | |
// declarations that were supposed to be exported from npc_chat.c | |
@@ -22703,6 +22716,7 @@ struct script_function buildin_func[] = { | |
BUILDIN_DEF(needed_status_point,"ii?"), | |
BUILDIN_DEF(jobcanentermap,"s?"), | |
BUILDIN_DEF(openstorage2,"ii?"), | |
+ BUILDIN_DEF(isjob,"i"), | |
// WoE TE | |
BUILDIN_DEF(agitstart3,""), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment