<CustomBehavior File="RunCode" Type="Definition">
<![CDATA[
string getMail = @"
local numItems,totalItems = GetInboxNumItems()
for index=numItems,1,-1 do
local _,_,sender,subj,gold,cod,_,itemCnt,_,_,hasText,canReply,IsGM=GetInboxHeaderInfo(index)
if sender ~= nil and cod == 0 and itemCnt == nil and gold == 0 then
DeleteInboxItem(index)
end
if cod == 0 and ((itemCnt and itemCnt >0) or (gold and gold > 0)) then
for i=1,ATTACHMENTS_MAX_RECEIVE do
if gold and gold >0 then
TakeInboxMoney(index)
end
if GetInboxItem(index, i) ~=nil then
TakeInboxItem(index, i)
end
end
end
end";
]]>
</CustomBehavior>
------------------------------------------
<CustomBehavior File="RunCode"><![CDATA[
Logging.Write(System.Windows.Media.Colors.Yellow, "[PROFILE]: Going to mailbox location..");
var mailboxPOI = ObjectManager.GetObjectsOfType<WoWGameObject>().FirstOrDefault(x => x.SubType == WoWGameObjectType.Mailbox);
while (mailboxPOI != null && !MailFrame.Instance.IsVisible) {
if (Me.Location.Distance(mailboxPOI.Location) > 5) {
Flightor.MoveTo(mailboxPOI.Location);
}
else {
await CommonCoroutines.StopMoving();
mailboxPOI.Interact();
await Coroutine.Wait(2000, () => MailFrame.Instance.IsVisible);
}
await Coroutine.Yield();
}
]]>
</CustomBehavior>
------------------------------------------
<While Condition="MailFrame.Instance.HasNewMail || MailFrame.Instance.MailCount > 0" >
<CustomBehavior File="RunCode" Code="Lua.DoString(getMail); StyxWoW.SleepForLagDuration();"/>
</While>