diff --git a/addons/organizer/items.lua b/addons/organizer/items.lua index 3a1afea58..126cde3f4 100644 --- a/addons/organizer/items.lua +++ b/addons/organizer/items.lua @@ -29,14 +29,28 @@ local items = {} local bags = {} local item_tab = {} -local nomad_moogle -local clear_moogles do local names = {'Nomad Moogle', 'Pilgrim Moogle'} local moogles = {} + local poked = false + local block_menu = false clear_moogles = function() moogles = {} + poked = false + end + + local poke_moogle = function(npc) + local p = packets.new('outgoing', 0x1a, { + ["Target"] = npc.id, + ["Target Index"] = npc.index, + }) + poked = true + block_menu = true + packets.inject(p) + repeat + coroutine.sleep(0.4) + until not block_menu end nomad_moogle = function() @@ -53,11 +67,21 @@ do for _, moo_index in ipairs(moogles) do local moo = windower.ffxi.get_mob_by_index(moo_index) if moo and (moo.x - player.x)^2 + (moo.y - player.y)^2 < 36 then - return true + if not poked then + poke_moogle(moo) + end + return moo.name end end return false end + + windower.register_event('incoming chunk',function(id) + if id == 0x02E and block_menu then + block_menu = false + return true + end + end) end windower.register_event('zone change',function() diff --git a/addons/organizer/organizer.lua b/addons/organizer/organizer.lua index 9abb43f04..56e67826f 100644 --- a/addons/organizer/organizer.lua +++ b/addons/organizer/organizer.lua @@ -24,17 +24,18 @@ --(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -res = require 'resources' -files = require 'files' -require 'pack' -Items = require 'items' -extdata = require 'extdata' -logger = require 'logger' -require 'tables' -require 'lists' -require 'functions' -config = require 'config' -slips = require 'slips' +res = require('resources') +files = require('files') +require('pack') +Items = require('items') +extdata = require('extdata') +logger = require('logger') +require('tables') +require('lists') +require('functions') +config = require('config') +slips = require('slips') +packets = require('packets') _addon.name = 'Organizer' _addon.author = 'Byrth, maintainer: Rooks' @@ -243,6 +244,11 @@ windower.register_event('addon command',function(...) return end + local moogle = nomad_moogle() + if moogle then + org_debug("command", "Using '" .. moogle .. "' for Mog House interaction") + end + local bag = 'all' if inp[1] and (_static.bag_ids[inp[1]:lower()] or inp[1]:lower() == 'all') then bag = table.remove(inp,1):lower() @@ -299,6 +305,11 @@ windower.register_event('addon command',function(...) windower.send_command('input /heal') end + if moogle then + clear_moogle() + org_debug("command", "Clearing '" .. moogle .. "' status") + end + org_debug("command", "Organizer complete") end)