//Le Livre d'Ymir http://www.bookofymir.net/ //traduit par Myllena //===== eAthena Script ======================================= //= Kafra Express - Main Module //===== By: ================================================== //= Skotlex //===== Current Version: ===================================== //= 5.7 //===== Compatible With: ===================================== //= eAthena SVN R3424+ //===== Description: ========================================= //= Part of the Kafra Express Script Package. //= This module contains the main menu, plus the healing and //= storage services. //===== Additional Comments: ================================= //= See //= for indepth explanation of the Kafra Express Script Package. //= Services available: comment/uncomment what you want (lines 37-104) //= See config.txt for per-module configuration. //============================================================ // F_KafraExpress (String "Kafra's name", String "kafra image file", //int location (0 = Town Kafra, 1 = Dungeon Kafra, 2 = Both), //String "save map", int save x, int save y) function script F_KafraExpress { set @name$,getarg(0); set @ke_type,getarg(2); if ($@kekp_reset && @kafraPass > 0) set @kafraPass,@kafraPass-1; if (getarg(1) != "") cutin getarg(1),2; callfunc "F_keIntro",-1,""; M_INIT: set @discount, callfunc("F_keCost",1,100); if (@ke_type == 1) goto MD_INIT; menu "- Annuler",L_END, "- Soin ("+($@keh_hpCost*@discount)+" Zenys/10HP - "+($@keh_spCost*@discount)+" Zenys/10SP)",L_HEAL, "- Téléportation",M_WARP, "- Ouvrir mon Stock ("+($@kes_cost*@discount)+" Zenys)",L_STORAGE, "- Ouvrir le Stock de Guilde ("+($@kegs_cost*@discount)+" Zenys)",L_GUILD_STORAGE, "- Services des Métiers",M_JOB, "- Autres Services",M_OTHER, "- Sauvegarder",L_SAVE; MD_INIT: menu "- Annuler",L_END, "- Soin ("+($@keh_hpCost*@discount)+" Zenys/10HP - "+($@keh_spCost*@discount)+" Zenys/10SP)",L_HEAL, "- Téléportation",M_WARP, "- Ouvrir mon Stock ("+($@kes_cost*@discount)+" Zenys)",L_STORAGE, "- Ouvrir le Stock de Guilde ("+($@kegs_cost*@discount)+" Zenys)",L_GUILD_STORAGE, "- Services des Métiers",M_JOB, "- Autres Services",M_OTHER, "- Sauvegarder",L_SAVE; M_WARP: if (@ke_type == 3 && nif_q_done != 1) goto L_DENIED; if (@ke_type == 1) goto MD_WARP; menu "- Retour",M_INIT, "- Donjons",L_DUNGEON, "- Arènes PvP",L_PVP, "- Guerres de l'Emperium",L_GUILD_DUNGEON, "- Villes",L_TOWN; MD_WARP: menu "- Retour",M_INIT, "- Donjons",L_DUNGEON, "- Arènes PvP",L_PVP, "- Guerres de l'Emperium",L_GUILD_DUNGEON, "- Villes",L_TOWN; M_JOB: if (@ke_type == 1) goto MD_JOB; menu "- Retour", M_INIT, "- Changer de Profession",L_JOB_CHANGE, "- Echanger sa Profession",L_JOB_SWAP, "- Services des Statistiques et Compétences",L_STATS, "- Marché des Statistiques et Compétences",L_STAT_MARKET, "- Services de Location",L_RENT; MD_JOB: menu "- Retour", M_INIT, "- Changer de Profession",L_JOB_CHANGE, "- Echanger sa Profession",L_JOB_SWAP, "- Services des Statistiques et Compétences",L_STATS, "- Marché des Statistiques et Compétences",L_STAT_MARKET, "- Services de Location",L_RENT; M_OTHER: if (@ke_type == 1) goto MD_OTHER; menu "- Retour",M_INIT, "- Services de Banque",L_BANK, "- Boutique Kafra",L_SHOP, "- Diffuser une Annonce",L_BROADCAST, "- Services de Raffinement",L_REFINE, "- Services d'Enlèvement de Carte",L_UNCARD, "- Styliste",L_STYLE, "- Utiliser un Passe Kafra",L_PASS; MD_OTHER: menu "- Retour",M_INIT, "- Services de Banque",L_BANK, "- Boutique Kafra",L_SHOP, "- Diffuser une Annonce",L_BROADCAST, "- Services de Raffinement",L_REFINE, "- Services d'Enlèvement de Carte",L_UNCARD, "- Styliste",L_STYLE, "- Utiliser un Passe Kafra",L_PASS; L_HEAL: callfunc "F_keHeal"; goto M_INIT; L_TOWN: callfunc "F_keWarpTown"; goto M_WARP; L_DUNGEON: callfunc "F_keDungeonWarps", getarg(3); goto M_WARP; L_GUILD_DUNGEON: callfunc "F_keWarpWOE"; goto M_WARP; L_PVP: callfunc "F_keWarpPvp"; goto M_WARP; L_STORAGE: callfunc "F_keStorage", getarg(1); goto M_INIT; L_GUILD_STORAGE: callfunc "F_keGuildStorage", getarg(1); goto M_INIT; L_BANK: callfunc "F_keBank"; goto M_OTHER; L_SHOP: callfunc "F_keShop",@ke_type, getarg(1); goto M_OTHER; L_BROADCAST: callfunc "F_keBroadcast",getarg(3); goto M_OTHER; L_PASS: callfunc "F_kePass"; goto M_OTHER; L_REFINE: callfunc "F_keRefine"; goto M_OTHER; L_UNCARD: callfunc "F_keUncard"; goto M_OTHER; L_STYLE: callfunc "F_keStylist"; goto M_OTHER; L_JOB_CHANGE: callfunc "F_keJobChange"; goto M_JOB; L_JOB_SWAP: callfunc "F_keJobSwap"; goto M_JOB; L_STATS: callfunc "F_keStats"; goto M_JOB; L_STAT_MARKET: callfunc "F_keStatMarket"; goto M_JOB; L_RENT: callfunc "F_keRent"; goto M_JOB; L_SAVE: if (@ke_type == 3 && nif_q_done != 1) goto L_DENIED; if ($@kewt_travel && @ke_type != 1) { callfunc "F_keAddTravelTown", getarg(3); } if ($@kewd_travel && @ke_type != 0) { callfunc "F_keAddTravelDungeon", getarg(3); } if ($@ke_saveOnSpot) { getmapxy @map$,@x,@y,0; savepoint @map$,@x,@y; } else { savepoint getarg(3),getarg(4),getarg(5); } emotion e_scissors; goto M_INIT; L_DENIED: callfunc "F_keIntro", e_gg, "...non."; goto M_INIT; L_END: mes "Merci d'avoir utilisé les Services Kafra."; close2; cutin getarg(1), 255; end; } //Function F_keIntro (emotion, message) //Displays a message followed by an emotion, then a next button, and finally //shows the intro message. function script F_keIntro { if (getarg(0) >= 0) emotion getarg(0); if (getarg(1) != "") { mes getarg(1); next; } mes "["+@name$+"]"; mes "Bienvenue à la Corporation Kafra. Nous serons toujours à vos côtés, où que vous alliez."; if(@kafraPass) mes "Votre Passe Kafra est actif."; mes "En quoi puis-je vous aider?"; return; } //Function Heal, offers the heal subsystem. function script F_keHeal { set @qtyHP,MaxHp-Hp; set @qtySP,MaxSp-Sp; set @costHP, $@keh_hpCost*(MaxHp-Hp)/10; set @costSP, $@keh_spCost*(MaxSp-Sp)/10; set @costHPSP, @costHP+@costSP; set @discount, callfunc("F_keCost",1,100); if (@qtyHP + @qtySP == 0) { callfunc "F_keIntro", -1, "...vous n'avez pas besoin de soins."; return; } if (@qtyHP == 0) goto M_NO_HP; if (@qtySP == 0) goto M_NO_SP; menu "- Cancel",-, "- Soigner les HP ("+(@costHP*@discount)+" Zenys)",L_HEAL_HP, "- Soigner les SP ("+(@costSP*@discount)+" Zenys)",L_HEAL_SP, "- Soigner les deux ("+(@costHPSP*@discount)+" Zenys)",L_HEAL_ALL; return; M_NO_HP: menu "- Annuler",-, "- Soigner les SP ("+(@costSP*@discount)+" Zenys)",L_HEAL_SP; return; M_NO_SP: menu "- Annuler",-, "- Soigner les HP ("+(@costHP*@discount)+" Zenys)",L_HEAL_HP; return; L_HEAL_HP: if (!(callfunc("F_keCharge",@costHP,100,0))) { callfunc "F_keIntro", e_sry, "Désolée, vous n'avez pas assez d'argent."; return; } emotion e_no1; heal @qtyHP,0; return; L_HEAL_SP: if (!(callfunc("F_keCharge",@costSP,100,0))) { callfunc "F_keIntro", e_sry, "Désolée, vous n'avez pas assez d'argent."; return; } emotion e_no1; heal 0,@qtySP; return; L_HEAL_ALL: if (!(callfunc("F_keCharge",@costHPSP,100,0))) { callfunc "F_keIntro", e_sry, "Désolée, vous n'avez pas assez d'argent."; return; } emotion e_no1; heal @qtyHP,@qtySP; return; } //Function storage: allows access to the storage facility //The sent argument is the displaying image, so we can clear it afterwards. function script F_keStorage { if(basicskillcheck() > 0 && getskilllv("NV_BASIC") < 6) { callfunc "F_keIntro", -1, "Je suis désolée, mais vous devez être un Novice de Niveau de Métier 6 au minimum pour pouvoir consulter votre stock."; return; } if (!(callfunc("F_keCharge",$@kes_cost,100,1))) { callfunc "F_keIntro", e_an, "Désolée, vous n'avez pas assez d'argent."; return; } mes "Thank for you using Kafra services."; emotion e_thx; close2; openstorage; cutin getarg(0), 255; end; } //Function G Storage: Allows access to the Guild Storage function script F_keGuildStorage { if(basicskillcheck() > 0 && getskilllv("NV_BASIC") < 6) { callfunc "F_keIntro", -1, "Je suis désolée, mais vous devez être un Novice de Niveau de Métier 6 au minimum pour pouvoir consulter votre stock."; return; } if(getcharid(2) < 1) { callfunc "F_keIntro", e_swt, "Vous ne pouvez pas consulter le Stock de Guilde car vous n'appartenez à aucune Guilde!"; return; } if (callfunc("F_keCost",$@kegs_cost,100) > Zeny) { callfunc "F_keIntro", e_an, "Désolée, vous n'avez pas assez d'argent."; return; } if (guildopenstorage() == 1) { callfunc "F_keIntro", -1, "Je suis désolée, mais un autre membre de la guilde est déjà en train de consulter le stock. Veuillez patienter jusqu'à ce que ce membre ait terminé."; return; } callfunc "F_keCharge",$@kegs_cost,100,1; mes "Thank for you using Kafra services."; emotion e_thx; close2; cutin getarg(0), 255; end; } function script F_kePass { if (@kafraPass) { callfunc "F_keIntro", -1, "Vous utilisez déjà un Passe Kafra..."; return; } if (countitem(1084)<1) { callfunc "F_keIntro", -1, "Vous avez besoin d'un Passe Kafra pour activer ce service"; return; } delitem 1084,1; if ($@kekp_reset > 0) set @kafraPass,$@kekp_reset; else set @kafraPass,1; callfunc "F_keIntro", e_lv, "Votre Passe Kafra a été activé."; return; } //F_keCost(int cost, int discount%) //Returns what would be the cost of a service considering the KafraPass. //The discount value should be between 0 and 100 function script F_keCost { if (@kafraPass) { return getarg(0)*(100-getarg(1))/100; } return getarg(0); } //F_keCharge(int cost, int discount%, bool appliesKP) //Charges for a service, using the KafraPass state and discount value. //appliesKP marks if the cost savings apply for stocking Kafra Reserve Points //Function returns 1 if successful, 0 if there's not enough zeny. function script F_keCharge { set @savings, 0; if (@kafraPass) set @savings, getarg(0)*getarg(1)/100; set @cost, getarg(0)-@savings; if (@cost > Zeny || @cost < 0) { // (@cost < 0) for overflow protection return 0; } set Zeny, Zeny-@cost; if (getarg(2) && @savings > 0 && $@kekp_reserveCost > 0) { set @savings, @savings/$@kekp_reserveCost; if (@savings < $@kekp_minReserve) set @savings, $@kekp_minReserve; if (@savings > $@kekp_maxReserve) set @savings, $@kekp_maxReserve; set RESRVPTS, RESRVPTS + @savings; } return 1; } //Function F_keWarp (int cost, int discount, int emotion, String map, int x, int y) function script F_keWarp { if (!(callfunc("F_keCharge",getarg(0),getarg(1),1))) { callfunc "F_keIntro", e_an, "Désolée, vous n'avez pas assez d'argent..."; return; } emotion getarg(2); warp getarg(3),getarg(4),getarg(5); end; }