forked from mikejsavage/MHP3DB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharmory.lua
109 lines (72 loc) · 2 KB
/
armory.lua
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
-- translations
--Translations = translations( "armory" )
-- templates
itemCounts = loadTemplate( "itemCounts" )
itemNameURL = loadTemplate( "itemNameURL" )
local function pieceFromName( class, name )
for _, piece in ipairs( class.pieces ) do
-- convert every piece name to a url and not the other
-- way around because converting to a url is destructive
if urlFromName( piece.name ) == name then
return piece
end
end
return nil
end
local function decorFromName( name )
for _, decor in ipairs( Decorations ) do
local urlName = urlFromName( decor.name ) .. "_" .. decor.slots
if urlName == name then
return decor
end
end
return nil
end
local state = "nothing"
if Get.class then
if Get.class == "jwl" then
if Get.name then
local decoration = decorFromName( Get.name )
if decoration then
local decorInfo = loadTemplate( "armory/decorInfo" )
header( T( decoration.name ) )
print( decorInfo( { decor = decoration } ) )
state = "decoration"
end
end
if state == "nothing" then
local decorList = loadTemplate( "armory/decorList" )
header( "Decorations" )
print( decorList() )
state = "decorations"
end
else
local class = armorClassFromShort( Get.class )
if class then
state = "class"
if Get.name then
local piece = pieceFromName( class, Get.name )
if piece then
local pieceInfo = loadTemplate( "armory/pieceInfo" )
header( T( piece.name ) )
print( pieceInfo( { class = class, piece = piece } ) )
state = "piece"
end
end
if state == "class" then
local armorList = loadTemplate( "armory/armorList" )
header( T( class.name ) )
print( armorList( { class = class } ) )
end
end
end
end
if state == "nothing" then
grid = loadTemplate( "equipGrid" )
gridCell = loadTemplate( "equipGridCell" )
gridDecor = loadTemplate( "armory/gridDecor" )
header( "Armory" )
print( grid( { classes = Armors, class = "armor", page = "armory", cols = 5 } ) )
print( gridDecor() )
end
footer()