-
Notifications
You must be signed in to change notification settings - Fork 4
/
dismantlemgr.lua
51 lines (40 loc) · 1.02 KB
/
dismantlemgr.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
_fmt = string.format
class 'CDismantleMgr'
function CDismantleMgr:__init(app)
self.app = app
self.font = app.DirectX:CreateFont(20, 15, 700, false, "Arial")
self.enabled = false
self.time_last = 0
self.interval = 2000
print("CDismantleMgr") --debug
end
function CDismantleMgr:GetClientTime()
return self.app.Game:GetMainSystem():GetClientTime()
end
function CDismantleMgr:Dismantle()
if not self.enabled then
return
end
local interval = self:GetClientTime() - self.time_last
if interval < self.interval then
return
end
self.app.Game:DismantleItems(0,36)
self.time_last = self:GetClientTime()
end
function CDismantleMgr:OnUpdate()
local status = "OFF"
local color = clRed
if self.enabled then
status = "ON"
color = clGreen
end
self.font:Draw(340,100,0,0, color, string.format("Dismantling system %s", status))
end
function CDismantleMgr:WindowProc(msg)
if msg.message == WM_KEYUP then
if msg.wParam == VK_F3 then
self.enabled = not self.enabled
end
end
end