wolfadmin/luascripts/admin/history.lua
Timo Smit f8cbba943f Advanced player punishments (issue #55)
Warns, mutes and bans are stored in the database. A history is available through !showhistory [player] and !showwarns has been merged into this.
2017-01-12 18:26:45 +01:00

54 lines
1.8 KiB
Lua

-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2017 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local db = require "luascripts.wolfadmin.db.db"
local players = require "luascripts.wolfadmin.players.players"
local events = require "luascripts.wolfadmin.util.events"
local settings = require "luascripts.wolfadmin.util.settings"
local history = {}
function history.get(clientId, historyId)
return db.getHistoryItem(historyId)
end
function history.getCount(clientId)
local playerId = db.getplayer(players.getGUID(clientId))["id"]
return db.getHistoryCount(playerId)
end
function history.getList(clientId, start, limit)
local playerId = db.getplayer(players.getGUID(clientId))["id"]
return db.getHistory(playerId, start, limit)
end
function history.add(victimId, invokerId, type, reason)
local victimPlayerId = db.getplayer(players.getGUID(victimId))["id"]
local invokerPlayerId = db.getplayer(players.getGUID(invokerId))["id"]
db.addHistory(victimPlayerId, invokerPlayerId, type, os.time(), reason)
end
function history.remove(clientId, historyId)
db.removeHistory(historyId)
end
return history