Skip to content

Commit

Permalink
Add 2nd cmd param to specify dim item.
Browse files Browse the repository at this point in the history
  • Loading branch information
shastaxc committed Aug 11, 2021
1 parent aed7715 commit dcce6b2
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 63 deletions.
33 changes: 24 additions & 9 deletions addons/Dimmer/Dimmer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.]]

_addon.name = 'Dimmer'
_addon.author = 'Chiaia'
_addon.version = '1.1.1'
_addon.version = '1.1.2'
_addon.commands = {'dim','dimmer'}

require('logger')
Expand All @@ -37,13 +37,13 @@ log_flag = true

lang = string.lower(windower.ffxi.get_info().language)
item_info = {
[1]={id=26176,japanese='D.ホラリング',english='"Dim. Ring (Holla)"',slot=13},
[2]={id=26177,japanese='D.デムリング',english='"Dim. Ring (Dem)"',slot=13},
[3]={id=26178,japanese='D.メアリング',english='"Dim. Ring (Mea)"',slot=13},
[4]={id=10385,japanese="キュムラスマスク+1",english="Cumulus Masque +1",slot=4},
[1]={id=26176,japanese='D.ホラリング',english='"Dim. Ring (Holla)"',slot=13,short_name="holla"},
[2]={id=26177,japanese='D.デムリング',english='"Dim. Ring (Dem)"',slot=13,short_name="dem"},
[3]={id=26178,japanese='D.メアリング',english='"Dim. Ring (Mea)"',slot=13,short_name="mea"},
[4]={id=10385,japanese="キュムラスマスク+1",english="Cumulus Masque +1",slot=4,short_name="mask"},
}

function search_item()
function search_item(name)
if windower.ffxi.get_player().status > 1 then
log('You cannot use items at this time.')
return
Expand All @@ -53,17 +53,32 @@ function search_item()
local get_items = windower.ffxi.get_items
local set_equip = windower.ffxi.set_equip

-- Get list of all items player has
for bag_id in pairs(res_bags:equippable(true)) do
local bag = get_items(bag_id)
for _,item in ipairs(bag) do
if item.id > 0 then
if item.id > 0 then
item_array[item.id] = item
item_array[item.id].bag = bag_id
item_array[item.id].bag_enabled = bag.enabled
end
end
end
for index,stats in pairs(item_info) do

-- Narrow list of teleport options
local item_options = {}
if name then
for index,stats in pairs(item_info) do
if stats.short_name == name then
table.append(item_options, stats)
end
end
else
item_options = item_info
end

-- Go through each teleport option and attempt to use
for index,stats in pairs(item_options) do
local item = item_array[stats.id]
if item and item.bag_enabled then
local ext = extdata.decode(item)
Expand Down Expand Up @@ -104,7 +119,7 @@ windower.register_event('addon command',function(...)
windower.chat.input('//dimmer')
windower.send_ipc_message('dimmer')
else
search_item()
search_item(cmd)
end
end)

Expand Down
108 changes: 54 additions & 54 deletions addons/Stubborn/Stubborn.lua
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
--[[Copyright © 2021, Arico
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 Stubborn 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 Arico 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. --]]
_addon.name = 'Stubborn'
_addon.author = 'Arico'
_addon.version = '1'
_addon.commands = {'stubborn','cfh'}
require('logger')
packets = require('packets')
windower.register_event('outgoing chunk', function(id, original, modified, injected, blocked)
if id == 0x01A and not injected then
local p = packets.parse('outgoing', original)
if p['Category'] == 5 then
return true
end
end
end)
windower.register_event('addon command', function(...)
local target = windower.ffxi.get_mob_by_target('t')
if target and target.claim_id ~= 0 then
local p = packets.new('outgoing', 0x01A, {
['Target'] = target['id'],
['Target Index'] = target['index'],
['Category'] = 5,
})
packets.inject(p)
end
end)
--[[Copyright © 2021, Arico
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 Stubborn 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 Arico 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. --]]
_addon.name = 'Stubborn'
_addon.author = 'Arico'
_addon.version = '1'
_addon.commands = {'stubborn','cfh'}
require('logger')
packets = require('packets')
windower.register_event('outgoing chunk', function(id, original, modified, injected, blocked)
if id == 0x01A and not injected then
local p = packets.parse('outgoing', original)
if p['Category'] == 5 then
return true
end
end
end)
windower.register_event('addon command', function(...)
local target = windower.ffxi.get_mob_by_target('t')
if target and target.claim_id ~= 0 then
local p = packets.new('outgoing', 0x01A, {
['Target'] = target['id'],
['Target Index'] = target['index'],
['Category'] = 5,
})
packets.inject(p)
end
end)

0 comments on commit dcce6b2

Please sign in to comment.