// TMW2 Script // Author: // Jesusalva, Micksha, Meway // Description: // Cooking System (Player, Guild, NPC) // Usage: CookingSystem ({scope}) // Scopes: CRAFT_NPC, CRAFT_PLAYER // If an invalid scope is passed, .knowledge won't be set but will be required // Returns true on success, false on failure function script CookingSystem { // Set .scope, .knowledge and .success .scope=getarg(0, CRAFT_PLAYER); if (.scope == CRAFT_PLAYER) { if (!getskilllv(TMW2_COOKING)) { mesc l("You don't know how to cook."), 1; return false; } copyarray(.knowledge,RECIPES_COOKING,getarraysize(RECIPES_COOKING)); } .success=false; setskin "craft3"; .@var$ = requestcraft(6); // ????? setskin ""; .@craft = initcraft(.@var$); .@entry = findcraftentry(.@craft, CRAFT_COOKING); // ?????? if (debug || $@GM_OVERRIDE) mes "found craft entry: " + .@entry; if (debug || $@GM_OVERRIDE) mes "knowledge value: " + .knowledge[.@entry]; if (.@entry < 0) { .success=false; } else { if (.scope == CRAFT_NPC || .knowledge[.@entry]) { .@s=validatecraft(.@craft); // Could not validate (not enough resources) if (!.@s) { mesc l("Not crafting - insufficient materials!"), 1; return false; } usecraft(.@craft); .@it=getcraftcode(.@entry); .@bt=min(1500, getiteminfo(.@it, ITEMINFO_SELLPRICE)) * 10; // basetime .@tm=limit(3600, .@bt * getskilllv(TMW2_COOKING), 86400); // Create the item immediately (in case you crash, etc.) rentitem(.@it, .@tm); // From 1 hour to 1 day // Note: Seasoning it will destroy it and re-rent it once done if (countitem(.@it) != 1) { mesc l("Skipping seasoning: You have multiple %s.", getitemlink(.@it)); } else { mesc l("Do you want to try to season it? If you succeed, it might become more powerful, but if you fail, it might become weaker."); select l("No"), l("Yes"); mes ""; if (@menu == 2) { .@moves=5;.@goal=rand2(4,10);.@stat=0;.@view=false;.@smel=false; while (.@moves) { mesc l(".:: Seasoning ::."); mesc l("You have %d moves left.%s%s", .@moves, (.@view ? "" : l(" You can view the recipe once.")), (.@smel ? "" : l(" You can smell the recipe once."))); next; select l("Put a large amount of spice"), l("Put a small amount of spice"), rif(!.@view, l("View the dish")), rif(!.@smel, l("Smell the dish")), l("Finish the seasoning"); mes ""; switch (@menu) { case 1: .@stat+=3; .@moves -= 1; break; case 2: .@stat+=2; .@moves -= 1; break; case 3: if ((.@stat + 5) <= .@goal) mesc l("You cannot see any spice in there."); else if ((.@stat + 3) <= .@goal) mesc l("The spice is vaguely visible... It needs more."); else if (.@stat <= .@goal) mesc l("The spice seems good... or at least, almost enough..."); else if (.@stat - 3 <= .@goal) mesc l("The spice is clearly visible... This is not a good sign."); else mesc l("The dish is covered in spice. It is ruined."); .@view=true; next; break; case 4: if ((.@stat + 5) <= .@goal) mesc l("You cannot smell any spice in there."); else if ((.@stat + 3) <= .@goal) mesc l("The spice's smell is too faint... It needs more."); else if (.@stat <= .@goal) mesc l("The spice smells good... or at least, almost enough..."); else if (.@stat - 3 <= .@goal) mesc l("The spice is smelling strong... This is not a good sign."); else mesc l("The spice smell is nauseating. The dish is ruined."); .@smel=true; next; break; case 5: .@moves=0; break; } // switch move } // while game // Recreate the item, so its rent time is preserved delitem .@it, 1; rentitem(.@it, .@tm); delinventorylist(); // Needed, because we'll rely on rfind() getinventorylist(); .@index=array_rfind(@inventorylist_id, .@it); .@opt1 = any(VAR_DEXAMOUNT, VAR_MAXSPAMOUNT, VAR_VITAMOUNT, CLASS_DAMAGE_BOSS_TARGET, VAR_ITEMDEFPOWER, VAR_PLUSASPD, IOPT_CRITDMG, RANGE_ATTACK_DAMAGE_USER, IOPT_SCPROVOKE_BLIND, SP_DRAIN, HP_DRAIN); // By how much you missed the goal? // Note: It is perfectly possible to avoid a negative bonus .@excess = abs(.@stat-.@goal); if (.@excess == 0) .@pow = 30; // The default assigned power else if (.@excess == 1) .@pow = 20; else if (.@excess == 2) .@pow = 10; else if (.@excess == 3) .@pow = -10; else if (.@excess == 4) .@pow = -20; else .@pow = -30; // Translate .@pow into a value and apply it .@val1=csys_BonusCalc(getskilllv(TMW2_COOKING), abs(.@pow), .@opt1); if (.@pow < 0) .@val1=-(.@val1); // If you're lucky: Cancel the debuff if (.@val1 < 0 && .@opt1 == IOPT_SCPROVOKE_BLIND) .@val1=0; // Apply the seasoning bonus setitemoptionbyindex(.@index, 0, .@opt1, .@val1); } // if seasoning } // if can season .success=true; } else { .success=false; } } deletecraft .@craft; setskin ""; return .success; } /* Alchemy can rely in cross-building Where a weaker potion is base for a stronger one Standard Duration = 2 minutes ~ 5 minutes Reagents: Water ...Eggs? ...Milk? Nymph Poison Death Potion Manapple Products: Tea (Chamomile, Spearmint, Oolong, Jasmine, Yerba Mate?) → Argaes Water + «Herbal Reagent» OK Coffee (Shadow Herb + Tonori Water) OK Piberries Infusion (Piberries + Curshroom) OK Atropos Mixture (Lachesis Brew + Clotho Liquor) OK Death Potion (Dragonfruit + Nightshade Tea) OK Smoke Grenade (Cactus pot + Coal) OK Grenade (Cactus pot + Sulfur Powder) OK Scented Grenade (Cactus pot + Moss) OK Haste Potion (Plushshroom) OK Strength Potion (Chagashroom) Return Potion (Hurnscald Recipe => Ocean Croc Claw + Hard Spike? Grass Seeds?) OK Status Reset (Curshroom + Mana Piou Feather) OK Homun Stat Reset (Curshroom + Manapple) OK Move Speed (Gem Powder + Fluor Powder) OK Precision (Piberries + Mt. Snake Egg) OK Dodge Potion (Piberries + Snake Egg) OK Luck, Dex, Int, Vit, Agi (Gems + Tea) OK Sacred Life (Golden Apple + Elixir of Life) OK Sacred Mana (Golden Apple + Celestia Tea) OK Sacred Revival (Sacred Life + Sacred Mana) OK Broken Warp Crystal? (Wurtizite + Black Mamba Skin) OK Magic Apple? (Divine Apple + Manapple? Death Potion? Sacred Life/Revival?) OK Purification Potion (Nymph Poison + Sacred Life) OK Iced Bottle (Tonori W. + Argaes W.) OK Insurance Contract (» Insurance?) (Quill + Reed Bundle) OK Insurance (Quill + Death Potion) Mysterious Fruit? (Legendary) For all Scrolls: Quill + ? (depends on scroll itself) » Summon Scrolls (Based on mob parts, 1× mob?) → alignment_cansummon() + SummonMagic() or summon() directly → Criteria between weak/strong version is alignment → When aligned, scrolls always summon strongest ver → Level must be equal or superior to strongest, tho » Maggot/Giant Maggot: Bug Leg (Lv 40) » CaveMaggot: Maggot Slime » Green Dragon/Nightmare: Dragon Scales (Lv 105) » Wolvern: Wolvern Pelt » Moggun/Yeti: Frozen Yeti Tear (Lv 60) » Terranite/T.Prot.: Terranite Ore (Lv 90) » Magnus Heal (Lifestone) » Area Provoke? → Scent grenade? » Guild Skills? OK » ScrollAngelLightA ( + ) OK » ScrollBattlePlansA ( + ) OK » ScrollDefenseBlessA ( + ) OK » ScrollCriticalFortuneA ( + ) → TODO: Kyrie Eleison (Absolute Shield) → With self-stun, makes you a temporary wall? → Maybe a item of Quill + LoF Coin for guild skills? (LoF Quill) // Skills for Aegis Shield, all beyond maximum level // Slimes, Snakes, Fairies, Darth Duck, Mr. Prickel // PoisonS.Mushroom // TODO: Lizards, (Black)Scorpions, Moonshroom, Black Mamba, Centaur skill TMW2_HALHISS, 10; skill TMW2_KALSPIKE, 9; skill TMW2_LIMERIZER, 10; skill TMW2_FAIRYKINGDOM, 9; skill TMW2_DUCKY, 10; skill TMW2_FAIRYEMPIRE, 10; */