/trunk
-- ======= |
local MYADDON_NAME = "SimpleAssist"; |
local MYADDON_VERSION = "3.11"; |
local MYADDON_VERSION = "3.3"; |
local MYADDON_AUTHOR = "Schnoggo"; |
local MYADDON_EMAIL = "schnoggo@gmail.com"; |
local MYADDON_WEBSITE = "http://www.wowinterface.com/downloads/author-45553.html"; |
local myPlayerName=UnitName("player"); |
local myPlayerClassText, myPlayerClassType = UnitClass("player"); |
-- default config settings |
-- default config settings |
local SimpleAssistDefaults={SimpleAssistPrefsRAID=false, |
-- -------------------------- |
SLASH_SIMPLEASSIST1 = "/sass"; |
SlashCmdList["SIMPLEASSIST"] = SimpleAssist_CommandLine; |
--[[this is code]]-- |
-- Register the event handlers: |
-- ============================= |
-- ============================= |
self:RegisterEvent("VARIABLES_LOADED"); |
-- self:RegisterEvent("CHAT_MSG_TEXT_EMOTE"); |
self:RegisterEvent("PLAYER_ENTERING_WORLD"); |
self:RegisterEvent("UPDATE_BINDINGS"); |
self:RegisterEvent("PLAYER_LEAVE_COMBAT"); |
self:RegisterEvent("PLAYER_ENTERING_WORLD"); |
self:RegisterEvent("UPDATE_BINDINGS"); |
self:RegisterEvent("PLAYER_LEAVE_COMBAT"); |
self:RegisterEvent("PLAYER_REGEN_ENABLED"); |
if (not myPlayerName) then |
myPlayerName = UnitName("player"); |
end |
function SimpleAssist_Event(event) |
local eventHandled = false; |
local inParty, unitID; |
-- VARIABLES_LOADED |
-- ================ |
if ( event == "VARIABLES_LOADED" ) then |
if ( event == "VARIABLES_LOADED" ) then |
-- record that we have been loaded: |
SimpleAssist_variablesLoaded = true; |
if not (SimpleAssistSavedVars) then |
if not (SimpleAssistSavedVars) then |
SimpleAssistSavedVars={ |
SimpleAssistPrefsRAID=false, |
SimpleAssistPrefsSAY = false, |
SimpleAssistSavedVars["CustomChat"][2]=SASSTEXT_CUSTOM_CALL_MIDDLE; |
SimpleAssistSavedVars["CustomChat"][3]=SASSTEXT_CUSTOM_CALL_AFTER; |
else |
end |
eventHandled = true; |
end -- ( event == "VARIABLES_LOADED" ) |
if (eventHandled == false and event == "PLAYER_ENTERING_WORLD") then |
-- "frameType", "frameName", parentFrame[, "inheritsFrame"]); |
-- local f = CreateFrame("Button", "SimpleAssistActionFrame", nil, "SecureActionButtonTemplate"); |
f:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", -100, -100); -- (point, frame, relativePoint , x, y); |
-- putting the button off-screen to make it invisible |
-- f:SetPoint("BOTTOMRIGHT", "UIParent", "TOPLEFT", 2, -2); -- (point, frame, relativePoint , x, y); |
SimpleAssist_UpdateBindings(); |
eventHandled = true; |
end -- PLAYER_ENTERING_WORLD |
if (eventHandled == false and event == "UPDATE_BINDINGS") then |
if (eventHandled == false and event == "UPDATE_BINDINGS") then |
SimpleAssist_UpdateBindings(); |
eventHandled = true; |
end |
if (eventHandled == false and ((event == "PLAYER_LEAVE_COMBAT") or (event == "PLAYER_REGEN_ENABLED"))) then |
if (eventHandled == false and ((event == "PLAYER_LEAVE_COMBAT") or (event == "PLAYER_REGEN_ENABLED"))) then |
if (SimpleAssist_PendingLearn ~= nil) then |
-- SimpleAssist_PrivateLearnAssist(SimpleAssist_PendingLearn); |
-- replace with code that uses player name instead of unitID |
if (SimpleAssist_PendingLearn == "pending clear") then |
getglobal("SimpleAssistActionButton"):SetAttribute("macrotext", "/assist target"); |
SimpleAssist_PopMsg(SASSTEXT.CLEARED); |
end |
eventHandled = true; |
end -- event handled? |
if (eventHandled == false) then |
-- msgText = string.lower(arg1); |
end |
end |
end -- end of function |
function SimpleAssist_UpdateBindings() |
if getglobal("SimpleAssistActionButton") then |
local k1, k2, k3 = GetBindingKey("SASS_ASSIST"); |
function SimpleAssistTester() |
SimpleAssist_PopMsg("Yadda"); |
end |
end |
-- command line parameters: (slash command handler) |
function SimpleAssist_CommandLine(msg) |
if ( msg =="0") then |
SimpleAssistPrefsFrame:Hide(); |
end |
end |
function(k,v) |
if (getglobal(k) ~= nil) then |
if string.find("Text",k) then |
else |
getglobal(k):SetChecked(v); |
end |
end |
end |
getglobal(tMsgName):SetText(tMsgText); |
end |
end |
-- draw the radio buttons for Icon |
if (SimpleAssistSavedVars["SimpleAssistRaidIcon"] == nil) then |
SimpleAssistSavedVars["SimpleAssistRaidIcon"] = 0; |
end |
SimpleAssistUpdateRadios(); |
-- update tabs: |
if (SimpleAssistPrefs_CurrentPanel==nil) then |
SimpleAssistPrefs_CurrentPanel=-1; |
SimpleAssistPrefs_CurrentPanel=-1; |
SimpleAssist_HidePanel(2); |
SimpleAssist_HidePanel(1); |
if (tPanel<1) then |
tPanel=1 |
end |
SimpleAssist_ShowPanel(tPanel); |
end |
i=i+1; |
end |
end |
function SimpleAssist_ShowPanel(whichPanel) |
if (SimpleAssistPrefs_CurrentPanel > 0) then |
SimpleAssist_HidePanel(SimpleAssistPrefs_CurrentPanel); |
end |
getglobal(SimpleAssistPrefs_PanelFrames[whichPanel]):Show(); |
SimpleAssistPrefs_CurrentPanel=whichPanel; |
end |
function SimpleAssist_LearnAssist(unit) |
-- {unit} = ID of unit to be set as assist (from Target) |
if (InCombatLockdown()) then |
local thisUnitName=UnitName(unit); |
if (thisUnitName==nil) then |
SimpleAssist_PendingLearn="pending clear"; -- use a name with a space and no upper-case |
SimpleAssist_PendingLearn="pending clear"; -- use a name with a space and no upper-case |
SimpleAssist_PopMsg(SASSTEXT.CLEAR_PENDING); |
else |
SimpleAssist_PendingLearn=thisUnitName; |
getglobal("SimpleAssistActionButton"):SetAttribute("macrotext", "/assist target"); |
SimpleAssist_PopMsg(SASSTEXT.CLEARED); |
end |
if (UnitIsPlayer(unit)) then |
if (UnitIsFriend("target", unit)) then -- unit could technically be "target" here... (changed from player to target for Battle of Darrowshire and similar events |
-- SimpleAssist_units["assist1"]=UnitName(unit); |
local thisUnitName=UnitName(unit); |
-- expand the macro code here |
-- /assist [target=focus, exists] |
-- check for modifier to use |
-- check for modifier to use |
-- /use [nomodifier, nomounted]Snowy Gryphon; |
-- /use [modifier:alt]Palomino Bridle; |
getglobal("SimpleAssistActionButton"):SetAttribute("macrotext", "/assist "..thisUnitName); |
end |
function SimpleAssist_AskAssist() |
local uName=UnitName("target"); |
if (uName ~= nil) then -- only ask for help if there is a target |
-- local msg = SASSTEXT.CHAT_ASSIST; |
-- string.gsub(s, pattern, replace [, n]) |
local p1=SimpleAssistSavedVars["CustomChat"][1]; |
local p2=SimpleAssistSavedVars["CustomChat"][2]; |
local p3=SimpleAssistSavedVars["CustomChat"][3]; |
-- format the message: |
if (p1 ~= "") then |
p1=p1.." "; |
-- p3=" "..p3; |
-- end |
local msg = p1 .. myPlayerName .. p2 .. uName .. p3; |
-- tell it to the world (or party, or raid...) |
if (IsInGroup()) then |
if (IsInRaid()) then |
if (SimpleAssistSavedVars["SimpleAssistRaidIcon"] ~= 0) then |
SetRaidTarget("target",SimpleAssistSavedVars["SimpleAssistRaidIcon"]); |
end |
else -- not raid, just party |
if (SimpleAssistSavedVars["SimpleAssistPrefsPARTY"] ) then |
SendChatMessage(msg, "PARTY"); |
end |
if (SimpleAssistSavedVars["SimpleAssistRaidIcon"] ~= 0) then |
SetRaidTarget("target",SimpleAssistSavedVars["SimpleAssistRaidIcon"]); |
end |
end -- party |
else -- not in a group, so only yell, say or emote |
if (SimpleAssistSavedVars["SimpleAssistPrefsYELL"]) then |
SendChatMessage(msg, "YELL"); |
if (SimpleAssistSavedVars["SimpleAssistPrefsSAY"]) then |
SendChatMessage(msg, "SAY"); |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsEMOTE"]) then |
DoEmote("ATTACKMYTARGET"); |
end |
if (SimpleAssistSavedVars["SimpleAssistRaidIcon"] ~= 0) then |
SetRaidTarget("target",SimpleAssistSavedVars["SimpleAssistRaidIcon"]); |
end |
end -- in group/solo test |
end -- have target |
end |
function SimpleAssist_PopMsg(msg) |
-- Our head's up display for this AddOn |
-- Inputs: {msg} = message to display in the HUD |
SimpleAssistAlertFrame:AddMessage(msg, 1, 1, 1, 1, 3); |
end |
end |
function SimpleAssist_DoAssist() |
-- this function is now a dummy. It exists only so that a keybinding can be set. |
end |
## Interface: 80000 |
## Interface: 80205 |
## X-Min-Interface: 70300 |
## Title: SimpleAssist |
## Notes: Replace the common /assist macro |
## Version: 3.11 |
## Version: 3.3 |
## Author: Schnoggo |
## Dependencies: |
## SavedVariables: SimpleAssistSavedVars |
SASSTEXT_TITLE="Schnoggo's Simple Assist Ver. 3.11"; |
SASSTEXT_TITLE="Schnoggo's Simple Assist Ver. 3.3"; |
SASSTEXT_OPTIONSPACING=-60; -- vertical distance between each TITLE below: |
SASSTEXT_SUMMARY="Use the Key Bindings (Main Menu:Key Binding) panel to set up your keys."; |
SASSTEXT_BINDING_SET_TITLE="Set Player to Assist"; |
BINDING_NAME_SASS_ASK = "Request Assistance"; |
SASSTEXT = { |
WELCOME="SimpleAssist 3.11 Loaded. Type /sass to change settings.", |
WELCOME="SimpleAssist 3.3 Loaded. Type /sass to change settings.", |
ASSISTING="Assisting", |
CLEARED="Assist Cleared", |
ASSIST_SET="Assist set", |
CLEAR_PENDING="Assist will be cleared when you leave combat. ", |
CHAT_ASSIST="Assist {name} in attacking {target}." |
}; |
SASSTEXT_ATTACK_EMOTE="to attack"; |
SimpleAssist v3.11 |
SimpleAssist v3.3 |
Description |
=========== |
SimpleAssist is a World of Warcraft AddOn. |
SimpleAssist is a World of Warcraft AddOn. |
Is is a replacement for the usual "/assist {name}" macro. |
Features |
======== |
* Compatibility with World of Warcraft v5.0x |
* Low memory usage (~0.1MB) |
* Key bind to set the assist |
Usage |
===== |
Go to the Key Bindings panel from the Main Menu. |
Set a key to remember who to assist. |
Go to the Key Bindings panel from the Main Menu. |
Set a key to remember who to assist. |
Set one to assist that player. |
Simple! |
Versions |
======== |
3.3 October 2, 2019 |
* Updated TOC and version for WoW client 8.2.5 |
3.2 July 2, 2019 |
* Updated TOC and version for WoW client 8.2 |
3.11 July 18, 2018 |
* Fixed warning about undefined relative frames |
2.2 - Dec 26, 2006 |
* Updated for WoW 2.0 client. |
* Because of in-combat restrictions, setting a new assist during combat will not work. |
* Because of in-combat restrictions, setting a new assist during combat will not work. |
The next version will include a scheduler to allow you set a new assist and have it take effect |
when you leave combat. |
2.11 - Aug 22, 2006 |
* Updated TOC numbers for patch 1.12. No other changes. |
Author: Schnoggo (schnoggo@gmail.com) |
Website: http://lonk.me |