So there I was last week knee deep in White Gold Tower and I get a message from one of the Generals.. "bidding closes in 15 minutes, please pay your dues to stay in the guild" and boom! The idea for a new addon was born. "Guild Dues" puts a small icon, keybind or slash command to quickly create and send your dues to the guild master. The only problem is, it doesn't work. I am not that great with lua and tried to piece this together from examples throughout the week. It feels like I am close but it keeps giving me errors. I think if I can get a simple working version I will be able to expand with menus for all the variables such as dues, minimum gold to keep, guild master name, subject text, body text and maybe more. It is very simple at the moment and not working of course. This is my first addon so any help would be appreciated and name in the credits. Here is what I have so far. Please forgive me for being such a noob if the solution is extremely apparent. Thanks
Lua Code:
GuildDues = {}
GuildDues.name = "GuildDues"
function GuildDues:Initialize()
self.MyGold = GetCurrentMoney()
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_MONEY_UPDATE, self.OnPlayerMoneyUpdate)
self.savedVariables = ZO_SavedVars:New("GuildDuesSavedVariables", 1, nil, {})
self:RestorePosition()
end
local function createDonationButton(owningWindow)
local button = WINDOW_MANAGER:CreateControl(owningWindow:GetName().."GuildDues", owningWindow, CT_BUTTON)
local b = button
b:SetDimensions(34, 34)
b:SetNormalTexture("ESOUI/art/chatwindow/chat_mail_up.dds")
b:SetMouseOverTexture("ESOUI/art/chatwindow/chat_mail_over.dds")
b:SetHandler("OnClicked",function()PayDues(b) end)
b:SetAnchor(BOTTOMLEFT,owningWindow, BOTTOMLEFT,5,5)
return button
end
function GuildDues.OnAddOnLoaded(event, addonName)
if addonName == GuildDues.name then
GuildDues:Initialize()
end
end
local function PayDues(self)
local r = "@GuildLeader"
local s = "Here are my Guild Dues"
local p = self.MyGold
if p < 5000 then
d("Weekly dues are 5k, you do not have enough." )
end
if p < 10000 then
d("We insist you keep more than half of what you owe." )
end
else
p = p - p + 5000
SCENE_MANAGER:Show('mailSend')
zo_callLater(function()
ZO_MailSendToField:SetText(r)
ZO_MailSendSubjectField:SetText(s)
QueueMoneyAttachment(p)
ZO_MailSendBodyField:TakeFocus() end, 200)
end
end
SLASH_COMMANDS["/pay"] = PayDues
ZO_CreateStringId("SI_BINDING_NAME_PAY_DUES", "Pay Dues")
EVENT_MANAGER:RegisterForEvent(GuildDues.name, EVENT_ADD_ON_LOADED, GuildDues.OnAddOnLoaded)