2025/11/17 記事をまとめてブログ全体を整理しました。

Windowerアドオン:Itemizerを日本語環境で使う方法

カバンのアイテム整理はmogmasterを使っている人が多いと思いますが、Itemizerもかなり便利です。

ただし、このアドオンは日本語環境では動作しないので、とりあえず動くように改造しました。

このアイテムの何が便利かって、マイバッグにアイテムがなくても忍術も薬品もマクロから使う場合は自動的に引っ張り出してきて使ってくれることです。

ただし、トランスレート文字(【こんにちは】)を使ったマクロには対応しておらず、べた書きのマクロしか動きません。

※トランスレート文字の削除処理をすれば良いのですが、難しくて現段階ではできなかった。

_addon.name = 'Itemizer'
_addon.author = 'Ihina'
_addon.version = '3.2.0.0'
_addon.command = 'itemizer'

require('luau')
local packets = require('packets')

defaults = {}
defaults.AutoNinjaTools = true
defaults.AutoItems = true
defaults.AutoStack = true
defaults.Delay = 0.5
defaults.version                       = _addon.version
defaults.UseUniversalTools = {}

defaults.UseUniversalTools.Katon       = false
defaults.UseUniversalTools.Hyoton      = false
defaults.UseUniversalTools.Huton       = false
defaults.UseUniversalTools.Doton       = false
defaults.UseUniversalTools.Raiton      = false
defaults.UseUniversalTools.Suiton      = false
defaults.UseUniversalTools.Utsusemi    = false
defaults.UseUniversalTools.Jubaku      = false
defaults.UseUniversalTools.Hojo        = false
defaults.UseUniversalTools.Kurayami    = false
defaults.UseUniversalTools.Dokumori    = false
defaults.UseUniversalTools.Tonko       = false
defaults.UseUniversalTools.Monomi      = false
defaults.UseUniversalTools.Aisha       = false
defaults.UseUniversalTools.Yurin       = false
defaults.UseUniversalTools.Myoshu      = false
defaults.UseUniversalTools.Migawari    = false
defaults.UseUniversalTools.Kakka       = false
defaults.UseUniversalTools.Gekka       = false
defaults.UseUniversalTools.Yain        = false

settings = config.load(defaults)
bag_ids = res.bags:key_map(string.gsub-{' ', ''} .. string.lower .. table.get-{'english'} .. table.get+{res.bags}):map(table.get-{'id'})
-- Remove temporary bag, because items cannot be moved from/to there, as such it's irrelevant to Itemizer
bag_ids.temporary = nil

--Added this function for first load on new version. Because of the newly added features that weren't there before.
windower.register_event("load", "login", function()
    if not windower.ffxi.get_info().logged_in then
        return
    end

    local _, _, saved   = settings.version:find("(%d+%.%d+%.)")
    local _, _, current = _addon.version:find("(%d+%.%d+%.)")
    if saved ~= current then
        log("Itemizer v%s: New features added. (use //itemizer help to find out about them)":format(_addon.version))
        settings.version = _addon.version
        settings:save()
    end
end)

find_items = function(ids, bag, limit)
    local res = S{}
    local found = 0

    for bag_index, bag_name in bag_ids:filter(table.get-{'enabled'} .. windower.ffxi.get_bag_info):it() do
        if not bag or bag_index == bag then
            for _, item in ipairs(windower.ffxi.get_items(bag_index)) do
                if ids:contains(item.id) then
                    local count = limit and math.min(limit, item.count) or item.count
                    found = found + count

                    res:add({
                        bag = bag_index,
                        slot = item.slot,
                        count = count,
                        id = item.id,
                    })

                    if limit then
                        limit = limit - count

                        if limit == 0 then
                            return res, found
                        end
                    end
                end
            end
        end
    end

    return res, found
end

windower.register_event("addon command", function(command, arg2, ...)
    if command == 'help' then
        local helptext = [[Itemizer - Usage:
    //get <item> [bag] [count] -- //gets <item> [bag] - Retrieves the specified item from the specified bag to inventory.
    //put <item> <bag> [count] -- //puts <item> <bag> - Places the specified item into the specified bag from inventory.
    //move <item> [source] <destination> [count] -- //moves <item> [from] <to> - Moves the specified item from one bag to another. Source bag is optional.
    //stack -- Stacks all stackable items in all currently available bags
        Command List:
  1. Delay <delay> - Sets the time delay.
  2. AutoNinjaTools - Toggles automatically getting ninja tools (Shortened ant)
  3. AutoItems - Toggles automatically getting items from bags (shortened ai)
  4. UseUniversalTool <spell> - Toggles using universal ninja tools for <spell> (shortened uut)
     i.e. uut katon  - will toggle katon either true or false depending on your setting
     all defaulted false.
  5. AutoStack - Toggles utomatically stacking items in the destination bag (shortened as, defaults true)
  6. Help - Shows this menu.]]
        for _, line in ipairs(helptext:split('\n')) do
            log(line)
        end
    elseif command:lower() == "delay" and arg2 ~= nil then
        if type(arg2) == 'number' then
            settings.delay = arg2
            settings:save()
            log('Delay is now %s.':format(settings.delay))
        else
            error('The delay must be a number')
        end
    elseif T{'autoninjatools','ant'}:contains(command:lower()) then
        settings.AutoNinjaTools = not settings.AutoNinjaTools
        settings:save()
        log('AutoNinjaTools is now', settings.AutoNinjaTools)
    elseif T{'autoitems','ai'}:contains(command:lower()) then
        settings.AutoItems = not settings.AutoItems
        settings:save()
        log('AutoItems is now', settings.AutoItems)
    elseif T{'useuniversaltool','uut'}:contains(command:lower()) then
        local arg = arg2:ucfirst()
        if settings.UseUniversalTools[arg] ~= nil then
            settings.UseUniversalTools[arg] = not settings.UseUniversalTools[arg]
            settings:save()
            log('UseUniversalTools for %s spells is now':format(arg), settings.UseUniversalTools[arg])
        else
            error('Argument 2 must be a ninjutsu spell (sans :ichi or :ni) i.e. uut katon')
        end
    elseif T{'autostack','as'}:contains(command:lower()) then
        settings.AutoStack = not settings.AutoStack
        log('AutoStack is now', settings.AutoStack)
        settings:save()
    end
end)

local handled_commands = S{ 'get', 'gets', 'put', 'puts', 'move', 'moves' }

local function validate_bag(bag_name, purpose)
    local bag_id = rawget(bag_ids, bag_name)
    if not bag_id then
        error(('Specify a valid %s bag.'):format(purpose))
        return nil
    end
    if not windower.ffxi.get_bag_info(bag_id).enabled then
        error('%s currently not enabled':format(res.bags[bag_id].name))
        return nil
    end
    return bag_id
end

windower.register_event('unhandled command', function(command, ...)
   -- local args = L{...}:map(string.lower)
    local args = L{...}
    for i, elm in ipairs(args) do
        args[i] = windower.from_shift_jis(elm)
    end
    if handled_commands:contains(command) then
        local count
        if command:endswith('s') then
            command = command:sub(1, -2)
        else
            local last = args[#args]
            if last == 'all' then
                args:remove()
            elseif not last:find('[^0-9]') then
                count = tonumber(last)
                args:remove()
            else
                count = 1
            end
        end

        if command == 'get' then
            args:append('inventory')
        end

        local destination_bag = validate_bag(windower.to_shift_jis(args[#args]), 'destination')
        if not destination_bag then
            return
        end

        args:remove()

        if command == 'put' then
            args:append('inventory')
        end

        local source_bag
        local specified_bag = rawget(bag_ids, args[#args])
        if specified_bag then
            source_bag = validate_bag(windower.to_shift_jis(args[#args]), 'source')
            if not source_bag then
                return
            end

            args:remove()
        end

        local destination_bag_info = windower.ffxi.get_bag_info(destination_bag)
        if destination_bag_info.max - destination_bag_info.count == 0 then
            error('Not enough space in %s to move items.':format(res.bags[destination_bag].name))
            return
        end

        local item_name = args:concat(' ')

        local item_ids = (S(res.items:name(windower.wc_match-{item_name})) + S(res.items:name_log(windower.wc_match-{item_name}))):map(table.get-{'id'})
        if item_ids:length() == 0 then
            error('Unknown item: %s':format(item_name))
            return
        end

        local matches, results = find_items(item_ids, source_bag, count)
        if results == 0 then
            error('Item "%s" not found in %s.':format(item_name, source_bag and res.bags[source_bag].name or 'any accessible bags'))
            return
        end

        if count and results < count then
            warning('Only %u "%s" found in %s.':format(results, item_name, source_bag and res.bags[source_bag].name or 'all accessible bags'))
        end

        for match in matches:it() do
            windower.ffxi.move_item(match.bag, destination_bag, match.slot, match.count)

            if settings.AutoStack and command ~= 'get' and match.count < res.items[match.id].stack then
                windower.ffxi.stack_items(destination_bag)
            end
        end

    elseif command == 'stack' then
        log('Stacking items in all currently accessible bags.')

        for bag_index in bag_ids:filter(table.get-{'enabled'} .. windower.ffxi.get_bag_info):it() do
            windower.ffxi.stack_items(bag_index)
        end
    end
end)

ninjutsu = res.spells:type('Ninjutsu')
patterns = L{'"(.+)"', '\'(.+)\'', '.- (.+) .-', '.- (.+)'}
spec_tools = T{
    Katon       = 1161,
    Hyoton      = 1164,
    Huton       = 1167,
    Doton       = 1170,
    Raiton      = 1173,
    Suiton      = 1176,
    Utsusemi    = 1179,
    Jubaku      = 1182,
    Hojo        = 1185,
    Kurayami    = 1188,
    Dokumori    = 1191,
    Tonko       = 1194,
    Monomi      = 2553,
    Aisha       = 2555,
    Yurin       = 2643,
    Myoshu      = 2642,
    Migawari    = 2970,
    Kakka       = 2644,
    Gekka       = 8803,
    Yain        = 8804
}
gen_tools = T{
    Katon       = 2971,
    Hyoton      = 2971,
    Huton       = 2971,
    Doton       = 2971,
    Raiton      = 2971,
    Suiton      = 2971,
    Utsusemi    = 2972,
    Jubaku      = 2973,
    Hojo        = 2973,
    Kurayami    = 2973,
    Dokumori    = 2973,
    Tonko       = 2972,
    Monomi      = 2972,
    Aisha       = 2973,
    Yurin       = 2973,
    Myoshu      = 2972,
    Migawari    = 2972,
    Kakka       = 2972,
    Gekka       = 2972,
    Yain        = 2972
}

active = S{}

-- Returning true resends the command in settings.Delay seconds
-- Returning false doesn't resend the command and executes it
collect_item = function(id, items)
    items = items or {inventory = windower.ffxi.get_items(bag_ids.inventory)}

    local item = T(items.inventory):with('id', id)
    if item then
        active = active:remove(id)
        return false
    end

    -- Current ID already being processed?
    if active:contains(id) then
        return true
    end

    -- Check for all items
    local match = find_items(S{id}, nil, 1):it()()

    if match then
        windower.ffxi.get_item(match.bag, match.slot, match.count)

        -- Add currently processing ID to set of active IDs
        active:add(id)
    else
        error('Item "%s" not found in any accessible bags':format(res.items[id].name))
    end

    return match ~= nil
end

reschedule = function(text, ids, items)
    if not items then
        local info = windower.ffxi.get_bag_info(bag_ids.inventory)
        items = {inventory = windower.ffxi.get_items(bag_ids.inventory)}
        items.max_inventory = info.max
        items.count_inventory = info.count
    end

    -- Inventory full?
    if items.max_inventory - items.count_inventory == 0 then
        return false
    end

    for id in L(ids):it() do
        if collect_item(id, items) then
            text = windower.to_shift_jis(text)
            windower.send_command:prepare('input '..text):schedule(settings.Delay)
            return true
        end
    end
end

windower.register_event('outgoing text', function()
    local item_names = T{}

    return function(text)
        text = windower.from_shift_jis(text)
        -- Ninjutsu
        if settings.AutoNinjaTools and (text:startswith('/ma ') or text:startswith('/nin ') or text:startswith('/magic ') or text:startswith('/ninjutsu ')) then
            for pattern in patterns:it() do
                
                local match = text:match(pattern)
                if match then
                    if ninjutsu:with('ja', string.imatch-{match}) then
                        match=res.spells:with('ja',match).en
                        name = match:lower():capitalize():match('%w+')
                        break
                    end
                end
            end
            if name then
                if settings.UseUniversalTools[name] == false or windower.ffxi.get_player().main_job ~= 'NIN' then
                    return reschedule(text, {spec_tools[name], windower.ffxi.get_player().main_job == 'NIN' and gen_tools[name] or nil})
                else
                    return reschedule(text, {windower.ffxi.get_player().main_job == 'NIN' and gen_tools[name] or nil})
                end
            end

        -- Item usage
        elseif settings.AutoItems and text:startswith('/item ') then
            local items = windower.ffxi.get_items()
            local inventory_items = S{}
            local wardrobe_items = S{}
            for bag in bag_ids:keyset():it() do
                for _, item in ipairs(items[bag]) do
                    if item.id > 0 and not item_names[item.id] then
                        item_names[item.id] = res.items[item.id].name
                    end

                    if bag == 'inventory' then
                        inventory_items:add(item.id)
                    elseif S{'wardrobe','wardrobe2','wardrobe3','wardrobe4','wardrobe5','wardrobe6','wardrobe7','wardrobe8'}:contains(bag) then
                        wardrobe_items:add(item.id)
                    end
                end
            end

            local parsed_text = item_count and text:match(' (.+) (%d+)$') or text:match(' (.+)')
            local mid_name = parsed_text:match('"(.+)"') or parsed_text:match('\'(.+)\'') or parsed_text:match('(.+) ')
            local full_name = parsed_text:match('(.+)')
            local id = item_names:find(string.imatch-{mid_name}) or item_names:find(string.imatch-{full_name})
            if id then
                if not inventory_items:contains(id) and not wardrobe_items:contains(id) then
                    return reschedule(text, {id}, items)
                else
                    active:remove(id)
                end
            end

        end
    end
end())

--[[
Copyright © 2013-2015, Ihina
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of Silence nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL IHINA BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
--Original plugin by Aureus

コメント

コメント一覧 (23件)

  • いろいろやって、行き違いがあったりしたのですが、WindowerのDiscordでサポートを受けたバージョン3.3.1.0が上手く動きました。こちらはアイテム名もバッグ名も日本語が通ります。ご参考まで。

    • 有益な情報ありがとうございます。
      公式ので日本語が使えれば便利ですね!

    • 日本語で使えないって感じですよね?
      Itemizer今使ってないので、使い方忘れていて思い出すのに時間がかかることと、明日の夜まで時間が取れないのでちょっと時間が掛かりそうです

    • あと、使い方の話ですが、私の場合
      モグサックに紙兵を入れた状態で普通にマクロから空蝉の術を詠唱するだけで自動的に取得して詠唱できていました。
      なので、putとか使っていません。

      この点を踏まえて森の腐葉土をどうやって使うのか分かりませんが、モグガーデンでトレード?だったら /item 森の腐葉土  とかでいけませんかね?
      私のコードだとできるかもしれませんので、一度試してみてください

      • これはたまたま手元にあったアイテムで実行したものです。
        本当にしたい事は、
        指定生産品の納品でアイテムが大量だった時に
        (1)Sparksでエミネンス担当から装備を分割調達
        (2)itemizerで一部を空きストレージに退避
        (3)TradeNPCで何度かに分けて納品
        です。

        • とりあえず修正し、簡単な動作確認を行いました。
          カバン名を日本語にしたかったのですが、簡単にできなさそうでしたので、英語表記でなら使えます。

          //get ハイエリクサー
          //put ハイエリクサー case

          • ありがとうございます。
            ちゃんと動作しました。
            うまくいってない、WindowerのDiscordサポートの方にも報告しときます。

  • 改めて投稿します(5/5)その4
    ※これもだめだったので分割

    //put 森の腐葉土 safe 12
    07:28:13Itemizer Error: Specify a valid destination bag.

    //put 森の腐葉土 safe
    07:28:55Itemizer Error: Specify a valid destination bag.

  • 改めて投稿します(5/5)その3
    ※これもだめだったので分割

    //get 森の腐葉土
    07:27:33Itemizer Error: Unknown item: 森の腐葉土
    07:27:33Itemizer Error:

  • 改めて投稿します(5/5)その2
    ※これもだめだったので分割

    //get 森の腐葉土 safe
    07:26:59Itemizer Error: Unknown item: 森の腐葉土 safe
    07:26:59Itemizer Error:

  • 改めて投稿します(5/5)その1
    ※これもだめだったので分割

    ■「JPアイテム名、ENストレージ名でJP修正版を使用してみてください」でトライした結果

    //get 森の腐葉土 safe 12
    07:26:07Itemizer Error: Unknown item: 森の腐葉土 safe 12
    07:26:07Itemizer Error:

  • 改めて投稿します(4/5)

    ■この改造版で試した結果(英語のアイテム名・ストレージ名で)

    //get Grove Humus safe 12
    22:44:28Itemizer Error: Unknown item: grove humus

    //get Grove Humus safe
    22:45:57Itemizer Error: Unknown item: grove humus safe
    22:45:57Itemizer Error:

    //get Grove Humus
    22:47:03Itemizer Error: Unknown item: grove humus
    22:47:03Itemizer Error:

    //put Grove Humus safe
    22:49:02Itemizer Error: Unknown item: grove humus

    //put Grove Humus safe 12
    22:49:56Itemizer Error: Specify a valid destination bag.

  • 改めて投稿します(3/5)その2
    ※これもだめだったので分割

    //get 森の腐葉土
    02:08:40Itemizer Error: Unknown item: ?x????t?y
    02:08:40Itemizer Error:

    //put 森の腐葉土 モグ金庫 12
    02:09:37Itemizer Error: Specify a valid destination bag.

    //put 森の腐葉土 モグ金庫
    02:10:40Itemizer Error: Specify a valid destination bag.

  • 改めて投稿します(3/5)その1
    ※これもだめだったので分割

    ■オリジナル改造版で試した結果(日本語のアイテム名・ストレージ名で)

    //get 森の腐葉土 モグ金庫 12
    02:06:15Itemizer Error: Unknown item: ?x????t?y ???o??? 12
    02:06:15Itemizer Error:

    //get 森の腐葉土 モグ金庫
    02:07:31Itemizer Error: Unknown item: ?x????t?y ???o???
    02:07:31Itemizer Error:

  • 改めて投稿します(1/5)その2
    ※1000文字以下にしたつもりですが、だめだったので分割

    //get 森の腐葉土
    02:02:02Itemizer Error: Unknown item: ?x????t?y
    02:02:02Itemizer Error:

    //put 森の腐葉土 モグ金庫 12
    02:02:59Itemizer Error: Specify a valid destination bag.

    //put 森の腐葉土 モグ金庫
    02:04:08Itemizer Error: Specify a valid destination bag.

  • 改めて投稿します(1/5)その1
    ※1000文字以下にしたつもりですが、だめだったので分割

    今、WindowerのDiscordの方でもサポートを受けてるんですが
    上手くいってません。

    ★★以下、最初に投稿した内容

    まずは単純にgetとputを使いたいのですが、うまくきません。
    ご教示ください。

    ■この改造版で試した結果

    //get 森の腐葉土 モグ金庫 12
    01:59:01Itemizer Error: Unknown item: ?x????t?y ???o??? 12
    01:59:01Itemizer Error:

    //get 森の腐葉土 モグ金庫
    02:00:56Itemizer Error: Unknown item: ?x????t?y ???o???
    02:00:56Itemizer Error:

  • 改めて投稿します(2/5)

    ※以下、Windower公式Discordでサポートを受けて試した結果

    ■オリジナル改造版で試した結果(英語のアイテム名・ストレージ名で)

    //get Grove Humus safe 12
    02:11:29Itemizer Error: Unknown item: grove humus safe 12
    02:11:29Itemizer Error:

    //get Grove Humus safe
    02:12:58Itemizer Error: Unknown item: grove humus safe
    02:12:58Itemizer Error:

    //get Grove Humus
    02:13:57Itemizer Error: Unknown item: grove humus
    02:13:57Itemizer Error:

    //put Grove Humus safe 12
    02:15:00Itemizer Error: Specify a valid destination bag.

    //put Grove Humus safe
    02:15:00Itemizer Error: Specify a valid destination bag.
    02:15:53Itemizer Error: Specify a valid destination bag.

  • お昼ごろに再投稿したのですが、反映されないようです。長文だとだめなんでしょうか

  • コメントに質問を書き込んだのですが、反映されていないみたいです。どうしたらいいんでしょうか

    • 当ブログのコメントは、迷惑系コメント防止のため管理人の承認制となっておりますため、初回コメントはリアルタイムで反映されません。
      また、書き込まれたコメントが届いておりませんので、再度書き込みをお願いします。

管理人 へ返信する コメントをキャンセル

目次