SC_PayFineEvent = {}
SC_PayFineEvent_mt = Class(SC_PayFineEvent, Event)

InitEventClass(SC_PayFineEvent, "SC_PayFineEvent")

function SC_PayFineEvent.emptyNew()
    return Event.new(SC_PayFineEvent_mt)
end

function SC_PayFineEvent.new(amount, farmId)
    local self = SC_PayFineEvent.emptyNew()
    self.amount = amount
    self.farmId = farmId
    return self
end

function SC_PayFineEvent:readStream(streamId, connection)
    self.amount = streamReadFloat32(streamId)
    self.farmId = streamReadInt32(streamId)
    self:run(connection)
end

function SC_PayFineEvent:writeStream(streamId, connection)
    streamWriteFloat32(streamId, self.amount)
    streamWriteInt32(streamId, self.farmId)
end

function SC_PayFineEvent:run(connection)
    if g_currentMission:getIsServer() then
        g_currentMission:addMoney(self.amount, self.farmId, MoneyType.OTHER)
    end
end
