//===== eAthena Script =======================================
//= Kafra Express - Warping Town Module
//===== By: ==================================================
//= Skotlex
//===== Current Version: =====================================
//= 2.2
//===== Compatible With: =====================================
//= eAthena SVN R3424+, RO Episode 8+ (Hugel)
//===== Description: =========================================
//= Part of the Kafra Express Script Package.
//= Offers warp services to towns.
//===== Additional Comments: =================================
//= See config.txt for configuration.
//= Flag values used for towns:
//= 0x00000001 Alberta
//= 0x00000002 AlDeBaran
//= 0x00000004 Amatsu
//= 0x00000008 Ayothaya
//= 0x00000010 Comodo
//= 0x00000020 Einbech
//= 0x00000040 Einbroch
//= 0x00000080 Geffen
//= 0x00000100 Gon Ryun
//= 0x00000200 Hugel
//= 0x00000400 Izlude
//= 0x00000800 Jawaii
//= 0x00001000 LightHalzen
//= 0x00002000 Lou Yang
//= 0x00004000 Lutie
//= 0x00008000 Morocc
//= 0x00010000 Niflheim
//= 0x00020000 Payon
//= 0x00040000 Prontera
//= 0x00080000 Umbala
//= 0x00100000 Yuno
//= 0x00200000 Rachel
//============================================================
- script keInit_warpTown {
OnInit: //Load Config
donpcevent "keConfig::OnLoadWarpTown";
end;
}
function script F_keWarpTown {
function SF_check;
function SF_warp;
set @cost,callfunc("F_keCost",$@kewt_cost,$@kewt_discount);
set @niflcost,callfunc("F_keCost",$@kewt_niflCost,$@kewd_discount);
if (@cost > Zeny && $@kewt_free)
set @cost, Zeny;
do {
if ($@kewt_showOnline) {
set @kmenu, select(
"- Cancel",
"- Alberta ("+@cost+"z/"+(getmapusers("alberta")+getmapusers("alberta_in"))+" "+$@ked_users$+")",
"- Al De Baran ("+@cost+"z/"+(getmapusers("aldebaran")+getmapusers("aldeba_in"))+" "+$@ked_users$+")",
"- Amatsu ("+@cost+"z/"+(getmapusers("amatsu")+getmapusers("ama_in01")+getmapusers("ama_in02"))
+" "+$@ked_users$+")",
"- Ayothaya ("+@cost+"z/"+(getmapusers("ayothaya")+getmapusers("ayo_in01")+getmapusers("ayo_in02"))
+" "+$@ked_users$+")",
"- Comodo ("+@cost+"z/"+(getmapusers("comodo")+getmapusers("cmd_in01")+getmapusers("cmd_in02"))
+" "+$@ked_users$+")",
"- Einbech ("+@cost+"z/"+(getmapusers("einbech"))+" "+$@ked_users$+")",
"- Einbroch ("+@cost+"z/"+(getmapusers("einbroch")+getmapusers("ein_in01"))+" "+$@ked_users$+")",
"- Geffen ("+@cost+"z/"+(getmapusers("geffen")+getmapusers("geffen_in")+getmapusers("gef_tower"))
+" "+$@ked_users$+")",
"- Gon Ryun ("+@cost+"z/"+(getmapusers("gonryun")+getmapusers("gon_in"))+" "+$@ked_users$+")",
"- Hugel ("+@cost+"z/"+(getmapusers("hugel")+getmapusers("hu_in01"))+" "+$@ked_users$+")",
"- Izlude ("+@cost+"z/"+(getmapusers("izlude")+getmapusers("izlude_in"))+" "+$@ked_users$+")",
"- Jawaii ("+@cost+"z/"+(getmapusers("jawaii")+getmapusers("jawaii_in"))+" "+$@ked_users$+")",
"- LightHalzen ("+@cost+"z/"+(getmapusers("lighthalzen")+getmapusers("lhz_in01")
+getmapusers("lhz_in02")+getmapusers("lhz_in03"))+" "+$@ked_users$+")",
"- Lou Yang ("+@cost+"z/"+(getmapusers("louyang")+getmapusers("lou_in01")+getmapusers("lou_in02"))
+" "+$@ked_users$+")",
"- Lutie ("+@cost+"z/"+(getmapusers("xmas")+getmapusers("xmas_in"))+" "+$@ked_users$+")",
"- Morocc ("+@cost+"z/"+(getmapusers("morocc")+getmapusers("morocc_in")+getmapusers("moc_castle"))
+" "+$@ked_users$+")",
"- Niflheim ("+@niflcost+"z/"+(getmapusers("niflheim")+getmapusers("nif_in"))+" "+$@ked_users$+")",
"- Payon ("+@cost+"z/"+(getmapusers("payon")+getmapusers("payon_in01")+getmapusers("payon_in02"))
+" "+$@ked_users$+")",
"- Prontera ("+@cost+"z/"+(getmapusers("prontera")+getmapusers("prt_castle")
+getmapusers("prt_church")+getmapusers("prt_in"))+" "+$@ked_users$+")",
"- Rachel ("+@cost+"z/"+(getmapusers("rachel")+getmapusers("ra_in01")
+getmapusers("ra_temple")+getmapusers("ra_temin")+getmapusers("ra_temsky")
+getmapusers("que_rachel"))+" "+$@ked_users$+")",
"- Umbala ("+@cost+"z/"+(getmapusers("umbala")+getmapusers("um_in"))+" "+$@ked_users$+")",
"- Yuno ("+@cost+"z/"+(getmapusers("yuno")+getmapusers("yuno_in01")+getmapusers("yuno_in02")
+getmapusers("yuno_in03")+getmapusers("yuno_in04")+getmapusers("yuno_in05"))+" "+$@ked_users$+")"
);
} else {
set @kmenu, select(
"- Cancel",
"- Alberta ("+@cost+"z)",
"- Al De Baran ("+@cost+"z)",
"- Amatsu ("+@cost+"z)",
"- Ayothaya ("+@cost+"z)",
"- Comodo ("+@cost+"z)",
"- Einbech ("+@cost+"z)",
"- Einbroch ("+@cost+"z)",
"- Geffen ("+@cost+"z)",
"- Gon Ryun ("+@cost+"z)",
"- Hugel ("+@cost+"z)",
"- Izlude ("+@cost+"z)",
"- Jawaii ("+@cost+"z)",
"- LightHalzen ("+@cost+"z)",
"- Lou Yang ("+@cost+"z)",
"- Lutie ("+@cost+"z)",
"- Morocc ("+@cost+"z)",
"- Niflheim ("+@niflcost+"z)",
"- Payon ("+@cost+"z)",
"- Prontera ("+@cost+"z)",
"- Rachel ("+@cost+"z)",
"- Umbala ("+@cost+"z)",
"- Yuno ("+@cost+"z)"
);
}
switch (@kmenu) {
case 2: //Alberta
if (SF_check(0x1))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"alberta",117,56;
break;
case 3: //AlDeBaran
if (SF_check(0x2))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"aldebaran",139,124;
break;
case 4: //Amatsu
if (SF_check(0x4))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"amatsu",197,88;
break;
case 5: //Ayathoya
if (SF_check(0x8))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"ayothaya",202,174;
break;
case 6: //Comodo
if (SF_check(0x10))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"comodo",189,150;
break;
case 7: //Einbech
if (SF_check(0x20))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"einbech",137,220;
break;
case 8: //Einbroch
if (SF_check(0x40))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"einbroch",64,199;
break;
case 9: //Geffen
if (SF_check(0x80))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"geffen",120,66;
break;
case 10: //GonRyun
if (SF_check(0x100))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"gonryun",160,180;
break;
case 11: //Hugel
if (SF_check(0x200))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"hugel",96,105;
break;
case 12: //Izlude
if (SF_check(0x400))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"izlude",127,97;
break;
case 13: //Jawaii
if (SF_check(0x800))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"jawaii",214,223;
break;
case 14: //LightHalzen
if (SF_check(0x1000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"lighthalzen",158,92;
break;
case 15: //LouYang
if (SF_check(0x2000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"louyang",218,118;
break;
case 16: //Lutie
if (SF_check(0x4000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"xmas",148,133;
break;
case 17: //Morocc
if (SF_check(0x8000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"morocc",162,91;
break;
case 18: //Niflheim
if (SF_check(0x10000)) {
if (nif_q_done != 1) {
mes "...?";
callfunc "F_keIntro", e_no, "For some reason I can't warp you there!";
} else
callfunc "F_keWarp",$@kewt_niflCost,$@kewd_discount,e_yawn,"niflheim",194,185;
}
break;
case 19: //Payon
if (SF_check(0x20000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"payon",159,181;
break;
case 20: //Prontera
if (SF_check(0x40000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"prontera",156,175;
break;
case 21: //Rachel
if (SF_check(0x200000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"rachel",137,133;
break;
case 22: //Umbala
if (SF_check(0x80000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"umbala",88,153;
break;
case 23: //Yuno
if (SF_check(0x100000))
SF_warp $@kewt_cost,$@kewt_discount,e_yawn,"yuno",158,77;
break;
}
} while (@kmenu > 1);
return;
//SubFunction SF_check(flag)
//Checks if the character can warp to that town taking into consideration
//traveller's mode.
function SF_check {
if ($@kewt_travel && !((kewt_travel|#kewt_travel)&getarg(0))) {
callfunc "F_keIntro", e_sry, "Sorry, but we can only warp you to towns you have saved in at least once.";
return 0;
}
return 1;
}
//SubFunction SF_warp (int cost, int discount, int emotion, String map, int x, int y)
//Modded from F_keWarp to allow free warping to towns when not enough zeny.
function SF_warp {
set @cost, getarg(0);
if (@cost > Zeny && $@kewt_free)
set @cost, Zeny;
if (!(callfunc("F_keCharge",@cost,getarg(1),1))) {
callfunc "F_keIntro", e_an, "You don't have enough Zeny...";
return;
}
emotion getarg(2);
warp getarg(3),getarg(4),getarg(5);
end;
}
}
//Invoked when we want to add a map to the list of travelled-to towns
function script F_keAddTravelTown {
set @map$, getarg(0);
// Temporary code to update variables from old format to new.
if(ketw_alberta) {
set kewt_travel,kewt_travel|0x1;
set ketw_alberta,0;
}
if(ketw_aldebaran) {
set kewt_travel,kewt_travel|0x2;
set ketw_aldebaran,0;
}
if(ketw_amatsu) {
set kewt_travel,kewt_travel|0x4;
set ketw_amatsu,0;
}
if(ketw_ayothaya) {
set kewt_travel,kewt_travel|0x8;
set ketw_ayothaya,0;
}
if(ketw_comodo) {
set kewt_travel,kewt_travel|0x10;
set ketw_comodo,0;
}
if(ketw_einbech) {
set kewt_travel,kewt_travel|0x20;
set ketw_einbech,0;
}
if(ketw_einbroch) {
set kewt_travel,kewt_travel|0x40;
set ketw_einbroch,0;
}
if(ketw_geffen) {
set kewt_travel,kewt_travel|0x80;
set ketw_geffen,0;
}
if(ketw_gonryun) {
set kewt_travel,kewt_travel|0x100;
set ketw_gonryun,0;
}
if(ketw_hugel) {
set kewt_travel,kewt_travel|0x200;
set ketw_hugel,0;
}
if(ketw_izlude) {
set kewt_travel,kewt_travel|0x400;
set ketw_izlude,0;
}
if(ketw_jawaii) {
set kewt_travel,kewt_travel|0x800;
set ketw_jawaii,0;
}
if(ketw_lighthalzen) {
set kewt_travel,kewt_travel|0x1000;
set ketw_lighthalzen,0;
}
if(ketw_louyang) {
set kewt_travel,kewt_travel|0x2000;
set ketw_louyang,0;
}
if(ketw_lutie) {
set kewt_travel,kewt_travel|0x4000;
set ketw_lutie,0;
}
if(ketw_morroc) {
set kewt_travel,kewt_travel|0x8000;
set ketw_morroc,0;
}
if(ketw_niflheim) {
set kewt_travel,kewt_travel|0x10000;
set ketw_niflheim,0;
}
if(ketw_payon) {
set kewt_travel,kewt_travel|0x20000;
set ketw_payon,0;
}
if(ketw_prontera) {
set kewt_travel,kewt_travel|0x40000;
set ketw_prontera,0;
}
if(ketw_umbala) {
set kewt_travel,kewt_travel|0x80000;
set ketw_umbala,0;
}
if(ketw_yuno) {
set kewt_travel,kewt_travel|0x100000;
set ketw_yuno,0;
}
if(#ketw_alberta) {
set #kewt_travel,#kewt_travel|0x1;
set #ketw_alberta,0;
}
if(#ketw_aldebaran) {
set #kewt_travel,#kewt_travel|0x2;
set #ketw_aldebaran,0;
}
if(#ketw_amatsu) {
set #kewt_travel,#kewt_travel|0x4;
set #ketw_amatsu,0;
}
if(#ketw_ayothaya) {
set #kewt_travel,#kewt_travel|0x8;
set #ketw_ayothaya,0;
}
if(#ketw_comodo) {
set #kewt_travel,#kewt_travel|0x10;
set #ketw_comodo,0;
}
if(#ketw_einbech) {
set #kewt_travel,#kewt_travel|0x20;
set #ketw_einbech,0;
}
if(#ketw_einbroch) {
set #kewt_travel,#kewt_travel|0x40;
set #ketw_einbroch,0;
}
if(#ketw_geffen) {
set #kewt_travel,#kewt_travel|0x80;
set #ketw_geffen,0;
}
if(#ketw_gonryun) {
set #kewt_travel,#kewt_travel|0x100;
set #ketw_gonryun,0;
}
if(#ketw_hugel) {
set #kewt_travel,#kewt_travel|0x200;
set #ketw_hugel,0;
}
if(#ketw_izlude) {
set #kewt_travel,#kewt_travel|0x400;
set #ketw_izlude,0;
}
if(#ketw_jawaii) {
set #kewt_travel,#kewt_travel|0x800;
set #ketw_jawaii,0;
}
if(#ketw_lighthalzen) {
set #kewt_travel,#kewt_travel|0x1000;
set #ketw_lighthalzen,0;
}
if(#ketw_louyang) {
set #kewt_travel,#kewt_travel|0x2000;
set #ketw_louyang,0;
}
if(#ketw_lutie) {
set #kewt_travel,#kewt_travel|0x4000;
set #ketw_lutie,0;
}
if(#ketw_morroc) {
set #kewt_travel,#kewt_travel|0x8000;
set #ketw_morroc,0;
}
if(#ketw_niflheim) {
set #kewt_travel,#kewt_travel|0x10000;
set #ketw_niflheim,0;
}
if(#ketw_payon) {
set #kewt_travel,#kewt_travel|0x20000;
set #ketw_payon,0;
}
if(#ketw_prontera) {
set #kewt_travel,#kewt_travel|0x40000;
set #ketw_prontera,0;
}
if(#ketw_umbala) {
set #kewt_travel,#kewt_travel|0x80000;
set #ketw_umbala,0;
}
if(#ketw_yuno) {
set #kewt_travel,#kewt_travel|0x100000;
set #ketw_yuno,0;
}
// End update code.
if ($@kewt_travel > 1) {
if (@map$ == "alberta" || kewt_travel&0x1)
set #kewt_travel,#kewt_travel|0x1;
if (@map$ == "aldebaran" || kewt_travel&0x2)
set #kewt_travel,#kewt_travel|0x2;
if (@map$ == "amatsu" || kewt_travel&0x4)
set #kewt_travel,#kewt_travel|0x4;
if (@map$ == "ayothaya" || kewt_travel&0x8)
set #kewt_travel,#kewt_travel|0x8;
if (@map$ == "comodo" || kewt_travel&0x10)
set #kewt_travel,#kewt_travel|0x10;
if (@map$ == "einbech" || kewt_travel&0x20)
set #kewt_travel,#kewt_travel|0x20;
if (@map$ == "einbroch" || kewt_travel&0x40)
set #kewt_travel,#kewt_travel|0x40;
if (@map$ == "geffen" || kewt_travel&0x80)
set #kewt_travel,#kewt_travel|0x80;
if (@map$ == "gonryun" || kewt_travel&0x100)
set #kewt_travel,#kewt_travel|0x100;
if (@map$ == "hugel" || kewt_travel&0x200)
set #kewt_travel,#kewt_travel|0x200;
if (@map$ == "izlude" || kewt_travel&0x400)
set #kewt_travel,#kewt_travel|0x400;
if (@map$ == "jawaii" || kewt_travel&0x800)
set #kewt_travel,#kewt_travel|0x800;
if (@map$ == "lighthalzen" || kewt_travel&1000)
set #kewt_travel,#kewt_travel|0x1000;
if (@map$ == "louyang" || kewt_travel&0x2000)
set #kewt_travel,#kewt_travel|0x2000;
if (@map$ == "xmas" || kewt_travel&0x4000)
set #kewt_travel,#kewt_travel|0x4000;
if (@map$ == "morocc" || kewt_travel&0x8000)
set #kewt_travel,#kewt_travel|0x8000;
if (@map$ == "niflheim" || kewt_travel&0x10000)
set #kewt_travel,#kewt_travel|0x10000;
if (@map$ == "payon" || kewt_travel&0x20000)
set #kewt_travel,#kewt_travel|0x20000;
if (@map$ == "prontera" || kewt_travel&0x40000)
set #kewt_travel,#kewt_travel|0x40000;
if (@map$ == "umbala" || kewt_travel&0x80000)
set #kewt_travel,#kewt_travel|0x80000;
if (@map$ == "yuno" || kewt_travel&0x100000)
set #kewt_travel,#kewt_travel|0x100000;
if (@map$ == "rachel" || kewt_travel&0x200000)
set #kewt_travel,#kewt_travel|0x200000;
} else {
if (@map$ == "alberta")
set kewt_travel,kewt_travel|0x1;
if (@map$ == "aldebaran")
set kewt_travel,kewt_travel|0x2;
if (@map$ == "amatsu")
set kewt_travel,kewt_travel|0x4;
if (@map$ == "ayothaya")
set kewt_travel,kewt_travel|0x8;
if (@map$ == "comodo")
set kewt_travel,kewt_travel|0x10;
if (@map$ == "einbech")
set kewt_travel,kewt_travel|0x20;
if (@map$ == "einbroch")
set kewt_travel,kewt_travel|0x40;
if (@map$ == "geffen")
set kewt_travel,kewt_travel|0x80;
if (@map$ == "gonryun")
set kewt_travel,kewt_travel|0x100;
if (@map$ == "hugel")
set kewt_travel,kewt_travel|0x200;
if (@map$ == "izlude")
set kewt_travel,kewt_travel|0x400;
if (@map$ == "jawaii")
set kewt_travel,kewt_travel|0x800;
if (@map$ == "lighthalzen")
set kewt_travel,kewt_travel|0x1000;
if (@map$ == "louyang")
set kewt_travel,kewt_travel|0x2000;
if (@map$ == "xmas")
set kewt_travel,kewt_travel|0x4000;
if (@map$ == "morocc")
set kewt_travel,kewt_travel|0x8000;
if (@map$ == "niflheim")
set kewt_travel,kewt_travel|0x10000;
if (@map$ == "payon")
set kewt_travel,kewt_travel|0x20000;
if (@map$ == "prontera")
set kewt_travel,kewt_travel|0x40000;
if (@map$ == "umbala")
set kewt_travel,kewt_travel|0x80000;
if (@map$ == "yuno")
set kewt_travel,kewt_travel|0x100000;
if (@map$ == "rachel")
set kewt_travel,kewt_travel|0x200000;
}
return;
}