/trunk
SASSTEXT_TITLE="Schnoggo's Simple Assist Ver. 2.94"; |
SASSTEXT_TITLE="Schnoggo's Simple Assist Ver. 3.00"; |
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 2.94 Loaded. Type /sass to change settings.", |
WELCOME="SimpleAssist 3.0 Loaded. Type /sass to change settings.", |
ASSISTING="Assisting", |
CLEARED="Assist Cleared", |
ASSIST_SET="Assist set", |
SimpleAssist v2.94 |
SimpleAssist v3.0 |
Description |
=========== |
Versions |
======== |
3.0 Oct 13, 2014 |
* Updated TOC and version for WoW client 6.02 |
* Switched from GetNumPartyMembers to GetNumGroupMembers model |
2.94 - Mar 5, 2013 |
* Updated TOC and version for WoW client 5.2 |
2.62 - May 6, 2009 |
* TOC update for WoW client 3.1. |
2.61 - Oct 14, 2008 |
* Fixed zip packaging at wowinterface. |
1.0 - Feb 4, 2006 |
* First version released |
To-Do |
====== |
* Next version will have an option to allow raid/group leaders set your Assist for you. |
* Use addon channel to negotiate a Lookout Leader. The leader chooses which Raid Icon to use. |
* Convert targeting of Players to Raid Icon |
* Add AQ20 bug fight with ability to |
Contact |
======= |
Author: Schnoggo (schnoggo@gmail.com) |
Website: http://schnoggo.com |
Website: http://lonk.me |
SimpleAssist_AskAssist(); |
</Binding> |
</Bindings> |
-- ======= |
local MYADDON_NAME = "SimpleAssist"; |
local MYADDON_VERSION = "2.94"; |
local MYADDON_VERSION = "3.0"; |
local MYADDON_AUTHOR = "Schnoggo"; |
local MYADDON_EMAIL = "schnoggo@gmail.com"; |
local MYADDON_WEBSITE = "http://schnoggo.com"; |
local MYADDON_WEBSITE = "http://lonk.me"; |
local myPlayerRealm=GetCVar("realmName"); |
local myPlayerName=UnitName("player"); |
SimpleAssistDefaults["CustomChat"][1]="Help"; |
SimpleAssistDefaults["CustomChat"][2]="in attacking"; |
SimpleAssistDefaults["CustomChat"][3]="."; |
SimpleAssistDefaults["version"]=2; |
SimpleAssistDefaults["version"]=3; |
-- My local functions: |
-- ==================== |
--[[ |
if (eventHandled == false and event == "CHAT_MSG_TEXT_EMOTE") then |
if ( arg1 ~= nil) then |
msgText = string.lower(arg1); |
if (string.find( msgText, SASSTEXT_ATTACK_EMOTE) ) then |
if (arg2 ~= nil) then |
-- if (UnitIsPlayer(arg2)) then |
inParty, unitID=SimpleAssist_PlayerInParty(arg2) |
if (inParty) then -- setup pref to toggle party behavior |
-- SimpleAssist_units["assist1"]=UnitName(unit); |
AssistUnit(arg2); |
SimpleAssist_PopMsg(SASSTEXT.ASSISTING .. " " .. arg2); |
end -- party member |
end -- speaker is not nil |
end -- message asks to attack |
end -- msg not nil |
end -- is in chat msg |
]]-- |
if (eventHandled == false and event == "PLAYER_ENTERING_WORLD") then |
-- "frameType", "frameName", parentFrame[, "inheritsFrame"]); |
-- local f = CreateFrame("Button", "SimpleAssistActionFrame", nil, "SecureActionButtonTemplate"); |
function SimpleAssist_PrivateLearnAssist(unit) |
-- inputs |
-- unit to remember |
-- if no unit, clear the remembered "assistee" |
if (UnitName(unit) == nil) then |
-- SimpleAssist_units["assist1"]=nil; |
getglobal("SimpleAssistActionButton"):SetAttribute("macrotext", "/assist target"); |
SimpleAssist_PopMsg(SASSTEXT.CLEARED); |
getglobal("SimpleAssistActionButton"):SetAttribute("macrotext", "/assist target"); |
SimpleAssist_PopMsg(SASSTEXT.CLEARED); |
end |
if (UnitIsPlayer(unit)) then |
function SimpleAssist_AskAssist() |
local partyCount = GetNumPartyMembers(); |
local raidCount = GetNumRaidMembers(); |
local uName=UnitName("target"); |
if (uName ~= nil) then |
if (uName ~= nil) then -- only ask for help if there is a target |
-- local msg = SASSTEXT.CHAT_ASSIST; |
-- string.gsub(s, pattern, replace [, n]) |
-- msg=string.gsub(msg, "{name}", myPlayerName ); |
local p1=SimpleAssistSavedVars["CustomChat"][1]; |
local p2=SimpleAssistSavedVars["CustomChat"][2]; |
local p3=SimpleAssistSavedVars["CustomChat"][3]; |
-- format the message: |
if (p1 ~= "") then |
p1=p1.." "; |
end |
-- if (p3 ~= "") then |
-- p3=" "..p3; |
-- end |
local msg = p1 .. myPlayerName .. p2 .. uName .. p3; |
local msg = p1 .. myPlayerName .. p2 .. uName .. p3; |
if ((SimpleAssistSavedVars["SimpleAssistPrefsRAID"]) and (raidCount > 0)) then |
SendChatMessage(msg, "RAID"); |
-- tell it to the world (or party, or raid...) |
if (IsInGroup()) then |
if (IsInRaid()) then |
if (SimpleAssistSavedVars["SimpleAssistPrefsRAID"]) then |
SendChatMessage(msg, "RAID"); |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsRW"]) then |
SendChatMessage(msg, "RAID_WARNING"); |
end |
if (SimpleAssistSavedVars["SimpleAssistRaidIcon"] ~= 0) then |
SetRaidTarget("target",SimpleAssistSavedVars["SimpleAssistRaidIcon"]); |
end |
else -- not raid, just party |
if (SimpleAssistSavedVars["SimpleAssistPrefsPARTY"] ) then |
SendChatMessage(msg, "PARTY"); |
end |
end -- party |
else -- only show party if not in raid |
if ((SimpleAssistSavedVars["SimpleAssistPrefsPARTY"]) and (partyCount > 0)) then |
SendChatMessage(msg, "PARTY"); |
else -- not in a group, so only yell, say or emote |
if (SimpleAssistSavedVars["SimpleAssistPrefsYELL"]) then |
SendChatMessage(msg, "YELL"); |
end |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsYELL"]) then |
SendChatMessage(msg, "YELL"); |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsSAY"]) then |
SendChatMessage(msg, "SAY"); |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsSAY"]) then |
SendChatMessage(msg, "SAY"); |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsRW"]) then |
SendChatMessage(msg, "RAID_WARNING"); |
end |
end |
-- if (GetNumRaidMembers()>0) then |
if (SimpleAssistSavedVars["SimpleAssistRaidIcon"] ~= 0) then |
SetRaidTarget("target",SimpleAssistSavedVars["SimpleAssistRaidIcon"]); |
end |
-- end |
if (SimpleAssistSavedVars["SimpleAssistPrefsEMOTE"]) then |
DoEmote("ATTACKMYTARGET"); |
end |
if (SimpleAssistSavedVars["SimpleAssistPrefsEMOTE"]) then |
DoEmote("ATTACKMYTARGET"); |
end |
end -- in group/solo test |
end -- have target |
end |
function SimpleAssist_PlayerInParty(name) |
-- Determine if {name} is in our party or raid |
-- Inputs: {name} = a player name [string] |
-- |
-- Outputs: {arg1} = whether {name} is in our group/raid [boolean] |
-- {arg2} = unitID of {name} |
local partyCount = GetNumPartyMembers(); |
local raidCount = GetNumRaidMembers(); |
local inRaid=false; |
local raidID=nil; |
if true and raidCount > 0 then |
-- see if in raid |
for i=1, raidCount do |
local raidName, rank, subgroup, level, class, fileName, zone, online = GetRaidRosterInfo(i); |
if (raidName ~= nil) then |
if (raidName == name) then |
inRaid=true; |
raidID="raid"..i; |
break; |
end |
end |
end |
elseif (partyCount > 0) then |
-- see if in party |
for i=1, partyCount do |
if UnitName("party"..i) == name then |
inRaid=true; |
break; |
end |
end |
end |
return inRaid, raidID; |
end |
## Interface: 50200 |
## Interface: 60000 |
## Title: SimpleAssist |
## Notes: Replace the common /assist macro |
## Version: 2.94 |
## Version: 3.0 |
## Author: Schnoggo |
## Dependencies: |
## SavedVariables: SimpleAssistSavedVars |