Follow up to c23688c

Unify all checks into one function.
Suggested by @Cydh.
This commit is contained in:
Jittapan Pluemsumran 2016-03-26 10:52:30 +07:00
parent c23688cea4
commit bd6539a9ba
27 changed files with 63 additions and 47 deletions

View File

@ -454,7 +454,7 @@ Zeny_short_SP:
L_Storage:
next;
if(basicskillcheck() > 0 && getskilllv("NV_BASIC") < 6) goto L_StorageJBlow;
if(!callfunc("F_CanOpenStorage")) goto L_StorageJBlow;
set @fee, $QW_S_PRICE;
if ($QW_S_PRICE == 60)&&(BaseJob == Job_Novice) set @fee, 30;
if ($QW_S_PRICE == 60)&&(BaseJob != Job_Novice) set @fee, 60;

View File

@ -349,7 +349,7 @@ OnRecvCastle:
next;
switch (select("Use Storage:Use Teleport Service:Rent a Pushcart:Cancel")) {
case 1:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Kafra Employee]";
mes "I'm sorry, but you";
mes "need the Novice's";

View File

@ -848,7 +848,7 @@ OnInit:
next;
switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
case 1:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Kafra Employee]";
mes "I'm so sorry, but you must";
mes "have at least Novice Skill";

View File

@ -39,7 +39,7 @@ que_ng,152,167,3 script Master Miller 901,{
close;
}
if (Class == Job_Novice) {
if (JobLevel < 10 || (basicskillcheck() && getskilllv("NV_BASIC") < 9)) {
if (!callfunc("F_CanChangeJob")) {
mes "[Master Miller]";
mes "Interested in becoming";
mes "a Gunslinger, eh? You've";

View File

@ -80,7 +80,7 @@ payon,157,141,5 script Phoenix#TKJobChange 753,{
mes "art. It won't be easy, but it will lead you to great strength...";
next;
if(select("Okay, I will join you.","No, thank you.") == 1) {
if(basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if(!callfunc("F_CanChangeJob")) {
mes "[Phoenix]";
mes "How unfortunate!";
mes "You're not yet ready to";

View File

@ -142,7 +142,7 @@ aldeba_in,223,167,3 script Tzerero#sn 709,{
next;
switch(select("Accept his offer.:Reject his offer.:Listen more carefully.")) {
case 1:
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Tzerero]";
mes "Hmm...But do you truly";
mes "appreciate the value of";

View File

@ -44,7 +44,7 @@ function script F_CoolEventCorp {
break;
case 2:
mes "[Cool Event Corp. Staff]";
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "I'm sorry, but you";
mes "need the Novice's";
mes "Basic Skill Level 6 to";

View File

@ -221,7 +221,7 @@ function script F_KafStor {
close;
}
// Unable to access Normal Storage (Insufficient Basic Skills)
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Kafra Employee]";
// Niflheim Specific Message
if (getarg(2) == 1) {

View File

@ -3,7 +3,7 @@
//===== By: ==================================================
//= Lupus, kobra_k88
//===== Current Version: =====================================
//= 2.24
//= 2.25
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
@ -47,6 +47,7 @@
//= 2.22 Further improvements to "F_GetPlural". [Euphy]
//= 2.23 Completed article function and added "F_GetArticle". [Euphy]
//= 2.24 Added functions to check for equipment swap hacks. [Euphy]
//= 2.25 Added "F_CanOpenStorage" and "F_CanChangeJob". [secretdataz]
//============================================================
//////////////////////////////////////////////////////////////////////////////////
@ -592,3 +593,18 @@ function script F_GetNumSuffix {
else if (.@mod == 3 && .@n != 13) return .@n+"rd";
else return .@n+"th";
}
//////////////////////////////////////////////////////////////////////////////////
// Indicate if attached player can open storage
//////////////////////////////////////////////////////////////////////////////////
function script F_CanOpenStorage {
return (!basicskillcheck() || !(getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1));
}
//////////////////////////////////////////////////////////////////////////////////
// Indicate if attached player can advance to class 1 by checking
// basic skill level 9.
//////////////////////////////////////////////////////////////////////////////////
function script F_CanChangeJob {
return (!basicskillcheck() || getskilllv("NV_BASIC") > 8);
}

View File

@ -38,7 +38,7 @@ prt_church,184,41,4 script Cleric#aco 60,{
mes "Ah, I sense you have endured";
mes "a past life experience. You must have learned many things before entering Valhalla.";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Father Mareusis]";
mes "Unfortunately, I don't think you're ready to become an Acolyte yet. Please finish learning all of the Basic Skills first.";
next;
@ -137,7 +137,7 @@ prt_church,184,41,4 script Cleric#aco 60,{
mes "Oh, you've come back. Let me check and see if you are ready to serve God. Let's see...";
next;
mes "[Father Mareusis]";
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "Good Lord! Haven't you accomplished the Basic Training yet?! It's important that you finish that!";
next;
mes "[Father Mareusis]";

View File

@ -37,7 +37,7 @@ payon_in02,64,71,4 script Archer Guildsman#archer 85,{
mes "to Valhalla and been reborn.";
mes "Wow, that's so impressive!";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Archer Guildsman]";
mes "Err...";
mes "You'd better learn all the Basic Skills first before you can become an Archer.";
@ -125,7 +125,7 @@ payon_in02,64,71,4 script Archer Guildsman#archer 85,{
mes "[Archer Guildsman]";
mes "Are you..." + strcharinfo(0) + "?";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Archer Guildsman]";
mes "Well, you're not at the right job level. Please check the requirements again.";
next;

View File

@ -35,7 +35,7 @@ geffen_in,164,124,4 script Mage Guildsman 123,{
mes "[Mage Guildsman]";
mes "Ah, you must have been reborn. Well, I'm glad to have you back.";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Mage Guildsman]";
mes "I'm sorry, but I don't think you're ready to learn magic yet. Why don't you go finish learning the Basic Skills first?";
next;
@ -139,7 +139,7 @@ geffen_in,164,124,4 script Mage Guildsman 123,{
close;
}
mes "Yeah? Ready...?";
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "Oh, what a bummer. You haven't met the requirements yet.";
next;
mes "[Mage Guildsman]";

View File

@ -44,7 +44,7 @@ alberta_in,53,43,6 script Merchant#mer 86,{
mes "Whoa...";
mes "You've actually been to Valhalla?! Wow, you've come a long way...";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Chief Mahnsoo]";
mes "Hmmm...";
mes "It seems that you're not ready to become a Merchant again. Go finish learning the Basic Novice Skills first.";
@ -288,7 +288,7 @@ alberta_in,53,43,6 script Merchant#mer 86,{
mes "be a Merchant?";
mes "Well...";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Chief Mahnsoo]";
mes "First, you have to be a Novice with Job Level 10. Once you do that, make sure you learn all of the Basic Skills.";
next;

View File

@ -48,7 +48,7 @@ izlude_in,74,172,4 script Swordman#swd_1 119,{
mes "[Swordman]";
mes "I see you're retreading the path of the Swordman! Once you've gotten used to brandishing a sword, you can never go back!!";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Swordman]";
mes "Hmm? Ah, you must first master the Basic Skills before you are ready to become a Swordman.";
next;
@ -138,7 +138,7 @@ izlude_in,74,172,4 script Swordman#swd_1 119,{
}
}
mes "[Swordman]";
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "Hm, you still haven't learned all of the Basic Skills. You need to do that before you can become a Swordman.";
next;
mes "[Swordman]";
@ -213,7 +213,7 @@ izlude_in,62,170,6 script Swordman#swd_2 85,{
mes "Who the hell are you?! Nobody, other than Novices, is permitted to come in here!";
close;
}
else if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
else if (!callfunc("F_CanChangeJob")) {
mes "Stop! I can't let you in until you learn all of the Basic Skills. The Test Hall isn't for goofing off!";
close;
}

View File

@ -29,7 +29,7 @@ moc_prydb1,39,129,2 script Thief Guide 69,{
mes "[Thief Guide]";
mes "Huh? Do I know you? It's creepy that you seem so familiar. You don't have a twin, do you?";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Thief Guide]";
mes "What, do you want to be a Thief? I'm sorry, but you look like you need more training.";
next;
@ -290,7 +290,7 @@ moc_prydb1,39,129,2 script Thief Guide 69,{
mes strcharinfo(0) + "? Um, where is it? Ah, here it is. Let's see...";
next;
mes "[Thief Guide]";
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "Isn't that cute? I can see you're ambitious, but you gotta learn all of the Basic Skills before you can become a Thief.";
close;
}

View File

@ -7655,7 +7655,7 @@ function Catwarp;
mes "You can now directly return to this camp.";
close;
case 2:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Cat Hand Agent]";
mes "I'm sorry, but you";
mes "need the Novice's";
@ -7702,7 +7702,7 @@ function Catwarp;
mes "You can now directly return to this camp.";
close;
case 2:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Cat Hand Agent]";
mes "I'm sorry, but you";
mes "need the Novice's";
@ -7824,7 +7824,7 @@ function Catwarp;
mes "You can now directly return to this camp.";
close;
case 2:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Cat Hand Agent]";
mes "I'm sorry, but you";
mes "need the Novice's";

View File

@ -99,7 +99,7 @@ spl_fild02,25,211,4 script Cat Hand Agent#spl 421,{
mes "You can now directly return to this camp.";
close;
case 2:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Cat Hand Agent]";
mes "I'm sorry, but you";
mes "need the Novice's";
@ -146,7 +146,7 @@ spl_fild02,25,211,4 script Cat Hand Agent#spl 421,{
mes "You can now directly return to this camp.";
close;
case 2:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Cat Hand Agent]";
mes "I'm sorry, but you";
mes "need the Novice's";
@ -267,7 +267,7 @@ spl_fild02,25,211,4 script Cat Hand Agent#spl 421,{
mes "You can now directly return to this camp.";
close;
case 2:
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Cat Hand Agent]";
mes "I'm sorry, but you";
mes "need the Novice's";

View File

@ -1166,7 +1166,7 @@ mora,43,127,3 script Innkeeper#mora_inn 522,{
}
mora,48,128,0 script Drawer#mora_warehouse 111,{
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "- You don't remember how to open the warehouse. -";
close;
}

View File

@ -21,7 +21,7 @@ prt_church,184,41,4 script Cleric#aco 60,{
mes "Ah, I sense you have endured";
mes "a past life experience. You must have learned many things before entering Valhalla.";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Father Mareusis]";
mes "Unfortunately, I don't think you're ready to become an Acolyte yet. Please finish learning all of the Basic Skills first.";
next;
@ -75,7 +75,7 @@ prt_church,184,41,4 script Cleric#aco 60,{
mes "Do you truly wish to become a servant of God?";
mes "Let's see whether you are ready for it or not... Hmm...";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Father Mareusis]";
mes "Oh my?! You haven't accomplished the basic practice yet?! You have a long way to go! Come again after increasing your job level!";
close;

View File

@ -25,7 +25,7 @@ payon_in02,64,71,4 script Archer Guildsman#archer 85,{
mes "to Valhalla and been reborn.";
mes "Wow, that's so impressive!";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Archer Guildsman]";
mes "Err...";
mes "You'd better learn all the Basic Skills first before you can become an Archer.";
@ -76,7 +76,7 @@ payon_in02,64,71,4 script Archer Guildsman#archer 85,{
}else{
mes "You are... "+strcharinfo(0)+", right?";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Archer Guildsman]";
mes "Well, you're not at the right skill level.";
mes "Your job level must be at least ^4A4AFF10^000000 and your Basic Skill level should reach ^4A4AFFlevel 9";

View File

@ -22,7 +22,7 @@ geffen_in,164,124,4 script Mage Guildsman#mage 123,{
mes "[Mage Guildsman]";
mes "Ah, you must have been reborn. Well, I'm glad to have you back.";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Mage Guildsman]";
mes "I'm sorry, but I don't think you're ready to learn magic yet. Why don't you go finish learning the Basic Skills first?";
next;
@ -84,7 +84,7 @@ geffen_in,164,124,4 script Mage Guildsman#mage 123,{
close;
}
mes "[Mage Guildsman]";
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "Oh, man your Basic Skill Level doesn't reach enough to be a Mage.";
mes "Go back and level up your Basic Skill.";
close;

View File

@ -25,7 +25,7 @@ alberta_in,53,43,6 script Merchant#mer 86,{
mes "Whoa...";
mes "You've actually been to Valhalla?! Wow, you've come a long way...";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Chief Mahnsoo]";
mes "Hmmm...";
mes "It seems that you're not ready to become a Merchant again. Go finish learning the Basic Novice Skills first.";
@ -75,7 +75,7 @@ alberta_in,53,43,6 script Merchant#mer 86,{
}else{
mes "Want to be a merchant? Hmm...";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Guildsman Mahnsoo]";
mes "But if you want to be a merchant, your basic skill level must reach Level 9 or you must spend all of your skill points.";
next;

View File

@ -23,7 +23,7 @@ izlude_in,74,172,4 script Swordman#swd 119,{
mes "[Swordman]";
mes "I see you're retreading the path of the Swordman! Once you've gotten used to brandishing a sword, you can never go back!!";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Swordman]";
mes "Hmm? Ah, you must first master the Basic Skills before you are ready to become a Swordman.";
next;
@ -92,7 +92,7 @@ izlude_in,74,172,4 script Swordman#swd 119,{
}
close;
}else{
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "I'm sorry to tell you this but to be a Swordman, you must reach at least ^4A4AFFJob Level 10^000000.";
mes "and ^4A4AFFBasic Skill Level 9^000000.";
next;

View File

@ -19,7 +19,7 @@ moc_prydb1,39,129,2 script Thief Guide#thief 69,{
mes "[Thief Guide]";
mes "Huh? Do I know you? It's creepy that you seem so familiar. You don't have a twin, do you?";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Thief Guide]";
mes "What, do you want to be a Thief? I'm sorry, but you look like you need more training.";
next;
@ -136,7 +136,7 @@ moc_prydb1,39,129,2 script Thief Guide#thief 69,{
mes "Alright, tell me your name. Huh? What?";
mes ""+strcharinfo(0)+". So "+strcharinfo(0)+", right...?";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Thief Guildsman]";
mes "I can see your strong will to become a Thief......";
mes "But only with your will, you cannot make it in a real fight, can you?";

View File

@ -3182,7 +3182,7 @@ iz_ac01,36,52,3 script Odd Novice#ac 4_M_SIT_NOVICE,{
mes "Get away from me kid you're botherin' me.";
close;
} else {
if (basicskillcheck() && getskilllv("NV_BASIC") > 8) {
if (!callfunc("F_CanChangeJob")) {
mes "[Odd Novice]";
mes "You, talking like this, why don't you go and change your job already instead of hanging around here?";
mes "Hmm, did you want to be like me maybe?";
@ -5183,7 +5183,7 @@ iz_ac01,95,46,5 script Kafra Guide Trainer#ac 4_F_KAFRA1,{
mes "[Kafra Guide Trainer]";
mes "Storage is necessary for you to survive so use it regularly.";
} else {
if (basicskillcheck() && getskilllv("NV_BASIC") < 6) {
if (!callfunc("F_CanOpenStorage")) {
mes "[Kafra Guide Trainer]";
mes "To use the storage, you need to be raised the beginner level 6 and higher.";
} else if (countitem(7059) || Zeny >= 500) {
@ -9303,7 +9303,7 @@ iz_ac02,148,110,3 script Mage Chuck#ac 4_M_JOB_WIZARD,{
mes "[Mage Chuck]";
mes "You must first reach ^006400Job level 10^000000 and ^006400Basic Skill level 9^000000.";
next;
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Mage Chuck]";
mes "You don't seem ready!";
mes "If you want to change your job, you must first be ^006400Job level 10^000000 and ^006400Basic Skill level 9^000000.";
@ -12334,7 +12334,7 @@ iz_ac02,140,139,5 script Ninja Guide#ac 4_M_NINJA_BLUE,{
}
break;
case 2:
if (basicskillcheck() && getskilllv("NV_BASIC") < 9) {
if (!callfunc("F_CanChangeJob")) {
mes "[Ninja Guide]";
mes "I appreciate your braveness but, first of all, you have to be familiar with the current profession.";
next;

View File

@ -40,7 +40,7 @@
switch(select("Use the Cabinet.:Cancel.")) {
case 1:
if (Zeny > 499) {
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "The cabinet is not working for me.";
mes "Maybe I am not yet qualified to use Cabinet.";
close;

View File

@ -327,7 +327,7 @@ malangdo,184,139,4 script Storekeeper#mal 560,{
set .@zeny,3000;
set .@i, select("Pay with Can ----- 2units:Pay with Zeny ------- 3,000z");
}
if(basicskillcheck() && (getskilllv("NV_BASIC") < 6 && getskilllv("SU_BASIC_SKILL") < 1)){
if(!callfunc("F_CanOpenStorage")){
mes "[Storekeeper]";
mes "Ah, hold on!!";
mes "You need to have ^FF0000Basic Skill level 6^000000 to use the storage service!!";