--The main frame.
local frame = CreateFrame("Frame", "FinalFrame", UIParent, "BasicFrameTemplate")
frame:SetPoint("LEFT",0,0)
frame:SetWidth(200)
frame:SetHeight(200)
frame:EnableMouse(true)
frame:SetMovable(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
local frametext = frame:CreateFontString(nil, "OVERLAY", "GameTooltipText")
frametext:SetPoint("CENTER",frame,"CENTER",0,60)
frametext:SetText("Name")
frametext:SetTextHeight(24)
local classtext = frame:CreateFontString(nil, "OVERLAY", "GameToolTipText")
classtext:SetPoint("CENTER",frame,"CENTER",0,36)
classtext:SetText("Class")
classtext:SetTextHeight(18)
local healthtext = frame:CreateFontString(nil, "OVERLAY", "GameToolTipText")
healthtext:SetPoint("CENTER",frame,"CENTER",0,18)
healthtext:SetText("Max Health")
healthtext:SetTextHeight(18)
----------------------------------------------------------------------
--Functions
function hidebuttons()
accbutton:Hide();
trdbutton:Hide();
drcbutton:Hide();
end
function partybutton()
print("Would you like to add them to your party?");
accbutton = CreateFrame("Button","accbutton",frame,"UIPanelButtonTemplate")
accbutton:SetPoint("BOTTOMLEFT",0,2)
accbutton:SetWidth(80)
accbutton:SetHeight(22)
accbutton:SetText("Party")
accbutton:SetScript("OnClick", function(self, mouseButton)
InviteUnit(UnitName("target"));
hidebuttons();
end)
trdbutton = CreateFrame("Button","trdbutton",frame,"UIPanelButtonTemplate")
trdbutton:SetPoint("BOTTOMLEFT",0,24)
trdbutton:SetWidth(80)
trdbutton:SetHeight(22)
trdbutton:SetText("Trade")
trdbutton:SetScript("OnClick", function(self, mouseButton)
InitiateTrade("target");
hidebuttons();
end)
decbutton = CreateFrame("Button","decbutton",frame,"UIPanelButtonTemplate")
decbutton:SetPoint("BOTTOMLEFT",0,46)
decbutton:SetWidth(80)
decbutton:SetHeight(22)
decbutton:SetText("Close")
decbutton:SetScript("OnClick", function(self, mouseButton)
hidebuttons();
end)
end
function dpshealth()
if UnitHealthMax("target") / UnitHealth("target") <.50 then
if(GetLFGRoles() == isDPS) then
print("DONT FORGET THE DPS!")
end
end
end
function otherenddps()
print("Please target the Healer. If you do not target the healer, this will not work")
if UnitGroupRolesAssigned("target") == DAMAGER then
print("That is not the healer, please target the healer")
end
if UnitGroupRolesAssigned("target") == TANK then
print("That is not the healer, please target the healer")
end
if UnitGroupRolesAssigned("target") == HEALER then
messagedman = "target"
print("That is the healer. When you are at 50% or lower health, this addon will automatically send a message to the healer")
end
if UnitHealth("player") / UnitHealthMax("player") <=.50 then
SendChatMessage("HEAL ME!","WHISPER","nil",messagedman);
end
end
---------------------------------------------------------------------------------------------------------------------------------
--Working
print("Addon is currently working");
if UnitIsPlayer("target") then
frametext:SetText(UnitName("target"))
classtext:SetText(UnitClass("target") .. " " .. UnitRace("target"))
healthtext:SetText(UnitHealthMax("target") .. " Max HP")
partybutton();
end
local mybutton = CreateFrame("Button","mybutton",frame,"UIPanelButtonTemplate")
mybutton:SetPoint("BOTTOMRIGHT",-2,2)
mybutton:SetWidth(80)
mybutton:SetHeight(22)
mybutton:SetText("Twelve")
mybutton:SetScript("OnClick", function(self, mouseButton)
print("AW DUDE THIS BUTTON ROCKS!");
if UnitIsPlayer("target") then
print("This players name is " .. UnitName("target"));
print("They are a " .. UnitClass("target") .. " " .. UnitRace("target"));
print("They currently have " .. UnitHealth("target") .. " health, out of " .. UnitHealthMax("target") .. " health.");
partybutton();
frametext:SetText(UnitName("target"))
classtext:SetText(UnitClass("target") .. " " .. UnitRace("target"))
healthtext:SetText(UnitHealthMax("target") .. " Max HP")
end
end)
local chanbutton = CreateFrame("Button","chanbutton",UIParent,"UIPanelButtonTemplate")
chanbutton:SetPoint("BOTTOMRIGHT",0,0)
chanbutton:SetWidth(160)
chanbutton:SetHeight(22)
chanbutton:SetText("Join Channel Twelve")
chanbutton:SetScript("OnClick", function(self, mouseButton)
ChatFrame_AddChannel(DEFAULT_CHAT_FRAME, "Twelve");
end)
---------------------------------------------------------------------------'
--Currently in testing
--[[function questions()
question = CreateFrame("Frame","question",UIParent,"UIFrameTemplate")
question:SetPoint("BOTTONLEFT",0,0)
question:SetWidth(800)
question:SetHeight(100)
question:SetScript("OnLoad", questionone)
end--]]
SLASH_TWELVE1 = '/12'
function SlashCmdList.TWELVE(msg, editbox)
print("TWELVE. That Unit is a " .. UnitIsPlayer("target"));
end