Skip to content

Commit

Permalink
Fixed Sharpening Stones / LUA errors / Add flasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Softrix committed Jun 5, 2023
1 parent 77712e8 commit 529704c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 42 deletions.
8 changes: 7 additions & 1 deletion SmartBuff.buffs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ function SMARTBUFF_InitItemList()
_,SMARTBUFF_FLASK2 = GetItemInfo(46376); --"Flask of the Frost Wyrm"
_,SMARTBUFF_FLASK3 = GetItemInfo(46379); --"Flask of Stoneblood"
_,SMARTBUFF_FLASK4 = GetItemInfo(46378); --"Flask of Pure Mojo"
_,SMARTBUFF_FLASK5 = GetItemInfo(44939); --"Lesser Flask of Resistance"
_,SMARTBUFF_FLASK6 = GetItemInfo(40079); --"Lesser Flask of Toughness"
_,SMARTBUFF_ELIXIRTBC1 = GetItemInfo(22831); --"Elixir of Major Agility"
_,SMARTBUFF_ELIXIRTBC2 = GetItemInfo(28104); --"Elixir of Mastery"
_,SMARTBUFF_ELIXIRTBC3 = GetItemInfo(22825); --"Elixir of Healing Power"
Expand Down Expand Up @@ -639,6 +641,8 @@ function SMARTBUFF_InitSpellIDs()
SMARTBUFF_BFLASK2 = GetSpellInfo(53755); --"Flask of the Frost Wyrm"
SMARTBUFF_BFLASK3 = GetSpellInfo(53758); --"Flask of Stoneblood"
SMARTBUFF_BFLASK4 = GetSpellInfo(54212); --"Flask of Pure Mojo"
SMARTBUFF_BFLASK5 = GetSpellInfo(62213); --"Lesser Flask of Resistance"
SMARTBUFF_BFLASK6 = GetSpellInfo(53899); --"Lesser Flask of Toughness"
SMARTBUFF_BFLASKCT1 = GetSpellInfo(79471); --"Flask of the Winds"
SMARTBUFF_BFLASKCT2 = GetSpellInfo(79472); --"Flask of Titanic Strength"
SMARTBUFF_BFLASKCT3 = GetSpellInfo(79470); --"Flask of the Draconic Mind"
Expand Down Expand Up @@ -944,8 +948,8 @@ function SMARTBUFF_InitSpellList()
{SMARTBUFF_AOTB, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTC, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTP, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_CALLPET, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet},
{SMARTBUFF_REVIVEPET, -1, SMARTBUFF_CONST_SELF},
{SMARTBUFF_CALLPET, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet},
};
end

Expand Down Expand Up @@ -1433,6 +1437,8 @@ function SMARTBUFF_InitSpellList()
{SMARTBUFF_FLASK2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK2},
{SMARTBUFF_FLASK3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK3},
{SMARTBUFF_FLASK4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK4},
{SMARTBUFF_FLASK5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK5},
{SMARTBUFF_FLASK6, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK6},
{SMARTBUFF_ELIXIR1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR1},
{SMARTBUFF_ELIXIR2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR2},
{SMARTBUFF_ELIXIR3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR3},
Expand Down
68 changes: 37 additions & 31 deletions SmartBuff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
-- Cast the most important buffs on you, tanks or party/raid members/pets.
-------------------------------------------------------------------------------

SMARTBUFF_DATE = "280523";
SMARTBUFF_DATE = "050623";

SMARTBUFF_VERSION = "r44."..SMARTBUFF_DATE;
SMARTBUFF_VERSION = "r46."..SMARTBUFF_DATE;
SMARTBUFF_VERSIONNR = 30401;
SMARTBUFF_TITLE = "SmartBuff";
SMARTBUFF_SUBTITLE = "Supports you in casting buffs";
Expand All @@ -25,7 +25,7 @@ local SmartbuffCommands = { "SBCVER", "SBCCMD", "SBCSYC" }
local SmartbuffSession = true;
local SmartbuffVerCheck = false; -- for my use when checking guild users/testers versions :)
local buildInfo = select(4, GetBuildInfo())
local SmartbuffRevision = 44;
local SmartbuffRevision = 46;
local SmartbuffVerNotifyList = {}

-- Using LibRangeCheck-2.0 by Mitchnull
Expand Down Expand Up @@ -66,6 +66,7 @@ local isParrot = false;
local isSync = false;
local isSyncReq = false;
local isInitBtn = false;
local isPrompting = false

local isShapeshifted = false;
local sShapename = "";
Expand Down Expand Up @@ -1910,6 +1911,9 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
or (mode == 1 and bs.Reminder and ((not isCombat and bs.COut)
or (isCombat and (bs.CIn or O.ToggleAutoCombat)))))) then

-- do we want to disable zoom while pending buffs exist?
if O.ScrollWheelSurpress then isPrompting = true; end

if (not bs.SelfOnly or (bs.SelfOnly and SMARTBUFF_IsPlayer(unit))) then
-- get current spell cooldown
cd = 0;
Expand Down Expand Up @@ -2054,9 +2058,8 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
tOh = offHandExpiration;
cOh = offHandCharges;


if (bs.MH) then
iSlot = INVSLOT_MAINHAND;
iSlot = 16;
iId = GetInventoryItemID("player", iSlot);
if (iId and SMARTBUFF_CanApplyWeaponBuff(buffnS, iSlot)) then
if (bMh) then
Expand All @@ -2065,7 +2068,6 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
charges = cMh;
if (charges == nil) then charges = -1; end
if (charges > 1) then cBuff.CanCharge = true; end
SMARTBUFF_AddMsgD(un .. " (WMH): " .. buffnS .. string.format(" %.0f sec left", tMh) .. ", " .. charges .. " charges left");
if (tMh <= rbTime or (O.CheckCharges and cBuff.CanCharge and charges > 0 and charges <= O.MinCharges)) then
buff = buffnS;
bt = tMh;
Expand All @@ -2081,8 +2083,8 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
end
end

if (bs.OH and not bExpire and not buffloc) then
iSlot = INVSLOT_OFFHAND
if (bs.OH and not bExpire and handtype == "") then
iSlot = 17
iId = GetInventoryItemID("player", iSlot);
if (iId and SMARTBUFF_CanApplyWeaponBuff(buffnS, iSlot)) then
if (bOh) then
Expand All @@ -2091,7 +2093,6 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
charges = cOh;
if (charges == nil) then charges = -1; end
if (charges > 1) then cBuff.CanCharge = true; end
SMARTBUFF_AddMsgD(un .. " (WOH): " .. buffnS .. string.format(" %.0f sec left", tOh) .. ", " .. charges .. " charges left");
if (tOh <= rbTime or (O.CheckCharges and cBuff.CanCharge and charges > 0 and charges <= O.MinCharges)) then
buff = buffnS;
bt = tOh;
Expand Down Expand Up @@ -2183,8 +2184,8 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
end
end

if (buff) then
if (buff) then

if (cBuff.IDS) then
SMARTBUFF_AddMsgD("Checking " ..i .. " - " .. cBuff.IDS .. " " .. buffnS);
end
Expand Down Expand Up @@ -2253,9 +2254,9 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
-- Check mode ---------------------------------------------------------------------------------------
elseif (mode == 1) then
currentUnit = nil;
currentSpell = nil;
currentSpell = nil;
if type(bt) ~= "number" then bt = 0; end
if (bufftarget == nil) then bufftarget = un; end

if (cBuff.IDS ~= nil or SMARTBUFF_IsItem(cBuff.Type) or cBuff.Type == SMARTBUFF_CONST_TRACK) then
-- clean up buff timer, if expired
if (bt and bt < 0 and bExpire) then
Expand All @@ -2274,7 +2275,6 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
tLastCheck = time - O.AutoTimer + 0.5;
return 0;
end

SMARTBUFF_SetMissingBuffMessage(bufftarget, buff, cBuff.IconS, cBuff.CanCharge, charges, bt, bExpire);
SMARTBUFF_SetButtonTexture(SmartBuff_KeyButton, cBuff.IconS);
return 0;
Expand Down Expand Up @@ -2337,6 +2337,9 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
end
end
end -- group or self
else
-- revert camera zoom back to normal.
isPrompting = false
end
end -- for buff
end
Expand Down Expand Up @@ -2419,29 +2422,25 @@ function SMARTBUFF_SetMissingBuffMessage(target, buff, icon, bCanCharge, nCharge
end
end

local cWeaponStandard = {0, 1, 4, 5, 6, 7, 8, 10, 13, 15, 16}; -- "Daggers", "Axes", "Swords", "Maces", "Staves", "Fist Weapons", "Polearms", "Thrown"
local cWeaponBlunt = {4, 5, 10, 13}; -- "Maces", "Staves", "Fist Weapons"
local cWeaponSharp = {0, 1, 6, 7, 8, 15}; -- "Daggers", "Axes", "Swords", "Polearms"

-- check if a spell/reagent could applied on a weapon
function SMARTBUFF_CanApplyWeaponBuff(buff, slot)
local cWeaponTypes = nil;
if (string.find(buff, SMARTBUFF_WEAPON_SHARP_PATTERN)) then
cWeaponTypes = SMARTBUFF_WEAPON_SHARP;
cWeaponTypes = cWeaponSharp;
elseif (string.find(buff, SMARTBUFF_WEAPON_BLUNT_PATTERN)) then
cWeaponTypes = SMARTBUFF_WEAPON_BLUNT;
cWeaponTypes = cWeaponBlunt;
else
cWeaponTypes = SMARTBUFF_WEAPON_STANDARD;
end

cWeaponTypes = cWeaponStandard;
end
local itemLink = GetInventoryItemLink("player", slot);
local _, _, itemCode = string.find(itemLink, "(%d+):");
local _, _, _, _, _, itemType, itemSubType = GetItemInfo(itemCode);

if (cWeaponTypes and itemSubType) then
for _, weapon in pairs(cWeaponTypes) do
if (string.find(itemSubType, weapon)) then
return true, weapon;
end
end

if (itemLink == nil) then return false end
local itemType, itemSubType, _, _, _, _, classId, subclassId = select(6, GetItemInfo(itemLink));
if (tcontains(cWeaponTypes, subclassId)) then
return true, itemSubType;
end
return false;
end
Expand Down Expand Up @@ -3032,6 +3031,7 @@ function SMARTBUFF_Options_Init(self)
if (O.ScrollWheel ~= nil and O.ScrollWheelDown == nil) then O.ScrollWheelDown = O.ScrollWheel; end
if (O.ScrollWheelUp == nil) then O.ScrollWheelUp = true; end
if (O.ScrollWheelDown == nil) then O.ScrollWheelDown = true; end
if (O.ScrollWheelSurpress == nil) then O.ScrollWheelSurpress = true; end
if (O.InCombat == nil) then O.InCombat = true; end
if (O.AutoSwitchTemplate == nil) then O.AutoSwitchTemplate = true; end
if (O.AutoSwitchTemplateInst == nil) then O.AutoSwitchTemplateInst = true; end
Expand Down Expand Up @@ -3341,6 +3341,13 @@ function SMARTBUFF_command(msg)
elseif (msg == "reload") then
SMARTBUFF_BuffOrderReset();
SMARTBUFF_OptionsFrame_Open(true);
elseif (msg == "zoom") then
O.ScrollWheelSurpress = not O.ScrollWheelSurpress;
if O.ScrollWheelSurpress then
SMARTBUFF_AddMsg("Camera will no longer zoom when scrolling the mouse to buff.", true);
else
SMARTBUFF_AddMsg("Camera will zoom when scrolling the mouse to buff (old default behaviour).", true);
end
else
SMARTBUFF_AddMsg(SMARTBUFF_VERS_TITLE, true);
SMARTBUFF_AddMsg("Syntax: /sbo [command] or /sbuff [command] or /smartbuff [command]", true);
Expand Down Expand Up @@ -4286,7 +4293,7 @@ end

function SMARTBUFF_OnPostClick(self, button, down)
if (not isInit) then return end
if (button) then
if (button and not isPrompting) then
if (button == "MOUSEWHEELUP") then
CameraZoomIn(1);
elseif (button == "MOUSEWHEELDOWN") then
Expand Down Expand Up @@ -4535,7 +4542,6 @@ end
function SMARTBUFF_BuffOrderBtnOnClick(self, button)
local n = self:GetID() + FauxScrollFrame_GetOffset(self:GetParent());
local i = cBuffIndex[B[CS()].Order[n]];
--SMARTBUFF_AddMsgD("Buff OnClick = "..n..", "..button);
if (button == "LeftButton") then
SMARTBUFF_OToggleBuff("S", i);
else
Expand Down
23 changes: 13 additions & 10 deletions localization.en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
SMARTBUFF_WHATSNEW = "\n\n|cffffffff Whats new:|r\n\n"
.." |cffffffffClassic version by Codermik, additional retail coding\n"
.." by Speedwaystar.\n\n\n"
.." Changes in r44.280523:\n\n"
.." * Fixed message spam when auto toggling off the\n"
.." gatherer switcher when entering a raid - this\n"
.." would only be seen if normal messages were on.\n\n"
.." * Added Nature's Grasp for Druids.\n"
.."\n"
.." |cffffff00I currently play on the Mirage Raceway EU\n"
.." classic WOTLK server as Alliance, I play Mik,\n"
.." Gabella, Castanova, Amarantine and various\n"
.." alts... too many actually :)\n\n"
.." Changes in r46.050623:\n\n"
.." * Fixed an issue causing weapon sharpening stones\n"
.." to apply to the same weapon even if you had MH/\n"
.." OH selected - thanks doctorwizzcurse. \n\n"
.." * Camera will no longer zoom when using the scroll\n"
.." mouse to apply buffs. Zooming will work normally\n"
.." when buffs are applied. If you prefer the original\n"
.." way then type /smartbuff zoom to toggle on/off.\n\n"
.."\n\n"
.." |cffffff00I currently play on the Mirage Raceway EU classic\n"
.." WOTLK server as Alliance, I play on Mik, Gabella,\n"
.." Castanova, Amarantine and various alts...\n"
.." ...too many actually :)\n\n"
.." Please feel free to say hello!\n\n\n"
.." |cff00FF7FMany thanks to Chris S., Samantha R. and\n"
.." Twilight's Sundries for their kind donations.\n"
Expand Down

0 comments on commit 529704c

Please sign in to comment.