diff options
author | Vicious <Vicious@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-02 18:50:09 +0000 |
---|---|---|
committer | Vicious <Vicious@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-02 18:50:09 +0000 |
commit | 430f60e0b89f43358026ff1a170ac8938a534244 (patch) | |
tree | 6094005321b26405258b47ce4a4de6a8ae33d806 /npc/custom/eAAC_Scripts/kafraExpress/ke_uncard.txt | |
parent | 32ebde394d7762fdbb28ba9b5c3ce9a232292bb7 (diff) | |
download | hercules-430f60e0b89f43358026ff1a170ac8938a534244.tar.gz hercules-430f60e0b89f43358026ff1a170ac8938a534244.tar.bz2 hercules-430f60e0b89f43358026ff1a170ac8938a534244.tar.xz hercules-430f60e0b89f43358026ff1a170ac8938a534244.zip |
eACC scripts.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5429 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'npc/custom/eAAC_Scripts/kafraExpress/ke_uncard.txt')
-rw-r--r-- | npc/custom/eAAC_Scripts/kafraExpress/ke_uncard.txt | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/npc/custom/eAAC_Scripts/kafraExpress/ke_uncard.txt b/npc/custom/eAAC_Scripts/kafraExpress/ke_uncard.txt new file mode 100644 index 000000000..00132e9da --- /dev/null +++ b/npc/custom/eAAC_Scripts/kafraExpress/ke_uncard.txt @@ -0,0 +1,165 @@ +//===== eAthena Script =======================================
+//= Kafra Express - Uncarder Module
+//===== By: ==================================================
+//= Skotlex
+//===== Current Version: =====================================
+//= 1.5
+//===== Compatible With: =====================================
+//= eAthena SVN R3424+
+//===== Description: =========================================
+//= Part of the Kafra Express Script Package.
+//= Offers uncarding services.
+//===== Additional Comments: =================================
+//= See config.txt for configuration.
+//============================================================
+
+- script keInit_uncard {
+OnInit: //Load Config
+ donpcevent "keConfig::OnLoadUncard";
+ end;
+}
+
+function script F_keUncard {
+
+function SF_uncard;
+
+ do {
+ set @kmenu, select(
+ "- Return",
+ "- See Price Specifics",
+ "- "+getequipname(1),
+ "- "+getequipname(2),
+ "- "+getequipname(3),
+ "- "+getequipname(4),
+ "- "+getequipname(5),
+ "- "+getequipname(6),
+ "- "+getequipname(7),
+ "- "+getequipname(8),
+ "- "+getequipname(9),
+ "- "+getequipname(10)
+ );
+ if (@kmenu == 1)
+ return;
+ if (@kmenu == 2) { //Details
+ mes "Okay, listen up...";
+ next;
+ mes "["+@name$+"]";
+ if ($@keuc_BaseCost)
+ mes "The base cost is of "+$@keuc_BaseCost+"z.";
+ mes "Each card to be removed incurs a cost of +"+$@keuc_CardCost+"z.";
+ mes "The refine level of the compounded equipment can incur an additional cost:";
+ mes "Armors: "+$@keuc_UpgradeCostA+"z per level.";
+ mes "Lv1 Weapons: "+$@keuc_UpgradeCostW1+"z per level.";
+ mes "Lv2 Weapons: "+$@keuc_UpgradeCostW2+"z per level.";
+ mes "Lv3 Weapons: "+$@keuc_UpgradeCostW3+"z per level.";
+ mes "Lv4 Weapons: "+$@keuc_UpgradeCostW4+"z per level.";
+
+ if ($@keuc_Mat1 && $@keuc_Qty1) {
+ mes "The materials needed are:";
+ mes "- "+$@keuc_Qty1+" "+getitemname($@keuc_Mat1)+".";
+ }
+ if ($@keuc_Mat2 && $@keuc_Qty2)
+ mes "- "+$@keuc_Qty2+" "+getitemname($@keuc_Mat2)+".";
+
+ if ($@keuc_Fail1Chance || $@keuc_Fail2Chance)
+ mes "There is a chance the process might fail and you'll lose your items.";
+
+ next;
+ callfunc "F_keIntro", -1, "";
+ } else {
+ if (SF_uncard(@kmenu-2))
+ return;
+ }
+ } while (@kmenu >1);
+ return;
+
+//Subfunction SF_uncard (equipment-position)
+//Attempts to uncard the equipment.
+function SF_uncard {
+ set @part, getarg(0);
+ if(getequipcardcnt(@part) == 0) {
+ callfunc "F_keIntro", e_ag, "There are no cards to remove there!";
+ return 0;
+ }
+ set @cost, $@keuc_BaseCost;
+ set @cost, @cost + $@keuc_CardCost*getequipcardcnt(@part);
+
+ switch (getequipweaponlv(@part)) {
+ case 0: //Armor
+ set @upgradeCost, $@keuc_UpgradeCostA;
+ break;
+ case 1: //Lv1 Weapons
+ set @upgradeCost, $@keuc_UpgradeCostW1;
+ break;
+ case 2: //Lv2 Weapons
+ set @upgradeCost, $@keuc_UpgradeCostW2;
+ break;
+ case 3: //Lv3 Weapons
+ set @upgradeCost, $@keuc_UpgradeCostW3;
+ break;
+ default: //Lv4 Weapons
+ set @upgradeCost, $@keuc_UpgradeCostW4;
+ }
+
+ set @cost, @cost + @upgradeCost*getequiprefinerycnt(@part);
+
+ set @price, callfunc("F_keCost",@cost,$@keuc_discount);
+
+ if ($@keuc_Fail1Chance) {
+ set @failsave, select(
+ "- Cancel",
+ "- Remove cards ("+@price+"z, item gets priority)",
+ "- Remove cards ("+@price+"z, cards get priority)",
+ );
+ } else {
+ set @failsave, select(
+ "- Cancel",
+ "- Remove cards ("+@price+"z)"
+ );
+ }
+ if (@failsave == 1)
+ return 0;
+ set @failsave, @failsave-1; //1: Save item, 2: Save Card
+
+ if (($@keuc_Mat1 && countitem($@keuc_Mat1) < $@keuc_Qty1)
+ || ($@keuc_Mat2 && countitem($@keuc_Mat2) < $@keuc_Qty2)) {
+ callfunc "F_keIntro", e_pif, "You do not have all the materials I need...";
+ return 0;
+ }
+
+ if (!(callfunc("F_keCharge",@cost,$@keuc_discount,1))) {
+ callfunc "F_keIntro", e_ag, "Sorry, you don't have enough zeny.";
+ return 0;
+ }
+
+ if ($@keuc_Mat1 && $@keuc_Qty1)
+ delitem $@keuc_Mat1, $@keuc_Qty1;
+ if ($@keuc_Mat2 && $@keuc_Qty2)
+ delitem $@keuc_Mat2, $@keuc_Qty2;
+
+ set @failtype,-1;
+ //Recycling cost...
+ set @cost, rand(1000);
+ if (@cost < $@keuc_Fail2Chance) //Total Failure
+ set @failtype, 0;
+ else if (@cost < $@keuc_Fail1Chance) //Partial Failure
+ set @failtype, @failsave;
+ else if (@cost < $@keuc_Fail0Chance) //Harmless Failure
+ set @failtype, 3;
+ else { //Success
+ successremovecards @part;
+ emotion e_ho;
+ return 1;
+ }
+ failedremovecards @part,@failtype;
+ if (@failtype == 1)
+ mes "The cards were lost...";
+ if (@failtype == 2)
+ mes "The item was lost...";
+ if (@failtype == 0)
+ mes "Lost the cards and item...";
+ callfunc "F_keIntro", e_swt, "...oops.";
+ return 1;
+}
+
+}
|