-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweapons.lua
123 lines (78 loc) · 2.38 KB
/
weapons.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
-- translations
Translations = translations( "weapons" )
-- templates
weaponNameURL = loadTemplate( "weapons/weaponNameURL" )
weaponName = loadTemplate( "weapons/weaponName" )
itemCounts = loadTemplate( "itemCounts" )
itemNameURL = loadTemplate( "itemNameURL" )
local SharpMults = { 0.5, 0.75, 1, 1.05, 1.2, 1.32 }
local function sharpMult( weapon )
if not weapon.sharpness then
return 1
end
return SharpMults[ table.getn( weapon.sharpness ) ]
end
function getTATP( weapon )
return math.round( weapon.attack * ( 1 + 0.0025 * weapon.affinity ) * sharpMult( weapon ) )
end
local function weaponFromName( class, name )
for _, weapon in ipairs( class.weapons ) do
-- convert every weapon name to a url and not the other
-- way around because converting to a url is destructive
if urlFromName( weapon.name ) == name then
return weapon
end
end
return nil
end
local state = "nothing"
if Get.class then
local class = weaponClassFromShort( Get.class )
if class then
sharpness = loadTemplate( "weapons/sharpness" )
state = "class"
if Get.name then
local weapon = weaponFromName( class, Get.name )
if weapon then
local info = loadTemplate( "weapons/info" )
header( T( weapon.name ) )
print( info( { class = class, weapon = weapon } ) )
state = "weapon"
end
end
if state == "class" then
header( T( class.name ) )
local weaponTree = loadTemplate( "weapons/tree" )
print( weaponTree( { class = class } ) )
end
else
class = gunClassFromShort( Get.class )
if class then
state = "class"
if Get.name then
local weapon = weaponFromName( class, Get.name )
if weapon then
local info = loadTemplate( "weapons/info" )
header( T( weapon.name ) )
print( info( { class = class, weapon = weapon } ) )
state = "weapon"
end
end
if state == "class" then
local weaponTree = loadTemplate( "weapons/tree" )
header( T( class.name ) )
print( weaponTree( { class = class } ) )
end
end
end
end
if state == "nothing" then
grid = loadTemplate( "equipGrid" )
gridCell = loadTemplate( "equipGridCell" )
header( "Weapons" )
print( "<h1>Real weapons</h1>" )
print( grid( { classes = Weapons, class = "weapons", page = "weapons", cols = 3 } ) )
print( "<h1>Sissy weapons</h1>" ) -- :)
print( grid( { classes = Guns, class = "weapons", page = "weapons", cols = 3 } ) )
end
footer()