Thread Tools Display Modes
Prev Previous Post   Next Post Next
08/19/18, 07:04 PM   #1
ESOARMY
 
ESOARMY's Avatar
Join Date: Nov 2016
Posts: 10
Guild Dues

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:
  1. GuildDues = {}
  2.  
  3. GuildDues.name = "GuildDues"
  4.  
  5.  
  6. function GuildDues:Initialize()
  7.     self.MyGold = GetCurrentMoney()
  8.  
  9.     EVENT_MANAGER:RegisterForEvent(self.name, EVENT_MONEY_UPDATE, self.OnPlayerMoneyUpdate)
  10.     self.savedVariables = ZO_SavedVars:New("GuildDuesSavedVariables", 1, nil, {})
  11.     self:RestorePosition()
  12.    
  13. end
  14.  
  15. local function createDonationButton(owningWindow)
  16.     local button = WINDOW_MANAGER:CreateControl(owningWindow:GetName().."GuildDues", owningWindow, CT_BUTTON)
  17.     local b = button
  18.     b:SetDimensions(34, 34)
  19.     b:SetNormalTexture("ESOUI/art/chatwindow/chat_mail_up.dds")
  20.     b:SetMouseOverTexture("ESOUI/art/chatwindow/chat_mail_over.dds")
  21.     b:SetHandler("OnClicked",function()PayDues(b) end)
  22.     b:SetAnchor(BOTTOMLEFT,owningWindow, BOTTOMLEFT,5,5)
  23.     return button
  24. end
  25.  
  26.  
  27. function GuildDues.OnAddOnLoaded(event, addonName)
  28.   if addonName == GuildDues.name then
  29.     GuildDues:Initialize()
  30.   end
  31. end
  32.  
  33.  
  34. local function PayDues(self)
  35.     local r = "@GuildLeader"
  36.     local s = "Here are my Guild Dues"
  37.     local p = self.MyGold
  38.  
  39.    
  40.     if p < 5000 then
  41.      d("Weekly dues are 5k, you do not have enough." )
  42.     end
  43.    
  44.     if p < 10000 then
  45.     d("We insist you keep more than half of what you owe." )
  46.     end  
  47.    
  48.     else
  49.         p = p - p + 5000
  50.         SCENE_MANAGER:Show('mailSend')
  51.         zo_callLater(function()
  52.             ZO_MailSendToField:SetText(r)
  53.             ZO_MailSendSubjectField:SetText(s)
  54.             QueueMoneyAttachment(p)
  55.             ZO_MailSendBodyField:TakeFocus() end, 200)
  56.     end
  57. end
  58.  
  59. SLASH_COMMANDS["/pay"] = PayDues
  60. ZO_CreateStringId("SI_BINDING_NAME_PAY_DUES", "Pay Dues")
  61. EVENT_MANAGER:RegisterForEvent(GuildDues.name, EVENT_ADD_ON_LOADED, GuildDues.OnAddOnLoaded)
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Guild Dues


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off