diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-09-12 14:49:37 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-09-12 14:49:37 -0300 |
commit | ef38b86a05cc83b104816408e709ff1baebc9ffc (patch) | |
tree | 732441ae714a3bdc02f6fc0140d2f1f085653fb6 | |
parent | 63a14e252c4ce66636fff736c39c74feb1b4cb5a (diff) | |
download | serverdata-ef38b86a05cc83b104816408e709ff1baebc9ffc.tar.gz serverdata-ef38b86a05cc83b104816408e709ff1baebc9ffc.tar.bz2 serverdata-ef38b86a05cc83b104816408e709ff1baebc9ffc.tar.xz serverdata-ef38b86a05cc83b104816408e709ff1baebc9ffc.zip |
Update crafting recipes to use Gumi's code, which is MUCH more maintainable.
-rw-r--r-- | db/craft_db.conf | 4 | ||||
-rw-r--r-- | npc/craft/recipes.txt | 618 |
2 files changed, 165 insertions, 457 deletions
diff --git a/db/craft_db.conf b/db/craft_db.conf index 52eb34381..5e51689a1 100644 --- a/db/craft_db.conf +++ b/db/craft_db.conf @@ -860,7 +860,7 @@ craft_db: ( /****************************************************************************/ { Id: 55 - Name: "CraftShortsword" + Name: "CraftShortSword" Flag: 16 ReturnCode: 3527 //ShortSword @@ -2773,7 +2773,7 @@ craft_db: ( ////////////////////////////////////////////////////////////////////////////// { Id: 122 - Name: "CraftSkyPiercer" + Name: "CraftSkypiercer" Flag: 16 ReturnCode: 7421 //Skypiercer diff --git a/npc/craft/recipes.txt b/npc/craft/recipes.txt index 6a5450fb3..8425d7679 100644 --- a/npc/craft/recipes.txt +++ b/npc/craft/recipes.txt @@ -36,26 +36,69 @@ OnUse: close; // Expects: @scope$ -// showRecipe( Craft, Bonus, {amount 1, item 1}, {amount 2, item 2}... ) +// showRecipe( recipe{, recipe...} ) function showRecipe { - if (getargcount() < 3 || getargcount() % 2 != 0 || @scope$ == "") + if (@scope$ == "") return Exception("Faulty recipe skill command invoked - error"); - // getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]") - if (getd("RECIPES_"+@scope$+"["+getarg(0)+"]")) { - if (getarg(1)) { - mes l(".:: @@ Recipe ::.", getitemlink(getarg(1))); + freeloop(true); + for (.@a = 0; .@a < getargcount(); ++.@a) { + .@const$ = data_to_string(getarg(.@a)); - for (.@i=2;.@i < getargcount(); .@i++) { - mesc l("@@/@@ @@", countitem(getarg(.@i+1)), getarg(.@i), getitemlink(getarg(.@i+1))); - .@i++; + if (startswith(.@const$, "Craft")) { + // infer the item constant from the craft constant + .@recipe = getarg(.@a); + + .@item = string_to_data(substr(.@const$, 5, getstrlen(.@const$) - 1)); + } else { + // infer the craft constant from the item constant + .@recipe = string_to_data(sprintf("Craft%s", .@const$)); + .@item = getarg(.@a); + } + + if (.@item <= 0) { + // target item not found + debugmes("ERROR, INVALID ITEM ID DETECTED at showRecipe"); + continue; + } + + if (!getd("RECIPES_"+@scope$+"["+.@recipe+"]") && !$@GM_OVERRIDE) { + // does not have the recipe + continue; + } + + for (.@inv = 0; .@inv < 9; ++.@inv) { + .@size = getcraftrecipe(.@recipe, .@inv, .@qty[0], .@item_id[0]); + + if (.@size < 0) { + if (.@size == -1) { + // recipe does not exist + break; + } + // inventory does not exist + break; + } + + mes(l(".:: %s Recipe ::.", getitemlink(.@item))); + + for (.@it = 0; .@it < .@size; ++.@it) { + .@recipe_item = .@item_id[.@it]; + .@recipe_qty = .@qty[.@it]; + + if (.@recipe_item <= 0) { + break; + } + + mesc(sprintf("%d/%d %s", countitem(.@recipe_item), .@recipe_qty, getitemlink(.@recipe_item))); } - mes ""; + + mes(""); + .@count++; } - return 1; } - //debugmes "Nope, nothing here"; - return 0; + freeloop(false); + + return .@count > 0; } // =============================== Cooking Functions @@ -68,7 +111,7 @@ function readCooking { next; mesc l("List of known cooking recipes:"); mes ""; - showRecipe(0, Iten, WarpedLog, 9999); + //showRecipe(0, Iten, WarpedLog, 9999); next; @scope$=""; return; @@ -92,56 +135,36 @@ function readAlchemy { // General Boosts mesc "----------"+l("General Recipes")+"----------", 2; - showRecipe(CraftHastePotion, HastePotion, - 15, Plushroom); - showRecipe(CraftStrengthPotion, StrengthPotion, - 15, Chagashroom); - showRecipe(CraftResetPotion, StatusResetPotion, - 90, ManaPiouFeathers, 10, Curshroom); - showRecipe(CraftSpeedPotion, MoveSpeedPotion, - 1, GemPowder, 5, FluoPowder); - showRecipe(CraftPrecisionPotion, PrecisionPotion, - 3, Piberries, 1, MountainSnakeEgg); - showRecipe(CraftDodgePotion, DodgePotion, - 3, Piberries, 1, SnakeEgg); + showRecipe(HastePotion, + StrengthPotion, + StatusResetPotion, + MoveSpeedPotion, + PrecisionPotion, + DodgePotion); dnext; // Stats Boosts mesc "----------"+l("Stat Boost Recipes")+"----------", 2; - showRecipe(CraftLukPotionA, LukPotionA, - 1, EmeraldPowder, 1, HerbalTea); - showRecipe(CraftLukPotionB, LukPotionB, - 1, Emerald, 2, HerbalTea); - showRecipe(CraftLukPotionC, LukPotionC, - 1, PolishedEmerald, 3, HerbalTea); - - showRecipe(CraftDexPotionA, DexPotionA, - 1, AmethystPowder, 1, HerbalTea); - showRecipe(CraftDexPotionB, DexPotionB, - 1, Amethyst, 2, HerbalTea); - showRecipe(CraftDexPotionC, DexPotionC, - 1, PolishedAmethyst, 3, HerbalTea); - - showRecipe(CraftIntPotionA, IntPotionA, - 1, SapphirePowder, 1, HerbalTea); - showRecipe(CraftIntPotionB, IntPotionB, - 1, Sapphire, 2, HerbalTea); - showRecipe(CraftIntPotionC, IntPotionC, - 1, PolishedSapphire, 3, HerbalTea); - - showRecipe(CraftVitPotionA, VitPotionA, - 1, DiamondPowder, 1, HerbalTea); - showRecipe(CraftVitPotionB, VitPotionB, - 1, Diamond, 2, HerbalTea); - showRecipe(CraftVitPotionC, VitPotionC, - 1, PolishedDiamond, 3, HerbalTea); - - showRecipe(CraftAgiPotionA, AgiPotionA, - 1, TopazPowder, 1, HerbalTea); - showRecipe(CraftAgiPotionB, AgiPotionB, - 1, Topaz, 2, HerbalTea); - showRecipe(CraftAgiPotionC, AgiPotionC, - 1, PolishedTopaz, 3, HerbalTea); + showRecipe(LukPotionA, + LukPotionB, + LukPotionC); + + showRecipe(IntPotionA, + IntPotionB, + IntPotionC); + + showRecipe(VitPotionA, + VitPotionB, + VitPotionC); + + showRecipe(AgiPotionA, + AgiPotionB, + AgiPotionC); + + showRecipe(DexPotionA, + DexPotionB, + DexPotionC); + next; @scope$=""; return; @@ -159,435 +182,120 @@ function readCrafting { mes ""; // Melee Weapons: Never use Titanium nor Lead. Iron-based, no silver mesc "----------"+l("One Hand Weapon Recipes")+"----------", 2; - showRecipe(CraftDagger, Dagger, - 1, IronIngot, - 3, Coal, - 1, SulfurPowder); - showRecipe(CraftWoodenSword, WoodenSword, - 20, WoodenLog, - 5, RawLog, - 1, SharpKnife); - showRecipe(CraftBugSlayer, BugSlayer, - 8, IronIngot, - 12, Coal, - 1, EverburnPowder); - showRecipe(CraftShortGladius, ShortGladius, - 12, IronIngot, - 16, Coal, - 1, EverburnPowder); - showRecipe(CraftBacksword, Backsword, - 18, IronIngot, - 3, TinIngot, - 20, Coal, - 1, EverburnPowder); - showRecipe(CraftShortsword, ShortSword, - 24, IronIngot, - 5, TinIngot, - 24, Coal, - 1, EverburnPowder); - showRecipe(CraftKitana, Kitana, - 30, IronIngot, - 9, TinIngot, - 30, Coal, - 1, EverburnPowder); - showRecipe(CraftBoneKnife, BoneKnife, - 36, IronIngot, - 90, Bone, - 30, Coal, - 1, EverburnPowder); - showRecipe(CraftLongSword, LongSword, - 42, IronIngot, - 1, PlatinumIngot, - 1, IridiumIngot, - 32, Coal); - showRecipe(CraftRockKnife, RockKnife, - 50, TerraniteOre, - 2, PlatinumIngot, - 3, IridiumIngot, - 40, Coal); - showRecipe(CraftDivineSword, DivineSword, - 2, DivineApple, - 3, PlatinumIngot, - 5, IridiumIngot, - 60, Coal); + showRecipe(Dagger, + WoodenSword, + BugSlayer, + ShortGladius, + Backsword, + ShortSword, + Kitana, + BoneKnife, + LongSword, + RockKnife, + DivineSword); dnext; // Two Hands Melee Weapons: Never use Titanium nor Lead. Silver-based. mesc "----------"+l("Two Hands Weapon Recipes")+"----------", 2; - showRecipe(CraftMiereCleaver, MiereCleaver, - 12, SilverIngot, - 1, TinIngot, - 8, Coal, - 1, EverburnPowder); - showRecipe(CraftBroadsword, Broadsword, - 27, SilverIngot, - 1, TinIngot, - 20, Coal, - 1, EverburnPowder); // Reserved ID 63 and 64 // Halberd is really cheap as it doesn't uses Platinum/Iridium :P - showRecipe(CraftHalberd, Halberd, - 45, SilverIngot, - 5, TinIngot, - 34, Coal, - 1, EverburnPowder); - showRecipe(CraftImmortalSword, ImmortalSword, - 40, SilverIngot, - 2, PlatinumIngot, - 3, IridiumIngot, - 1, BlueManaPearl); + showRecipe(MiereCleaver, + Broadsword, + Halberd, + ImmortalSword); dnext; // Archery Weapons: Always use Wood, Root and Carp. mesc "----------"+l("Archery Weapon Recipes")+"----------", 2; - showRecipe(CraftShortBow, ShortBow, - 18, WoodenLog, - 12, Root, - 3, LeatherPatch, - 1, CommonCarp); - showRecipe(CraftForestBow, ForestBow, - 24, WoodenLog, - 16, Root, - 5, LeatherPatch, - 3, CommonCarp); - showRecipe(CraftElficBow, ElficBow, - 33, WoodenLog, - 22, Root, - 1, IronIngot, - 4, CommonCarp); - showRecipe(CraftChampionshipBow, ChampionshipBow, - 48, WoodenLog, - 32, Root, - 1, GoldIngot, - 5, CommonCarp); - showRecipe(CraftBansheeBow, BansheeBow, - 70, WoodenLog, - 45, Root, - 5, DarkCrystal, - 5, CommonCarp); + showRecipe(ShortBow, + ForestBow, + ElficBow, + ChampionshipBow, + BansheeBow); dnext; // Magical Weapons: Wood + powders mesc "----------"+l("Magical Weapon Recipes")+"----------", 2; - showRecipe(CraftTrainingWand, TrainingWand, - 20, WoodenLog, - 30, ManaPiouFeathers, - 5, FluoPowder, - 1, GemPowder); - showRecipe(CraftNoviceWand, NoviceWand, - 40, WoodenLog, - 60, ManaPiouFeathers, - 8, FluoPowder, - 1, GemPowder); - showRecipe(CraftApprenticeWand, ApprenticeWand, - 60, WoodenLog, - 90, ManaPiouFeathers, - 12, FluoPowder, - 1, GemPowder); - showRecipe(CraftLeaderWand, LeaderWand, - 100, WoodenLog, - 120, ManaPiouFeathers, - 15, FluoPowder, - 1, GemPowder); - showRecipe(CraftLegendaryWand, LegendaryWand, - 110, WoodenLog, - 3, GoldenApple, - 20, FluoPowder, - 1, GemPowder); + showRecipe(TrainingWand, + NoviceWand, + ApprenticeWand, + LeaderWand, + LegendaryWand); dnext; // Firestaff Weapons: Lead + Titanium mesc "----------"+l("Fire Staffs Recipes")+"----------", 2; - showRecipe(CraftPynRevolver, PynRevolver, - 4, LeadIngot, - 5, TitaniumIngot, - 11, Coal, - 1, EverburnPowder); - showRecipe(CraftPynRifle, PynRifle, - 6, LeadIngot, - 7, TitaniumIngot, - 14, Coal, - 1, EverburnPowder); - showRecipe(CraftPynGatling, PynGatling, - 7, LeadIngot, - 7, TitaniumIngot, - 14, Coal, - 1, EverburnPowder); - showRecipe(CraftPynShotgun, PynShotgun, - 9, LeadIngot, - 10, TitaniumIngot, - 16, Coal, - 1, EverburnPowder); + showRecipe(PynRevolver, + PynRifle, + PynGatling, + PynShotgun); dnext; // Shields: May use Leather. Titanium or Lead, but never both mesc "----------"+l("Shield Recipes")+"----------", 2; - showRecipe(CraftWoodenShield, WoodenShield, - 40, WoodenLog, - 2, LeatherPatch, - 1, SharpKnife); - showRecipe(CraftBladeShield, BladeShield, - 14, IronIngot, - 4, TinIngot, - 5, Coal, - 1, EverburnPowder); // Exception to shield rule: Braknar Shield - showRecipe(CraftBraknarShield, BraknarShield, - 18, CopperIngot, - 2, TinIngot, - 5, Coal, - 1, EverburnPowder); - showRecipe(CraftBritShield, BritShield, - 20, CopperIngot, - 3, TitaniumIngot, - 7, Coal, - 1, EverburnPowder); - showRecipe(CraftBromenalShield, BromenalShield, - 24, CopperIngot, - 4, TitaniumIngot, - 10, Coal, - 1, EverburnPowder); - showRecipe(CraftBlueKnightShield, BlueKnightShield, - 30, CopperIngot, - 5, TitaniumIngot, - 15, Coal, - 1, EverburnPowder); - showRecipe(CraftSteelShield, SteelShield, - 20, TinIngot, - 7, TitaniumIngot, - 20, Coal, - 1, EverburnPowder); - showRecipe(CraftDragonShield, DragonShield, - 80, DragonScales, - 10, TitaniumIngot, - 30, Coal, - 1, EverburnPowder); - showRecipe(CraftSaviorShield, SaviorShield, - 1, MylarinDust, - 15, TitaniumIngot, - 40, Coal, - 1, EverburnPowder); + showRecipe(WoodenShield, + BladeShield, + BraknarShield, + BritShield, + BromenalShield, + BlueKnightShield, + SteelShield, + DragonShield, + SaviorShield); dnext; // Chest Armors -> Primary Ore + Secondary Ore + Iron Powder + Earth Powder mesc "----------"+l("Chest Armor Recipes")+"----------", 2; - showRecipe(CraftLeatherShirt, LeatherShirt, - 35, LeatherPatch, - 2, IronIngot, - 8, IronPowder, - 1, EarthPowder); - showRecipe(CraftLieutenantArmor, LieutenantArmor, - 4, CopperIngot, - 4, IronIngot, - 12, IronPowder, - 1, EarthPowder); - showRecipe(CraftChainmail, Chainmail, - 10, IronIngot, - 2, SilverIngot, - 18, IronPowder, - 1, EarthPowder); - showRecipe(CraftCopperArmor, CopperArmor, - 10, CopperIngot, - 3, IronIngot, - 22, IronPowder, - 1, EarthPowder); - showRecipe(CraftLightPlatemail, LightPlatemail, - 15, IronIngot, - 5, SilverIngot, - 24, IronPowder, - 1, EarthPowder); - showRecipe(CraftGoldenLightPlate, GoldenLightPlatemail, - 15, GoldIngot, - 1, LightPlatemail, - 26, IronPowder, - 1, EarthPowder); - showRecipe(CraftWarlordPlate, WarlordPlate, - 15, TitaniumIngot, - 5, SilverIngot, - 28, IronPowder, - 1, EarthPowder); - showRecipe(CraftGoldenWarlord, GoldenWarlordPlate, - 45, GoldIngot, - 1, WarlordPlate, - 30, IronPowder, - 1, EarthPowder); - showRecipe(CraftBromenalChest, BromenalChest, - 11, TitaniumIngot, - 5, SilverIngot, - 11, IronPowder, - 1, EarthPowder); - showRecipe(CraftAssassinChest, AssassinChest, - 5, PlatinumIngot, - 30, CottonCloth, - 34, IronPowder, - 1, EarthPowder); + showRecipe(LeatherShirt, + LieutenantArmor, + Chainmail, + CopperArmor, + LightPlatemail, + GoldenLightPlatemail, + WarlordPlate, + GoldenWarlordPlate, + BromenalChest, + AssassinChest); dnext; // Pants -> Primary Item + Secondary Item + Leather Patch + Earth Powder mesc "----------"+l("Pants Recipes")+"----------", 2; - showRecipe(CraftJeansShorts, JeansShorts, - 10, CottonCloth, - 5, CaveSnakeSkin, - 10, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftRaidTrousers, RaidTrousers, - 30, CottonCloth, - 25, WhiteFur, - 14, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftLeatherTrousers, LeatherTrousers, - 30, CottonCloth, - 20, Coal, - 19, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftJeansChaps, JeansChaps, - 35, SnakeSkin, - 20, CottonCloth, - 22, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftSilkPants, SilkPants, - 150,SilkCocoon, - 5, CottonCloth, - 24, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftChainmailSkirt, ChainmailSkirt, - 10, IronIngot, - 15, SilverIngot, - 26, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftBromenalPants, BromenalPants, - 5, TitaniumIngot, - 4, CopperIngot, - 28, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftWarlordPants, WarlordPants, - 8, TitaniumIngot, - 10, SilverIngot, - 30, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftAssassinPants, AssassinPants, - 3, IridiumIngot, - 35, CottonCloth, - 34, LeatherPatch, - 1, EarthPowder); + showRecipe(JeansShorts, + RaidTrousers, + LeatherTrousers, + JeansChaps, + SilkPants, + ChainmailSkirt, + BromenalPants, + WarlordPants, + AssassinPants); dnext; // Gloves: Gloves items mesc "----------"+l("Gloves Recipes")+"----------", 2; - showRecipe(CraftSilkGloves, SilkGloves, - 40, SilkCocoon, - 5, PiouFeathers, - 1, WhiteFur, - 1, EarthPowder); - showRecipe(CraftLeatherGloves, LeatherGloves, - 10, LeatherPatch, - 10, PiouFeathers, - 5, WhiteFur, - 1, EarthPowder); - showRecipe(CraftBromenalGloves, BromenalGloves, - 30, LeatherPatch, - 3, AnimalBones, - 15, WhiteFur, - 1, EarthPowder); - showRecipe(CraftManaGloves, ManaGloves, - 1, SacredManaPotion, - 1, BlueManaPearl, - 45, WhiteFur, - 1, EarthPowder); - showRecipe(CraftWarlordGloves, WarlordGloves, - 1, IridiumIngot, - 1, PlatinumIngot, - 60, WhiteFur, - 1, EarthPowder); - showRecipe(CraftAssassinGloves, AssassinGloves, - 1, IridiumIngot, - 1, PlatinumIngot, - 150, WhiteFur, - 1, EarthPowder); + showRecipe(SilkGloves, + LeatherGloves, + BromenalGloves, + ManaGloves, + WarlordGloves, + AssassinGloves); dnext; // Helmets: Helmet items mesc "----------"+l("Helmet Recipes")+"----------", 2; - showRecipe(CraftInfantryHelmet, InfantryHelmet, - 3, IronIngot, - 3, CopperIngot, - 5, Lifestone, - 1, EarthPowder); - showRecipe(CraftDesertHelmet, DesertHelmet, - 4, IronIngot, - 4, CopperIngot, - 7, Lifestone, - 1, EarthPowder); - showRecipe(CraftBromenalHelmet, BromenalHelmet, - 7, CopperIngot, - 2, SilverIngot, - 8, Lifestone, - 1, EarthPowder); - showRecipe(CraftCandleHelmet, CandleHelmet, - 2, EverburnPowder, - 1, DesertHelmet, - 10, Lifestone, - 1, EarthPowder); - showRecipe(CraftCrusadeHelmet, CrusadeHelmet, - 7, SilverIngot, - 5, TinIngot, - 14, Lifestone, - 1, EarthPowder); - showRecipe(CraftWarlordHelmet, WarlordHelmet, - 7, SilverIngot, - 2, TitaniumIngot, - 20, Lifestone, - 1, EarthPowder); - showRecipe(CraftVikingHelmet, VikingHelmet, - 1, IridiumIngot, - 5, TitaniumIngot, - 27, Lifestone, - 1, EarthPowder); - showRecipe(CraftTerraniteHelmet, TerraniteHelmet, - 3, TerraniteIngot, - 30, Coal, - 32, Lifestone, - 1, EarthPowder); - showRecipe(CraftCenturionHelmet, CenturionHelmet, - 2, IridiumIngot, - 10, TitaniumIngot, - 32, Lifestone, - 1, EarthPowder); - showRecipe(CraftBullHelmet, BullHelmet, - 3, IridiumIngot, - 10, LeadIngot, - 36, Lifestone, - 1, EarthPowder); - showRecipe(CraftDarkHelm, DarkHelm, - 3, IridiumIngot, - 12, LeadIngot, - 40, Lifestone, - 1, EarthPowder); - showRecipe(CraftDarkKnightHelmet, DarkKnightHelmet, - 5, IridiumIngot, - 3, PlatinumIngot, - 50, Lifestone, - 1, EarthPowder); - showRecipe(CraftSamuraiHelmet, SamuraiHelmet, - 3, IridiumIngot, - 5, PlatinumIngot, - 50, Lifestone, - 1, EarthPowder); + showRecipe(InfantryHelmet, + DesertHelmet, + BromenalHelmet, + CandleHelmet, + CrusadeHelmet, + WarlordHelmet, + VikingHelmet, + TerraniteHelmet, + CenturionHelmet, + BullHelmet, + DarkHelm, + DarkKnightHelmet, + SamuraiHelmet); dnext; // Misc: Misc items mesc "----------"+l("Miscellaneous Recipes")+"----------", 2; - showRecipe(CraftGoldenRing, GoldenRing, - 5, GoldPieces, - 1, TitaniumIngot, - 8, Coal, - 1, EverburnPowder); - showRecipe(CraftTerranitePants, TerranitePants, - 2, TerraniteIngot, - 15, Coal, - 32, LeatherPatch, - 1, EarthPowder); - showRecipe(CraftTerraniteArmor, TerraniteArmor, - 4, TerraniteIngot, - 45, Coal, - 32, IronPowder, - 1, EarthPowder); - showRecipe(CraftSkyPiercer, Skypiercer, - 1, SunnyCrystal, - 5, PlatinumIngot, - 20, IridiumIngot, - 10, EverburnPowder); + showRecipe(GoldenRing, + TerranitePants, + TerraniteArmor, + Skypiercer); next; @scope$=""; return; |