-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRandoMount.lua
More file actions
76 lines (45 loc) · 1.55 KB
/
Copy pathRandoMount.lua
File metadata and controls
76 lines (45 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--RandoMount by Harissa and Hammoncheese!
--June 1, 2022
_addon.name = 'RandoMount'
_addon.author = 'Harissa'
_addon.version = '1.3'
_addon.commands = {'RandoMount', 'rmount'}
resources = require('resources') -- a bunch of item info that windower holds
function initialize_myMounts()
math.randomseed(os.time())
end
function mountUp()
send_to_chat(randomize())
end
function send_to_chat(chosen_Mount)
windower.chat.input('/mount "'..chosen_Mount..'"')
end
function randomize()
local myMounts_list = populate_myMounts()
return myMounts_list[math.random(1, table.getn(myMounts_list))]
end
function populate_myMounts()
local myMounts = {}
key_items = windower.ffxi.get_key_items() -- player's current key items
for _, id in ipairs(key_items) do
local key_itemID = resources.key_items[id]
if key_itemID ~= nil then
if key_itemID.category == 'Mounts' then
if key_itemID.name ~="trainer's whistle" then
table.insert( myMounts, format_Mount(key_itemID.name))
--windower.chat.input("/echo "..format_Mount(key_itemID.name))
end
end
end
end
return myMounts
end
function format_Mount(name)
local s, _ = string.gsub(name, ' companion', '')
s, _ = string.gsub(s, ' whistle', '')
s, _ = string.gsub(s, ' key', '')
s, _ = string.gsub(s, '♪', '')
return s
end
initialize_myMounts()
windower.register_event('addon command', mountUp)