Quantcast Force COD - ESOUI
Thread Tools Display Modes
08/20/18, 03:15 AM   #1
ESOARMY
 
ESOARMY's Avatar
Join Date: Nov 2016
Posts: 10
Force COD

hey there lua masters, if i put this

QueueCOD(20)

above this
SendMail(currConfig.To,currConfig.Subject,"Thank you!")
d("|c99FF99AAL:|cFFFFFF Sending 1 mail to "..currConfig.To..", containing 6 CLOTH items")
numSlot = 1
zo_callLater(function() BG_OIK:SendMails() end, self.db.delay)

if it will add a 20g cod to the in game mail being sent?
or am I using this the wrong way?
  Reply With Quote
08/20/18, 04:50 AM   #2
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 1,800
According to this filename here:
https://github.com/esoui/esoui/blob/...d_keyboard.lua

You need to set the sendMoneyMode to false (true = send money / false = COD)
-> See function ZO_MailSend_SetCoDMode at the bottom of this post.
and then you could use the function MailSend:AttachMoney to specify which amount of COD to use.

See functions below which should help:

Lua Code:
  1. function MailSend:SetSendMoneyMode(sendMoneyMode)
  2.     if self.sendMoneyMode ~= sendMoneyMode then
  3.         self.sendMoneyMode = sendMoneyMode
  4.         ZO_DefaultCurrencyInputField_SetCurrencyAmount(self.sendCurrency, 0)
  5.         ZO_DefaultCurrencyInputField_SetUsePlayerCurrencyAsMax(self.sendCurrency, sendMoneyMode)
  6.         if(sendMoneyMode) then
  7.             QueueMoneyAttachment(ZO_DefaultCurrencyInputField_GetCurrency(self.sendCurrency))
  8.         else
  9.             QueueCOD(ZO_DefaultCurrencyInputField_GetCurrency(self.sendCurrency))
  10.         end
  11.         self:UpdatePostageMoney()
  12.     end
  13. end
  14.  
  15. function MailSend:AttachMoney(moneyInput, money)
  16.     if self.sendMoneyMode then
  17.         QueueMoneyAttachment(money)
  18.     else
  19.         QueueCOD(money)
  20.     end
  21. end

But "MailSend" ist not the global variable used ingame so you are not able to use this. It's the "class" and you need to use the created "object" of that class to use the functions.
If you check the code where MailSend gets created via :New or :Initialize you'll get the object name.
It should be:
MAIL_SEND

And these functions may be helping as well:

Lua Code:
  1. function ZO_MailSend_SetCoDMode()
  2.     MAIL_SEND:SetCoDMode()
  3. end


BUT: As there were addons messing around with the send gold feature it might be not possible for addons to specify to send gold or set the COD from addon code. You need to check it. Sending gold will not be possible for sure!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Force COD

Thread Tools
Display Modes

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