------------------------------------------------ -- BillDooNZ's version based of the original version below, with Rock5's mods! -- v4.0 -- -- All this does is allow you to use the 'standard' buffs a bit easier, and with less code :) -- However, I've sacrificed readability a bit for this, as you will see in the example below: -- buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff()); -- -- Pretty cryptic huh? Well, the function buffUp is defined like this: -- buffUp(luck, speed, mountSpeed, casting, jump, defense, aggro, foodType) -- -- So, the parameters it takes are: -- -- --------------------------------------------- -- Parameter | Details -- --------------------------------------------- -- luck | use luck pot? true/false -- speed | use running speed pot? true/false -- mountSpeed | use mount speed pot? true/false -- casting | use casting pot? true/false -- jump | use jump pot? true/false -- defense | use defense pot? true/false -- aggro | use aggro generation pot? true/false -- foodType | what type of food to use? * For this one I wrote a helper function to -- determine if you want Physical/Magic enhancing food - this is called -- determineFoodTypeToBuff() and will choose it based on your primary -- class only. Otherwise specify SPECIAL_TYPES_PHYSICAL for physical food -- or SPECIAL_TYPES_SPELL for magical food. -- --------------------------------------------- -- -- so in my original example, if I am a scout/mage: -- buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff()); -- will use luck pots, speed pots, casting pots, defense pots, and a physical food. ------------------------------------------------ ------------------------------------------------ -- Original comment below: ------------------------------------------------ -- Use food/pots/items and check for its buff with table support -- JDuarteDJ & Giram -- Version 3.1 ------------------------------------------------ -- I suggest we use the buff effect as name in every pot/food -- like 'speed' instead of 'unbrindledenthusiasm' -- also replaced potID with just ID, not all are pots :P -- jump has 1 minute cd so it now pauses script for min it it tries to jump many times. local itemTable function useGoodie(_itemName,_buffName) --ofc I came up with a silly name itemTable = itemTable or { --potions --lvl 1+ giant = {ID = 207199, buffName = 506683, castTime = 0}, -- Fullness(tested r5) speed = {ID = 207200, buffName = 506684, castTime = 0}, -- Unbridled Enthusiasm (tested r5) frog = {ID = 207201, buffName = 506685, castTime = 1500}, -- Princely Look (tested r5) --lvl 31+ casting = {ID = 207202, buffName = 506686, castTime = 0}, -- Clear Thought (tested r5) --lvl 41+ luck = {ID = 207203, buffName = 506687, castTime = 0}, --Turn of Luck Powder Dust (tested r5) --lvl 51+ riding = {ID = 207204, buffName = 506688, castTime = 1000}, --Galloping Gale (tested r5) --lvl 61+ jump = {ID = 207205, buffName = "", castTime = 3000}, --crazy breakout (tested) --lvl 71+ defense = {ID = 207206, buffName = 495644, castTime = 2500}, --Scarlet Love (506690 = gmatch error) --lvl 81+ agro = {ID = 207207, buffName = 495645, castTime = 1000}, --Pungent Vileness 506691 (some wait time but no cast time, tested) --lvl 91+ godspeed = {ID = 207208, buffName = 495646, castTime = 0}, --Godspeed. Instant cast. 1 min CD. (tested) --foods --lvl 1-20 pdmg = {ID = 207209, buffName = 506673, castTime = 0}, -- Housekeeper Special Salted Fish with Sauce (tested r5) ( pDam + ((pDam + 48)*.03 + 48)) mdmg = {ID = 207210, buffName = 506674, castTime = 0}, -- 501132, 506674. Housekeeper Special Smoked Bacon with Herbs (tested r5) --lvl 21-40 critp = {ID = 207211, buffName = 506675, castTime = 0}, -- 501138, 506675. Housekeeper Special Caviar Sandwich (tested r5) matt = {ID = 207212, buffName = 506676, castTime = 0}, -- 501143, 506676. Housekeeper Special Deluxe Seafood (tested r5) --lvl 41-80 patt2 = {ID = 207213, buffName = 495631, castTime = 0}, -- Housekeeper Special Spicy Meatsauce Burrito (tested) mdmg2 = {ID = 207214, buffName = 495632, castTime = 0}, -- Housekeeper Special Delicious Swamp Mix (tested) --lvl 81-100 patt3 = {ID = 207215, buffName = 506679, castTime = 0}, -- 506679. Housekeeper Special Unimaginable Salad (checked) matt3 = {ID = 207216, buffName = 495634, castTime = 0} -- 501145, 506680. Housekeeper Special Cheese Fishcake } local option = itemTable[_itemName] if not option then option = {} if not _buffName then option.buffName = _itemName --Assume both have same name like in mounts else option.buffName = _buffName end option.ID = _itemName --luckily the inventory functions use Name Or ID option.castTime = 0 end -- If still id, change to name if type(option.buffName) == "number" then option.buffName = GetIdName(option.buffName) or RoMScript("TEXT('Sys"..option.buffName.."_name')") end -- Check if failed to get name if type(option.buffName) ~= "string" or string.match(option.buffName,"Sys%d%d%d%d%d%d-name") then print("Failed to get buff name for ".._itemName) return end if inventory:itemTotalCount(option.ID,"all") >= 1 and not player:hasBuff(option.buffName) then inventory:useItem(option.ID); cprintf(cli.yellow,"Used " .._itemName.. ".\n",_itemName) if option.castTime > 0 then yrest(option.castTime); end inventory:update(); yrest(800); end end function countGoodie(_itemName,_buffName) --helper function to get a count of the particular goodie itemTable = itemTable or { --potions --lvl 1+ giant = {ID = 207199, buffName = 506683, castTime = 0}, -- Fullness(tested r5) speed = {ID = 207200, buffName = 506684, castTime = 0}, -- Unbridled Enthusiasm (tested r5) frog = {ID = 207201, buffName = 506685, castTime = 1500}, -- Princely Look (tested r5) --lvl 31+ casting = {ID = 207202, buffName = 506686, castTime = 0}, -- Clear Thought (tested r5) --lvl 41+ luck = {ID = 207203, buffName = 506687, castTime = 0}, --Turn of Luck Powder Dust (tested r5) --lvl 51+ riding = {ID = 207204, buffName = 506688, castTime = 1000}, --Galloping Gale (tested r5) --lvl 61+ jump = {ID = 207205, buffName = "", castTime = 3000}, --crazy breakout (tested) --lvl 71+ defense = {ID = 207206, buffName = 495644, castTime = 2500}, --Scarlet Love (506690 = gmatch error) --lvl 81+ agro = {ID = 207207, buffName = 495645, castTime = 1000}, --Pungent Vileness 506691 (some wait time but no cast time, tested) --lvl 91+ godspeed = {ID = 207208, buffName = 495646, castTime = 0}, --Godspeed. Instant cast. 1 min CD. (tested) --foods --lvl 1-20 pdmg = {ID = 207209, buffName = 506673, castTime = 0}, -- Housekeeper Special Salted Fish with Sauce (tested r5) mdmg = {ID = 207210, buffName = 506674, castTime = 0}, -- 501132, 506674. Housekeeper Special Smoked Bacon with Herbs (tested r5) --lvl 21-40 critp = {ID = 207211, buffName = 506675, castTime = 0}, -- 501138, 506675. Housekeeper Special Caviar Sandwich (tested r5) matt = {ID = 207212, buffName = 506676, castTime = 0}, -- 501143, 506676. Housekeeper Special Deluxe Seafood (tested r5) --lvl 41-80 patt2 = {ID = 207213, buffName = 495631, castTime = 0}, -- Housekeeper Special Spicy Meatsauce Burrito (tested) mdmg2 = {ID = 207214, buffName = 495632, castTime = 0}, -- Housekeeper Special Delicious Swamp Mix (tested) --lvl 81-100 patt3 = {ID = 207215, buffName = 506679, castTime = 0}, -- 506679. Housekeeper Special Unimaginable Salad (checked) matt3 = {ID = 207216, buffName = 495634, castTime = 0} -- 501145, 506680. Housekeeper Special Cheese Fishcake } local option = itemTable[_itemName] if not option then option = {} if not _buffName then option.buffName = _itemName --Assume both have same name like in mounts else option.buffName = _buffName end option.ID = _itemName --luckily the inventory functions use Name Or ID option.castTime = 0 end -- If still id, change to name if type(option.buffName) == "number" then option.buffName = GetIdName(option.buffName) or RoMScript("TEXT('Sys"..option.buffName.."_name')") end -- Check if failed to get name if type(option.buffName) ~= "string" or string.match(option.buffName,"Sys%d%d%d%d%d%d-name") then print("Failed to get buff name for ".._itemName) return end return inventory:itemTotalCount(option.ID,"all") or 0; end --helpers SPECIAL_TYPES_PHYSICAL = 1; SPECIAL_TYPES_SPELL = 2; --example usage: buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff()); function buffUp(luck, speed, mountSpeed, casting, jump, defense, aggro, foodType) if (luck) then useGoodie("luck"); end; if (speed) then useGoodie("speed"); end; if (mountSpeed) then useGoodie("riding"); end; if (casting) then useGoodie("casting"); end; if (jump) then useGoodie("jump"); end; if (defense) then useGoodie("defense"); end; if (aggro) then useGoodie("aggro"); end; if (foodType == SPECIAL_TYPES_SPELL) then if (countGoodie("matt3") > 0) then useGoodie("matt3"); elseif (countGoodie("mdmg2") > 0) then useGoodie("mdmg2"); elseif (countGoodie("matt") > 0) then useGoodie("matt"); elseif (countGoodie("mdmg") > 0) then useGoodie("mdmg"); else printf("Count not apply spell food buff as you do not have any spell food!\n"); end; elseif (foodType == SPECIAL_TYPES_PHYSICAL) then if (countGoodie("patt3") > 0) then useGoodie("patt3"); elseif (countGoodie("patt2") > 0) then useGoodie("patt2"); elseif (countGoodie("critp") > 0) then useGoodie("critp"); elseif (countGoodie("pdmg") > 0) then useGoodie("pdmg"); else printf("Count not apply physical food buff as you do not have any physical food!\n"); end; else printf("An invalid food type was specified for the buffUp function, should be physical/spell (1 and 2 respectively)\n"); end; end; local classToFoodTypeMap = { CLASS_WARRIOR = SPECIAL_TYPES_PHYSICAL, CLASS_SCOUT = SPECIAL_TYPES_PHYSICAL, CLASS_ROGUE = SPECIAL_TYPES_PHYSICAL, CLASS_MAGE = SPECIAL_TYPES_SPELL, CLASS_PRIEST = SPECIAL_TYPES_SPELL, CLASS_KNIGHT = SPECIAL_TYPES_PHYSICAL, CLASS_WARDEN = SPECIAL_TYPES_SPELL, CLASS_DRUID = SPECIAL_TYPES_SPELL, CLASS_WARLOCK = SPECIAL_TYPES_SPELL, CLASS_CHAMPION = SPECIAL_TYPES_PHYSICAL } function determineFoodTypeToBuff() return classToFoodTypeMap[player.Class1]; end;