summaryrefslogtreecommitdiff
path: root/npc/kafras
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-07-20 01:33:48 +0200
committerHaru <haru@dotalux.com>2014-07-20 01:37:12 +0200
commit5955d81ac5360e073c66f961c2750da4645860bb (patch)
tree1cf7db67aecdfc4ae8d68cd66168e75c4837b1a6 /npc/kafras
parente474973e0a9f057fff212d4f6ba445d189993764 (diff)
downloadhercules-5955d81ac5360e073c66f961c2750da4645860bb.tar.gz
hercules-5955d81ac5360e073c66f961c2750da4645860bb.tar.bz2
hercules-5955d81ac5360e073c66f961c2750da4645860bb.tar.xz
hercules-5955d81ac5360e073c66f961c2750da4645860bb.zip
Removed duplicate code from the Cool Event NPCs
- Moved common code to a function. - Modified to use appropriate functions from function_kafras.txt. - Modernized syntax/updated function documentation in both files. - Fixed the Rachel NPC incorrectly stating it's warping you to Rachel, instead of Veins. - Special thanks to jaBote, GubA. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'npc/kafras')
-rw-r--r--npc/kafras/cool_event_corp.txt416
-rw-r--r--npc/kafras/functions_kafras.txt337
2 files changed, 249 insertions, 504 deletions
diff --git a/npc/kafras/cool_event_corp.txt b/npc/kafras/cool_event_corp.txt
index 4566d36f0..911f54af2 100644
--- a/npc/kafras/cool_event_corp.txt
+++ b/npc/kafras/cool_event_corp.txt
@@ -3,7 +3,7 @@
//===== By: ==================================================
//= Gepard
//===== Current Version: =====================================
-//= 1.5
+//= 2.0
//===== Description: =========================================
//= Cool Event Corp. Staff (Save, Storage & Pushcart Service)
//= in Arunafeltz Region.
@@ -16,9 +16,15 @@
//= until we got a client/packet based password support [Lupus]
//= 1.4 Added Veins Cool Event Corp. Staff. [L0ne_W0lf]
//= 1.5 Cool Event Corp staff is now more iRO like. [L0ne_W0lf]
+//= 2.0 Moved duplicate code to a function. Better integrated
+// the rest with functions_kafra.txt. [Haru]
//============================================================
-hugel,88,168,4 script Cool Event Corp. Staff::CoolEventCorpStaffHugel 4_M_ZONDAMAN,{
+//=== Main Function ========================================================
+//= arg(0): Used to determine which menu to display.
+//= arg(1): Used to determine the location displayed in the save message.
+//==========================================================================
+function script F_ZondaStaff {
cutin "zonda_01",2;
mes "[Cool Event Corp. Staff]";
mes "Welcome to Cool Event Corp.";
@@ -27,100 +33,44 @@ hugel,88,168,4 script Cool Event Corp. Staff::CoolEventCorpStaffHugel 4_M_ZONDAM
mes "for quality service. So how";
mes "may I assist you today?";
next;
- switch(select("Save:Use Storage:Rent a Pushcart:Storage Password Service:Cancel")){
- case 1:
+ switch (getarg(0)) {
+ // Save, Storage, Pushcart, Storage Password (Hugel)
+ case 0: setarray @Z_Menu0$, "Save", "Use Storage", "Rent a Pushcart", "Storage Password Service", "Cancel"; break;
+ // Save, Storage, Pushcart, Storage Password (Veins, Rachel)
+ default:
+ case 1: setarray @Z_Menu0$, "Save", "Use Storage", "Teleport Service", "Rent a Pushcart", "Storage Password Service", "Cancel"; break;
+ }
+ .@menu$ = "";
+ for (.@i = 0; .@i < getarraysize(@Z_Menu0$); ++.@i)
+ .@menu$ += @Z_Menu0$[.@i] + ":";
+ .@j = select (.@menu$) - 1;
+ if (@Z_Menu0$[.@j] == "Save") {
mes "[Cool Event Corp. Staff]";
mes "Your Respawn Point";
mes "has been saved here";
- mes "in the village of Hugel.";
+ mes getarg(1);
mes "Thank you for using the";
mes "Cool Event Corp. service~";
- savepoint "hugel",96,155;
+ return;
+ } else if (@Z_Menu0$[.@j] == "Use Storage") {
+ callfunc "F_KafStor",0,40,6,"[Cool Event Corp. Staff]";
close2;
- break;
- case 2:
- mes "[Cool Event Corp. Staff]";
- if(basicskillcheck() && getskilllv("NV_BASIC") < 6){
- mes "I'm sorry, but you";
- mes "need the Novice's";
- mes "Basic Skill Level 6 to";
- mes "use the Storage Service.";
- close2;
- break;
- }
- if(Zeny < 40){
- mes "I'm sorry, but you don't";
- mes "have enough Zeny to use";
- mes "the Storage Service. Our";
- mes "Storage access fee is 40 Zeny.";
- close2;
- break;
- }
- Zeny -= 40;
- mes "Let me open your personal";
- mes "storage for you right away.";
- mes "Thanks for supporting Cool";
- mes "Event Corp. by using our";
- mes "services. Have a good day~";
- callfunc("F_CheckKafCode"); //check your storage password, if set
+ cutin "", 255;
+ end;
+ } else if (@Z_Menu0$[.@j] == "Teleport Service") {
+ callfunc "F_KafTele", 6, "[Cool Event Corp. Staff]";
close2;
- openstorage;
- break;
- case 3:
- mes "[Cool Event Corp. Staff]";
- if(BaseClass != Job_Merchant){
- mes "I'm sorry, but the";
- mes "Pushcart rental service";
- mes "is only available to Merchants,";
- mes "Blacksmiths, White Smiths,";
- mes "Alchemists and Creators.";
- close2;
- break;
- }
- if(getskilllv("MC_PUSHCART") == 0){
- mes "You can only rent a cart after";
- mes "learning the Pushcart Skill.";
- close2;
- break;
- }
- if(checkcart() == 1){
- mes "You already have";
- mes "a Pushcart equipped.";
- mes "Unfortunately, we can't";
- mes "rent more than one to";
- mes "each customer at a time.";
- close2;
- break;
- }
- if(countitem(7061)){
- delitem 7061,1;
- setcart;
- close2;
- break;
- }
- mes "The Pushcart rental";
- mes "fee is 800 Zeny. Would";
- mes "you like to rent a Pushcart?";
- next;
- if(select("Rent a Pushcart:Cancel") == 1){
- if(Zeny < 800){
- mes "[Cool Event Corp. Staff]";
- mes "I'm sorry, but you";
- mes "don't have enough";
- mes "Zeny to pay the Pushcart";
- mes "rental fee of 800 Zeny.";
- } else {
- Zeny -= 800;
- setcart;
- }
- }
+ cutin "", 255;
+ end;
+ } else if (@Z_Menu0$[.@j] == "Rent a Pushcart") {
+ callfunc "F_KafCart", 6, 800, "[Cool Event Corp. Staff]";
close2;
- break;
- case 4:
+ cutin "", 255;
+ end;
+ } else if (@Z_Menu0$[.@j] == "Storage Password Service") {
callfunc("F_SetKafCode","[Cool Event Corp. Staff]","Cool Event Corp.");
- //the function closes msg and remoes cutins
- case 5:
- default:
+ //the function closes msg and removes cutins
+ } else {
mes "[Cool Event Corp. Staff]";
mes "Cool Event Corp. is always";
mes "striving to provide the best";
@@ -134,287 +84,29 @@ hugel,88,168,4 script Cool Event Corp. Staff::CoolEventCorpStaffHugel 4_M_ZONDAM
end;
}
+hugel,88,168,4 script Cool Event Corp. Staff::CoolEventCorpStaffHugel 4_M_ZONDAMAN,{
+ callfunc "F_KafSet";
+ callfunc "F_ZondaStaff", 0, "in the village of Hugel.";
+ savepoint "hugel",96,155;
+ close2;
+ cutin "", 255;
+ end;
+}
+
rachel,109,138,5 script Cool Event Corp. Staff::CoolEventCorpStaffRachel 4_M_ZONDAMAN,{
- cutin "zonda_01",2;
- mes "[Cool Event Corp. Staff]";
- mes "Welcome to Cool Event Corp.";
- mes "Our staff is always working";
- mes "to surpass your expactations";
- mes "for quality service. So how";
- mes "may I assist you today?";
- next;
- switch(select("Save:Use Storage:Teleport Service:Rent a Pushcart:Storage Password Service:Cancel")){
- case 1:
- mes "[Cool Event Corp. Staff]";
- mes "Your Respawn Point";
- mes "has been saved here";
- mes "in the town of Rachel.";
- mes "Thank you for using the";
- mes "Cool Event Corp. service~";
- savepoint "rachel",113,137;
- close2;
- break;
- case 2:
- mes "[Cool Event Corp. Staff]";
- if(basicskillcheck() && getskilllv("NV_BASIC") < 6){
- mes "I'm sorry, but you";
- mes "need the Novice's";
- mes "Basic Skill Level 6 to";
- mes "use the Storage Service.";
- close2;
- break;
- }
- if(Zeny < 40){
- mes "I'm sorry, but you don't";
- mes "have enough Zeny to use";
- mes "the Storage Service. Our";
- mes "Storage access fee is 40 Zeny.";
- close2;
- break;
- }
- Zeny -= 40;
- mes "Let me open your personal";
- mes "storage for you right away.";
- mes "Thanks for supporting Cool";
- mes "Event Corp. by using our";
- mes "services. Have a good day~";
- callfunc("F_CheckKafCode"); //check your storage password, if set
- close2;
- openstorage;
- break;
- case 3:
- mes "Please choose";
- mes "your destination.";
- next;
- if (select("Veins -> 2200 z:Cancel") == 1) {
- if ((countitem(7060) != 0) || (Zeny >= 2200)) {
- if (countitem(7060) != 0) {
- delitem 7060,1;
- }
- else {
- Zeny -= 2200;
- }
- warp "veins",205,101;
- cutin "",255;
- end;
- }
- else {
- mes "[Cool Event Corp. Staff]";
- mes "I'm sorry, but you don't have";
- mes "enough zeny for the Teleport";
- mes "Service. The fee to teleport";
- mes "to Rachel is 2200 zeny.";
- }
- }
- close2;
- break;
- case 4:
- mes "[Cool Event Corp. Staff]";
- if(BaseClass != Job_Merchant){
- mes "I'm sorry, but the";
- mes "Pushcart rental service";
- mes "is only available to Merchants,";
- mes "Blacksmiths, White Smiths,";
- mes "Alchemists and Creators.";
- close2;
- break;
- }
- if(getskilllv("MC_PUSHCART") == 0){
- mes "You can only rent a cart after";
- mes "learning the Pushcart Skill.";
- close2;
- break;
- }
- if(checkcart() == 1){
- mes "You already have";
- mes "a Pushcart equipped.";
- mes "Unfortunately, we can't";
- mes "rent more than one to";
- mes "each customer at a time.";
- close2;
- break;
- }
- if(countitem(7061)){
- delitem 7061,1;
- setcart;
- close2;
- break;
- }
- mes "The Pushcart rental";
- mes "fee is 800 Zeny. Would";
- mes "you like to rent a Pushcart?";
- next;
- if(select("Rent a Pushcart:Cancel") == 1){
- if(Zeny < 800){
- mes "[Cool Event Corp. Staff]";
- mes "I'm sorry, but you";
- mes "don't have enough";
- mes "Zeny to pay the Pushcart";
- mes "rental fee of 800 Zeny.";
- } else {
- Zeny -= 800;
- setcart;
- }
- }
- close2;
- break;
- case 5:
- callfunc("F_SetKafCode","[Cool Event Corp. Staff]","Cool Event Corp.");
- //the function closes msg and remoes cutins
- case 6:
- default:
- mes "[Cool Event Corp. Staff]";
- mes "Cool Event Corp. is always";
- mes "striving to provide the best";
- mes "services for our customers.";
- mes "Help us become the best by";
- mes "providing us with your opinions";
- mes "and honest feedback. Thank you.";
- close2;
- }
+ callfunc "F_KafSet";
+ callfunc "F_ZondaStaff", 1, "in the town of Rachel.";
+ savepoint "rachel",113,137;
+ close2;
cutin "", 255;
end;
}
veins,208,128,5 script Cool Event Corp. Staff::CoolEventCorpStaffVeins 4_M_ZONDAMAN,{
- cutin "zonda_01",2;
- mes "[Cool Event Corp. Staff]";
- mes "Welcome to Cool Event Corp.";
- mes "Our staff is always working";
- mes "to surpass your expactations";
- mes "for quality service. So how";
- mes "may I assist you today?";
- next;
- switch(select("Save:Use Storage:Teleport Service:Rent a Pushcart:Storage Password Service:Cancel")){
- case 1:
- mes "[Cool Event Corp. Staff]";
- mes "Your Respawn Point";
- mes "has been saved here";
- mes "in the town of Veins.";
- mes "Thank you for using the";
- mes "Cool Event Corp. service~";
- savepoint "veins",204,103;
- close2;
- break;
- case 2:
- mes "[Cool Event Corp. Staff]";
- if(basicskillcheck() && getskilllv("NV_BASIC") < 6){
- mes "I'm sorry, but you";
- mes "need the Novice's";
- mes "Basic Skill Level 6 to";
- mes "use the Storage Service.";
- close2;
- break;
- }
- if(Zeny < 40){
- mes "I'm sorry, but you don't";
- mes "have enough Zeny to use";
- mes "the Storage Service. Our";
- mes "Storage access fee is 40 Zeny.";
- close2;
- break;
- }
- Zeny -= 40;
- mes "Let me open your personal";
- mes "storage for you right away.";
- mes "Thanks for supporting Cool";
- mes "Event Corp. by using our";
- mes "services. Have a good day~";
- callfunc("F_CheckKafCode"); //check your storage password, if set
- close2;
- openstorage;
- break;
- case 3:
- mes "Please choose";
- mes "your destination.";
- next;
- if (select("Rachel -> 2200 z:Cancel") == 1) {
- if ((countitem(7060) != 0) || (Zeny >= 2200)) {
- if (countitem(7060) != 0) {
- delitem 7060,1;
- }
- else {
- Zeny -= 2200;
- }
- warp "rachel",115,125;
- cutin "",255;
- end;
- }
- else {
- mes "[Cool Event Corp. Staff]";
- mes "I'm sorry, but you don't have";
- mes "enough zeny for the Teleport";
- mes "Service. The fee to teleport";
- mes "to Rachel is 2200 zeny.";
- }
- }
- close2;
- break;
- case 4:
- mes "[Cool Event Corp. Staff]";
- if(BaseClass != Job_Merchant){
- mes "I'm sorry, but the";
- mes "Pushcart rental service";
- mes "is only available to Merchants,";
- mes "Blacksmiths, White Smiths,";
- mes "Alchemists and Creators.";
- close2;
- break;
- }
- if(getskilllv("MC_PUSHCART") == 0){
- mes "You can only rent a cart after";
- mes "learning the Pushcart Skill.";
- close2;
- break;
- }
- if(checkcart() == 1){
- mes "You already have";
- mes "a Pushcart equipped.";
- mes "Unfortunately, we can't";
- mes "rent more than one to";
- mes "each customer at a time.";
- close2;
- break;
- }
- if(countitem(7061)){
- delitem 7061,1;
- setcart;
- close2;
- break;
- }
- mes "The Pushcart rental";
- mes "fee is 800 Zeny. Would";
- mes "you like to rent a Pushcart?";
- next;
- if(select("Rent a Pushcart:Cancel") == 1){
- if(Zeny < 800){
- mes "[Cool Event Corp. Staff]";
- mes "I'm sorry, but you";
- mes "don't have enough";
- mes "Zeny to pay the Pushcart";
- mes "rental fee of 800 Zeny.";
- close2;
- } else {
- Zeny -= 800;
- setcart;
- }
- }
- close2;
- break;
- case 5:
- callfunc("F_SetKafCode","[Cool Event Corp. Staff]","Cool Event Corp.");
- //the function closes msg and remoes cutins
- case 6:
- default:
- mes "[Cool Event Corp. Staff]";
- mes "Cool Event Corp. is always";
- mes "striving to provide the best";
- mes "services for our customers.";
- mes "Help us become the best by";
- mes "providing us with your opinions";
- mes "and honest feedback. Thank you.";
- close2;
- }
+ callfunc "F_KafSet";
+ callfunc "F_ZondaStaff", 1, "in the town of Veins.";
+ savepoint "veins",204,103;
+ close2;
cutin "", 255;
end;
}
diff --git a/npc/kafras/functions_kafras.txt b/npc/kafras/functions_kafras.txt
index dfce182d2..28fe32b95 100644
--- a/npc/kafras/functions_kafras.txt
+++ b/npc/kafras/functions_kafras.txt
@@ -5,7 +5,7 @@
//= Darlskies, Darkchild, Syrus22, Lupus, kobra_k88 (2.0)
//= L0ne_W0lf
//===== Current Version: =====================================
-//= 6.7
+//= 6.8
//===== Description: =========================================
//= These functions handle save, storage, cart rental, teleport,
//= and Free Teleport/Warp/Rent Cart options for all Kafra NPCs.
@@ -60,6 +60,7 @@
//= 6.5 Optimized. [Joseph]
//= 6.6 Added Warp Points / View Points Function. [Joseph]
//= 6.7 Added Rune Knight Kafra. [Euphy]
+//= 6.8 Improved compatibility with Zonda Staff NPCs. Modernized syntax. [Haru]
//============================================================
//=== Main Function ========================================================
@@ -72,7 +73,7 @@
function script F_Kafra {
callfunc "F_ClearGarbage"; // Clear outdated, unused variables
// Display Kafra Welcome Message
- switch(getarg(0)){
+ switch (getarg(0)) {
default:
case 0:
// Default message (obsolete)
@@ -92,7 +93,7 @@ function script F_Kafra {
break;
case 2:
// Guild Castle Kafra message
- set @GID,getcharid(2);
+ @GID = getcharid(2);
mes "[Kafra Employee]";
mes "Welcome. ^ff0000" + getguildname(@GID) + "^000000 Member.";
mes "The Kafra Coporation will stay with you wherever you go.";
@@ -117,13 +118,13 @@ function script F_Kafra {
break;
}
next;
- while (1) {
- deletearray @K_Menu0$[0],getarraysize(@K_Menu0$);
+ while (true) {
+ deletearray @K_Menu0$;
if (getarg(0) == 2) {
// Guild Kafra Menu override (free Teleport, free Storage, Free Cart)
setarray @K_Menu0$[0],"Use Storage","Use Guild Storage","Rent a Pushcart","Use Teleport Service","Cancel";
} else {
- switch(getarg(1)){
+ switch (getarg(1)) {
// Save and Storage only
case 1: setarray @K_Menu0$[0],"Save","Use Storage","Cancel"; break;
// Storage only
@@ -147,23 +148,24 @@ function script F_Kafra {
default: setarray @K_Menu0$[0],"Save","Use Storage","Use Teleport Service","Rent a Pushcart","Check Other Information","Cancel"; break;
}
}
- set .@menu$,"";
- for (set .@i, 0; .@i < getarraysize(@K_Menu0$); set .@i, .@i + 1)
- set .@menu$, .@menu$ + @K_Menu0$[.@i] + ":";
- set .@j, select (.@menu$) - 1;
+ .@menu$ = "";
+ for (.@i = 0; .@i < getarraysize(@K_Menu0$); ++.@i)
+ .@menu$ += @K_Menu0$[.@i] + ":";
+ .@j = select(.@menu$) - 1;
if (@K_Menu0$[.@j] == "Save") {
return;
} else if (@K_Menu0$[.@j] == "Use Storage") {
// Do not charge for Guild Storage
if(getarg(0) == 2)
- callfunc "F_KafStor",2,0,0;
+ callfunc "F_KafStor",2,0,0,"[Kafra Employee]";
else
- callfunc "F_KafStor",0,getarg(3),getarg(0);
+ callfunc "F_KafStor",0,getarg(3),getarg(0),"[Kafra Employee]";
next;
} else if (@K_Menu0$[.@j] == "Use Teleport Service") {
// Display Einbroch "No Teleport Service" notice.
- if(getarg(1) != 4) callfunc "F_KafTele",getarg(0);
- else {
+ if (getarg(1) != 4) {
+ callfunc "F_KafTele",getarg(0),"[Kafra Employee]";
+ } else {
mes "[Kafra Employee]";
mes "Because of the ^FF0000Limited";
mes "Transport Agreement^000000, the";
@@ -179,7 +181,7 @@ function script F_Kafra {
}
next;
} else if (@K_Menu0$[.@j] == "Rent a Pushcart") {
- if(callfunc("F_KafCart",getarg(0),getarg(4)) == 1)
+ if(callfunc("F_KafCart",getarg(0),getarg(4),"[Kafra Employee]") == 1)
next;
} else if (@K_Menu0$[.@j] == "Check Other Information") {
callfunc "F_KafInfo",getarg(2);
@@ -188,7 +190,7 @@ function script F_Kafra {
callfunc "F_KafEnd",getarg(0),0;
end;
} else if (@K_Menu0$[.@j] == "Use Guild Storage") {
- callfunc "F_KafStor",1,0;
+ callfunc "F_KafStor",1,0,0,"[Kafra Employee]";
next;
}
}
@@ -196,12 +198,22 @@ function script F_Kafra {
//===================================================
// Storage Function
+//= arg(0): Specifies the type of storage that has been requested:
+// 0 = Regular storage
+// 1 = Guild storage
+// 2 = Regular storage, in a castle (free of charge)
+//= arg(1): Cost to use storage.
+//= arg(2): The type of NPC this is being called from. Notable values:
+// 0,2-5 = Regular Kafra
+// 1 = Niflheim Kafra (special messages)
+// 6 = Zonda/Cool Event Staff (no RESRVPTS)
+//= arg(3): NPC title to display.
//===================================================
function script F_KafStor {
// Unable to access Guild Storage (Busy)
- if(getarg(0) == 1){
- if(guildopenstorage()){
- mes "[Kafra Employee]";
+ if (getarg(0) == 1) {
+ if (guildopenstorage()) {
+ mes getarg(3);
mes "I'm sorry but another guild member is using the guild storage";
mes "right now. Please wait until that person is finished.";
close2;
@@ -212,8 +224,8 @@ function script F_KafStor {
close;
}
// Unable to access Normal Storage (Insufficient Basic Skills)
- if(basicskillcheck() && getskilllv("NV_BASIC") < 6){
- mes "[Kafra Employee]";
+ if (basicskillcheck() && getskilllv(NV_BASIC) < 6) {
+ mes getarg(3);
// Niflheim Specific Message
if (getarg(2) == 1) {
mes "^666666S-s-ssoooorry,";
@@ -229,12 +241,13 @@ function script F_KafStor {
return;
}
// Accessing Normal Storage (Skipped if accessing Storage from Guild castle)
- if(getarg(0) != 2){
+ if (getarg(0) != 2) {
// Consume "Free Ticket for Kafra Storage" if available.
- if(countitem(7059)) delitem 7059,1;
- else {
- if(Zeny<getarg(1)){
- mes "[Kafra Employee]";
+ if (countitem(Cargo_Free_Ticket)) {
+ delitem Cargo_Free_Ticket, 1;
+ } else {
+ if (Zeny < getarg(1)) {
+ mes getarg(3);
// Niflheim Specific Message
if (getarg(2) == 1) {
percentheal -50,-50;
@@ -252,29 +265,37 @@ function script F_KafStor {
return;
}
Zeny -= getarg(1);
- set RESRVPTS, RESRVPTS + (getarg(1)/5);
+ if (getarg(2) != 6)
+ RESRVPTS += getarg(1) / 5;
}
}
// Surpress the "End" message if in guild castle.
if (getarg(0) != 2) {
- // Niflheim specific Message
if (getarg(2) == 1) {
+ // Niflheim specific Message
percentheal 0,-10;
- mes "[Kafra Employee]";
- for (set .@i, 0; .@i < 5; set .@i, .@i + 1)
+ mes getarg(3);
+ for (.@i = 0; .@i < 5; ++.@i)
mes "^666666Thank you.. for... using...^000000";
- }
- // Normal message
- else {
- mes "[Kafra Employee]";
+ } else if (getarg(2) == 6) {
+ // Zonda
+ mes getarg(3);
+ mes "Let me open your personal";
+ mes "storage for you right away.";
+ mes "Thanks for supporting Cool";
+ mes "Event Corp. by using our";
+ mes "services. Have a good day~";
+ } else {
+ // Normal message
+ mes getarg(3);
mes "Here, let me open";
mes "your Storage for you.";
mes "Thank you for using";
mes "the Kafra Service.";
}
}
- callfunc("F_CheckKafCode"); //check your storage password, if set
+ callfunc("F_CheckKafCode"); //check your storage password, if set
close2;
openstorage;
cutin "", 255;
@@ -283,23 +304,29 @@ function script F_KafStor {
//===================================================
// Teleport Function
+//= arg(2): The type of NPC this is being called from. Notable values:
+// 2 = Guild Castle Kafra (don't consume tickets)
+// 6 = Zonda/Cool Event Staff (no RESRVPTS)
+//= arg(1): NPC title to display.
//===================================================
function script F_KafTele {
- mes "[Kafra Employee]";
+ mes getarg(1);
mes "Please choose";
mes "your destination.";
next;
- set .@menu$, "";
- for (set .@i, 0; .@i <= 6; set .@i, .@i + 1)
- set .@menu$, .@menu$ + @wrpC$[.@i] + ":";
- set .@j, select (.@menu$) - 1;
- if (@wrpC$[.@j] == "Cancel") return;
+ .@menu$ = "";
+ for (.@i = 0; .@i <= 6; ++.@i)
+ .@menu$ += @wrpC$[.@i] + ":";
+ .@j = select(.@menu$) - 1;
+ if (@wrpC$[.@j] == "Cancel")
+ return;
// Consume "Free Ticket for Kafra Transportation" if available.
// Do not consume if in Guild castle
- if(countitem(7060) > 0 && getarg(0) != 2) delitem 7060,1;
- else {
- if (Zeny<@wrpP[.@j]){
- mes "[Kafra Employee]";
+ if (countitem(Warp_Free_Ticket) > 0 && getarg(0) != 2) {
+ delitem Warp_Free_Ticket, 1;
+ } else {
+ if (Zeny < @wrpP[.@j]) {
+ mes getarg(1);
mes "I'm sorry, but you don't have";
mes "enough zeny for the Teleport";
mes "Service. The fee to teleport";
@@ -309,7 +336,8 @@ function script F_KafTele {
end;
}
Zeny -= @wrpP[.@j];
- set RESRVPTS, RESRVPTS + (@wrpP[.@j]/16);
+ if (getarg(0) != 6)
+ RESRVPTS += @wrpP[.@j] / 16;
}
cutin "", 255;
if (@wrpD$[.@j] == "Al De Baran") warp "aldebaran",168,112;
@@ -325,17 +353,25 @@ function script F_KafTele {
else if (@wrpD$[.@j] == "Payon") warp "payon", 161, 58;
else if (@wrpD$[.@j] == "Prontera") warp "prontera", 116, 72;
else if (@wrpD$[.@j] == "Umbala") warp "umbala", 100, 154;
+ else if (@wrpD$[.@j] == "Veins") warp "veins",205,101;
+ else if (@wrpD$[.@j] == "Rachel") warp "rachel",115,125;
end;
}
//===================================================
// Cart Function
+//= arg(0): The type of NPC this is being called from. Notable values:
+// 0,1,3-5 = Regular Kafra
+// 2 = Guild Castle Kafra (don't consume tickets)
+// 6 = Zonda/Cool Event Staff (no RESRVPTS)
+//= arg(1): Cost to rent a cart.
+//= arg(2): NPC title to display.
//===================================================
function script F_KafCart {
// Ensure that the class wanting to rent a pushcart is a merchant
- if(BaseClass != Job_Merchant){
- mes "[Kafra Employee]";
+ if (BaseClass != Job_Merchant) {
+ mes getarg(2);
mes "I'm sorry, but the";
mes "Pushcart rental service";
mes "is only available to Merchants,";
@@ -343,9 +379,15 @@ function script F_KafCart {
mes "Alchemists and Biochemists.";
return 1;
}
+ if (getskilllv(MC_PUSHCART) == 0) {
+ mes getarg(2);
+ mes "You can only rent a cart after";
+ mes "learning the Pushcart Skill.";
+ return 1;
+ }
// Make sure the invoking character does not have a cart already
- else if(checkcart() == 1){
- mes "[Kafra Employee]";
+ if (checkcart() == 1) {
+ mes getarg(2);
mes "You already have";
mes "a Pushcart equipped.";
mes "Unfortunately, we can't";
@@ -355,24 +397,27 @@ function script F_KafCart {
}
// Consume "Free Ticket for the Cart Service" if available.
// Do not consume if in Guild castle.
- if(countitem(7061) > 0 && getarg(0) != 2) delitem 7061,1;
- else {
- mes "[Kafra Employee]";
+ if (countitem(Cart_Free_Ticket) > 0 && getarg(0) != 2) {
+ delitem Cart_Free_Ticket, 1;
+ } else {
+ mes getarg(2);
mes "The Pushcart rental";
mes "fee is "+getarg(1)+" zeny. Would";
mes "you like to rent a Pushcart?";
next;
- if (select("Rent a Pushcart.:Cancel") == 2) return 0;
- if(Zeny<getarg(1)){
- mes "[Kafra Employee]";
- mes "I'm sorry, but you";
- mes "don't have enough";
- mes "zeny to pay the Pushcart";
- mes "rental fee of "+getarg(1)+" zeny.";
- return 1;
- }
- Zeny -= getarg(1);
- set RESRVPTS, RESRVPTS + 48;
+ if (select("Rent a Pushcart.:Cancel") == 2)
+ return 0;
+ if (Zeny < getarg(1)) {
+ mes getarg(2);
+ mes "I'm sorry, but you";
+ mes "don't have enough";
+ mes "zeny to pay the Pushcart";
+ mes "rental fee of "+getarg(1)+" zeny.";
+ return 1;
+ }
+ Zeny -= getarg(1);
+ if (getarg(0) != 6)
+ RESRVPTS += 48;
}
setcart;
return 1;
@@ -383,12 +428,12 @@ function script F_KafCart {
//===================================================
function script F_KafInfo {
// Uncomment next line to block Kafra Storage Protection
- // set .@block, 1;
- setarray .@m$, "Check Special Reserve Points.","Storage Password Service","Kafra Employee Locations","Cancel";
- if (getarg(0) == 2) deletearray .@m$[1],2; // Port Malaya, Rune Knight
- else if (.@block) deletearray .@m$[1],1;
- while (1) {
- set .@j, select(implode(.@m$,":")) - 1;
+ //set .@block, 1;
+ setarray .@m$, "Check Special Reserve Points.","Storage Password Service","Kafra Employee Locations","Cancel";
+ if (getarg(0) == 2) deletearray .@m$[1],2; // Port Malaya, Rune Knight: remove Storage Password and Kafra Employee Locations
+ else if (.@block) deletearray .@m$[1],1; // Remove Storage Password
+ while (true) {
+ .@j = select(implode(.@m$,":")) - 1;
if (.@m$[.@j] == "Check Special Reserve Points.") {
mes "[Kafra Employee]";
mes "Let's see...";
@@ -402,12 +447,13 @@ function script F_KafInfo {
mes "rewards at the Kafra Main Office in Al De Baran. Please use our";
mes "convenient services to see the benefits of our rewards program.";
next;
- if(getarg(0) == 1) return;
+ if(getarg(0) == 1)
+ return;
} else if (.@m$[.@j] == "Kafra Employee Locations") {
- for (set .@i, 0; .@i <= 3; set .@i, .@i + 1)
+ for (.@i = 0; .@i <= 3; ++.@i)
viewpoint 1,@viewpX[.@i],@viewpY[.@i],(.@i+1),0xFF00FF;
next;
- for (set .@i, 0; .@i <= 3; set .@i, .@i + 1)
+ for (.@i = 0; .@i <= 3; ++.@i)
viewpoint 2,@viewpX[.@i],@viewpY[.@i],(.@i+1),0xFF00FF;
} else if (.@m$[.@j] == "Storage Password Service") {
callfunc("F_SetKafCode","[Kafra Employee]","Kafra Services");
@@ -424,20 +470,20 @@ function script F_KafInfo {
//===================================================================
function script F_KafEnd {
mes "[Kafra Employee]";
- if(getarg(1)==1) {
+ if (getarg(1) == 1) {
// Save
mes "Your Respawn Point";
mes "has been saved here";
mes getarg(2)+".";
mes "Thank you for using";
mes "the Kafra Services.";
- } else if(getarg(0)==0 || getarg(0)==5) {
+ } else if (getarg(0) == 0 || getarg(0) == 5) {
// Generic End
mes "We, here at Kafra Corporation,";
mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence.";
- } else if(getarg(0)==1) {
+ } else if (getarg(0) == 1) {
// Niflheim End
- percentheal 0,- 25;
+ percentheal 0,-25;
mes "^666666Kaffffra n-never";
mes "diiiiiiiiiiiiiies. On...";
mes "On y-yooour siiiiide~^000000";
@@ -451,18 +497,19 @@ function script F_KafEnd {
// Check Storage Password Function
//===================================================
function script F_CheckKafCode {
- if(!#kafra_code) return;
+ if (!#kafra_code)
+ return;
mes "Enter your storage password:";
- set @code_,0;
+ @code_ = 0;
input @code_;
- if(@code_ != #kafra_code) {
+ if (@code_ != #kafra_code) {
dispbottom "Wrong storage password.";
close2;
cutin "",255;
end;
}
- set @kafcode_try,0;
- set @code_,0;
+ @kafcode_try = 0;
+ @code_ = 0;
return;
}
@@ -472,15 +519,15 @@ function script F_CheckKafCode {
//=======================================================
function script F_SetKafCode {
mes getarg(0);
- if(#kafra_code) {
+ if (#kafra_code) {
mes "Your storage is protected with a password. What would you do now?";
next;
switch (select("Change old password -> 5000z:Remove storage password -> 1000z:Cancel")) {
case 1:
mes getarg(0);
mes "At first, please enter your ^0000FFold password^000000.";
- set @code,callfunc("F_EntKafCode");
- if(!@code || @code != #kafra_code) {
+ @code = callfunc("F_EntKafCode");
+ if (!@code || @code != #kafra_code) {
mes "Wrong password. You can't set a new password.";
emotion e_hmm;
break;
@@ -491,22 +538,22 @@ function script F_SetKafCode {
case 2:
mes getarg(0);
mes "Please, enter your password before its removal.";
- set @code,callfunc("F_EntKafCode");
- if(!@code) {
+ @code = callfunc("F_EntKafCode");
+ if (!@code) {
mes "The password hasn't been removed.";
emotion e_hmm;
break;
}
next;
mes getarg(0);
- if(Zeny < 1000) {
+ if (Zeny < 1000) {
mes "You don't have enough zeny.";
emotion e_cash;
break;
}
Zeny -= 1000;
- if(@code == #kafra_code) {
- set #kafra_code,0;
+ if (@code == #kafra_code) {
+ #kafra_code = 0;
mes "You've successfully cleared your storage password.";
mes "Thank you for using "+getarg(1)+".";
emotion e_thx;
@@ -535,21 +582,21 @@ function script F_SetKafCode {
S_SET:
mes getarg(0);
mes "Now enter your ^FF0000new password^000000 to protect your storage from thieves.";
- set @code,callfunc("F_EntKafCode");
- if(!@code) {
+ @code = callfunc("F_EntKafCode");
+ if (!@code) {
mes "The password hasn't been changed.";
emotion e_hmm;
return;
}
next;
mes getarg(0);
- if(Zeny < 5000) {
+ if (Zeny < 5000) {
mes "You don't have enough zeny.";
emotion e_cash;
return;
}
Zeny -= 5000;
- set #kafra_code,@code;
+ #kafra_code = @code;
mes "You've protected your storage with a secret password.";
mes "Thank you for using "+getarg(1)+".";
emotion e_thx;
@@ -561,17 +608,17 @@ S_SET:
//===================================================
function script F_EntKafCode {
mes "Enter a number 1000~10000000:";
- set @code_,0;
- set @kafcode_try,@kafcode_try+1;
- if(@kafcode_try>10) {
- set @kafcode_try,0;
+ @code_ = 0;
+ ++@kafcode_try;
+ if (@kafcode_try > 10) {
+ @kafcode_try = 0;
logmes "Hack: Tried to fit storage password.";
}
- if(input(@code_) == 1) {
+ if (input(@code_) == 1) {
mes "You can't use such big password.";
return 0;
}
- if(@code_<1000) {
+ if (@code_ < 1000) {
mes "You shouldn't use such short password.";
return 0;
}
@@ -582,60 +629,66 @@ function script F_EntKafCode {
// Warp Points / View Points Function
//===================================================
function script F_KafSet {
- cleararray @wrpC$[0],"",getarraysize(@wrpC$);
- cleararray @wrpD$[0],"",getarraysize(@wrpD$);
- cleararray @wrpP$[0],"",getarraysize(@wrpP$);
- cleararray @viewpX[0],"",getarraysize(@viewpX);
- cleararray @viewpY[0],"",getarraysize(@viewpY);
+ deletearray @wrpC$;
+ deletearray @wrpD$;
+ deletearray @wrpP$;
+ deletearray @viewpX;
+ deletearray @viewpY;
if (strnpcinfo(4) == "prontera") {
- setarray @wrpD$[0], "Izlude", "Geffen", "Payon", "Morroc", "Orc Dungeon", "Alberta";
- setarray @wrpP[0], 600, 1200, 1200, 1200, 1200, 1800;
- setarray @viewpX[0], 151, 29, 282, 152;
- setarray @viewpY[0], 29, 207, 200, 326;
+ setarray @wrpD$, "Izlude", "Geffen", "Payon", "Morroc", "Orc Dungeon", "Alberta";
+ setarray @wrpP, 600, 1200, 1200, 1200, 1200, 1800;
+ setarray @viewpX, 151, 29, 282, 152;
+ setarray @viewpY, 29, 207, 200, 326;
} else if (strnpcinfo(4) == "alberta") {
- setarray @wrpP[0], 1200, 1800, 1800;
- setarray @wrpD$[0], "Payon", "Morroc", "Prontera";
- setarray @viewpX[0], 28, 113, 0, 0;
- setarray @viewpY[0], 229, 60, 0, 0;
+ setarray @wrpP, 1200, 1800, 1800;
+ setarray @wrpD$, "Payon", "Morroc", "Prontera";
+ setarray @viewpX, 28, 113, 0, 0;
+ setarray @viewpY, 229, 60, 0, 0;
} else if (strnpcinfo(4) == "aldebaran") {
- setarray @wrpP[0], 1200, 1200, 1800, 1700;
- setarray @wrpD$[0], "Geffen", "Juno" , "Izlude", "Mjolnir Dead Pit";
+ setarray @wrpP, 1200, 1200, 1800, 1700;
+ setarray @wrpD$, "Geffen", "Juno" , "Izlude", "Mjolnir Dead Pit";
} else if (strnpcinfo(4) == "comodo" ) {
- setarray @wrpD$[0], "Morroc", "Comodo Pharos Beacon", "Umbala";
- setarray @wrpP[0], 1800, 1200, 1800;
+ setarray @wrpD$, "Morroc", "Comodo Pharos Beacon", "Umbala";
+ setarray @wrpP, 1800, 1200, 1800;
} else if (strnpcinfo(4) == "cmd_fild07") {
- setarray @wrpD$[0], "Comodo", "Morroc";
- setarray @wrpP[0], 1200, 1200;
+ setarray @wrpD$, "Comodo", "Morroc";
+ setarray @wrpP, 1200, 1200;
} else if (strnpcinfo(4) == "geffen") {
- setarray @wrpD$[0], "Prontera", "Al De Baran", "Orc Dungeon", "Mjolnir Dead Pit";
- setarray @wrpP[0], 1200, 1200, 1200, 1700;
- setarray @viewpX[0], 120, 203;
- setarray @viewpY[0], 62, 123;
+ setarray @wrpD$, "Prontera", "Al De Baran", "Orc Dungeon", "Mjolnir Dead Pit";
+ setarray @wrpP, 1200, 1200, 1200, 1700;
+ setarray @viewpX, 120, 203;
+ setarray @viewpY, 62, 123;
} else if (strnpcinfo(4) == "izlude") {
- setarray @wrpD$[0], "Geffen", "Payon", "Morroc", "Al De Baran";
- setarray @wrpP[0], 1200, 1200, 1200, 1800;
+ setarray @wrpD$, "Geffen", "Payon", "Morroc", "Al De Baran";
+ setarray @wrpP, 1200, 1200, 1200, 1800;
} else if (strnpcinfo(4) == "morocc") {
- setarray @wrpD$[0], "Prontera", "Payon", "Alberta", "Comodo", "Comodo Pharos Beacon";
- setarray @wrpP[0], 1200, 1200, 1800, 1800, 1200;
- setarray @viewpX[0], 156, 163, 28, 292;
- setarray @viewpY[0], 97, 260, 167, 211;
+ setarray @wrpD$, "Prontera", "Payon", "Alberta", "Comodo", "Comodo Pharos Beacon";
+ setarray @wrpP, 1200, 1200, 1800, 1800, 1200;
+ setarray @viewpX, 156, 163, 28, 292;
+ setarray @viewpY, 97, 260, 167, 211;
} else if (strnpcinfo(4) == "umbala") {
- setarray @wrpD$[0], "Comodo";
- setarray @wrpP[0], 1800;
+ setarray @wrpD$, "Comodo";
+ setarray @wrpP, 1800;
} else if (strnpcinfo(4) == "payon") {
- setarray @wrpD$[0], "Prontera", "Alberta", "Morroc";
- setarray @wrpP[0], 1200, 1200, 1200;
+ setarray @wrpD$, "Prontera", "Alberta", "Morroc";
+ setarray @wrpP, 1200, 1200, 1200;
} else if (strnpcinfo(4) == "yuno") {
- setarray @wrpD$[0], "Al De Baran";
- setarray @wrpP[0], 1200;
- setarray @viewpX[0], 328, 278, 153, 0;
- setarray @viewpY[0], 108, 221, 187, 0;
+ setarray @wrpD$, "Al De Baran";
+ setarray @wrpP, 1200;
+ setarray @viewpX, 328, 278, 153, 0;
+ setarray @viewpY, 108, 221, 187, 0;
} else if (strnpcinfo(4) == "job3_rune01") {
- setarray @wrpD$[0], "Izlude", "Geffen", "Payon", "Morroc", "Alberta";
- setarray @wrpP[0], 600, 1200, 1200, 1200, 1800;
+ setarray @wrpD$, "Izlude", "Geffen", "Payon", "Morroc", "Alberta";
+ setarray @wrpP, 600, 1200, 1200, 1200, 1800;
+ } else if (strnpcinfo(4) == "rachel") {
+ setarray @wrpD$, "Veins";
+ setarray @wrpP, 2200;
+ } else if (strnpcinfo(4) == "veins") {
+ setarray @wrpD$, "Rachel";
+ setarray @wrpP, 2200;
}
- for (set .@i, 0; .@i < getarraysize(@wrpD$); set .@i, .@i + 1)
- setd "@wrpC$["+.@i+"]",getd("@wrpD$["+.@i+"]")+" -> "+getd("@wrpP["+.@i+"]");
- setd "@wrpC$["+getarraysize(@wrpC$)+"]","Cancel";
+ for (.@i = 0; .@i < getarraysize(@wrpD$); ++.@i)
+ @wrpC$[.@i] = @wrpD$[.@i]+" -> "+@wrpP[.@i];
+ @wrpC$[getarraysize(@wrpC$)] = "Cancel";
return;
}