-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRefreshContractsEvent.lua
More file actions
44 lines (33 loc) · 1.63 KB
/
Copy pathRefreshContractsEvent.lua
File metadata and controls
44 lines (33 loc) · 1.63 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
RefreshContractsEvent = {}
local RefreshContractsEvent_mt = Class(RefreshContractsEvent, Event)
RefreshContractsEvent.debug = false --true --
InitEventClass(RefreshContractsEvent, "RefreshContractsEvent")
function RefreshContractsEvent.emptyNew()
if RefreshContractsEvent.debug then print("RefreshContractsEvent:emptyNew") end
local self = Event.new(RefreshContractsEvent_mt)
return self
end
function RefreshContractsEvent.new()
if RefreshContractsEvent.debug then print("RefreshContractsEvent:new") end
local self = RefreshContractsEvent.emptyNew()
return self
end
function RefreshContractsEvent:writeStream(streamId, connection)
if RefreshContractsEvent.debug then print("RefreshContractsEvent:writeStream") end
-- NetworkUtil.writeNodeObject(streamId, self.mission)
end
function RefreshContractsEvent:readStream(streamId, connection)
if RefreshContractsEvent.debug then print("RefreshContractsEvent:readStream") end
self:run(connection)
end
function RefreshContractsEvent:run(connection)
if RefreshContractsEvent.debug then print("RefreshContractsEvent:run") end
if not connection:getIsServer() then
local senderUserId = g_currentMission.userManager:getUserIdByConnection(connection)
local senderFarm = g_farmManager:getFarmByUserId(senderUserId)
local isMasterUser = connection:getIsLocal() or g_currentMission.userManager:getIsConnectionMasterUser(connection)
-- if g_currentMission:getHasPlayerPermission("manageContracts", connection, senderFarm.farmId) and (self.mission.farmId == senderFarm.farmId or isMasterUser) then
g_missionManager:refreshMissions()
-- end
end
end