Skip to content
Permalink
Browse files

added the gametime start time and end time to the event database

  • Loading branch information...
Jake Fonseca
Jake Fonseca committed Oct 20, 2014
1 parent 2e47918 commit f35d8212315928ae5cb6bdada54b9fd7087467d3
Showing with 10 additions and 3 deletions.
  1. +5 −2 lib/OCCPGameServer/Handlers/exechandler.rb
  2. +3 −1 lib/OCCPGameServer/main.rb
  3. +2 −0 schema.sql
@@ -93,8 +93,9 @@ def run(event, app_core)
# Prep the events command
newCom = netNS.comwrap(event.command)

gameTimeStart = $appCore.gameclock.gametime

#TODO Optimize command speci;lization to arrays
#TODO Optimize command specialization to arrays
begin
# run the provided command
#puts event.name + event.command.to_s
@@ -106,10 +107,12 @@ def run(event, app_core)
$log.warn msg
end

gameTimeEnd = $appCore.gameclock.gametime
app_core.release_netns(netNS.nsName)

#Log message that the event ran
msgHash = {:handler => 'ExecHandler', :eventname => event.name, :eventuid => event.eventuid, :custom => event.command }
msgHash = {:handler => 'ExecHandler', :eventname => event.name, :eventuid => event.eventuid, :custom => event.command,
:starttime => gameTimeStart, :endtime => gameTimeEnd }

$log.debug "#{event.eventuid.light_magenta} executed #{event.command}"

@@ -214,14 +214,16 @@ def run ()
when 'EVENTLOG'
#Log that an event was run
tblArray = [Time.now.to_i,
message.msg[:starttime],
message.msg[:endtime],
message.msg[:handler],
message.msg[:eventname],
message.msg[:eventuid],
message.msg[:custom],
message.msg[:status]
]

$db.execute("INSERT INTO event VALUES (?,?,?,?,?,?);", tblArray);
$db.execute("INSERT INTO event VALUES (?,?,?,?,?,?,?,?);", tblArray);
$log.debug("Event Recorded in db.event")

when 'COMMAND'
@@ -7,6 +7,8 @@ CREATE TABLE IF NOT EXISTS score (

CREATE TABLE IF NOT EXISTS event (
time INTEGER,
gametimestart REAL,
gametimeend REAL,
handler TEXT,
eventname TEXT,
eventuid TEXT,

0 comments on commit f35d821

Please sign in to comment.
You can’t perform that action at this time.