I think that is time to we update our currently banishment system.
We should add a few things that we had in TFS 0.4 for example:
What do you guys think?
Regards,
vankk.
It's always good to have a nicer control over ban duration.
@djarek @ranisalt I'm interessed in doing that, how you guys want it?
IMHO it should be mostly moved to Lua and very configurable, with the defaults being what Tibia does today.
player:ban(7 * 24 * 60 * 60) to ban for a week)onKill/onDeath to record a frag)I will assign it to you, but please open a PR as soon as you have some code and mark as [wip] so we can track progress :)
I was thinking in:
/ban Life, suck, 30h that will ban the Life for 30 hours and we can use /ban Life, suck, 30d too, to ban the Life for 30 days). If you have a better suggestion for param please say it.What you think about it? Let me know if you have something else in mind.
Also, I didn't catch what you said about the events, you mean frag punishiment? If yes, how that should be done, in config.lua?
I'll be free in a couple days, and I'll start it, 馃槃
Isn't there a ban wizard embedded in the client?
@ranisalt it had, was removed as soon as gamemasters get removed
Maybe create lua function and after that create script using modal windows?
I should proceed with the params @ranisalt ? That should be our best option for this since we didn't have the ban wizard anymore.
What did you think about the items that I said above?
Creating a wizard with modal windows is a good one. Wait for more suggestions.
How that should be in modal window? We can't write on it. Also, if we proceed with modal windows we must approve to this repository the Modal Helper maded by @socket2810 .
Not really, offline trainer windows is a perfect example.
@joseluis2g what he meant is that modal window doesn't accept user input, imo modal window would look ugly, i think we should support classic banishment by chat commands, for a ban wizard it could be a patch for otc.
We need a Player(id or name) function to temporary load offline player. So player:ban could be used with them.
But the house list modal is writable
@ranisalt that is not a modal window, it's a client built-in window dialog, same for books/letter editing, these allow you to get user input, that why i think it would be ugly, a mix of modal window event and ontextedit event.
I agree with @wgrriffel . We should proceed with params, something in mind? I think the way that I suggested is awesome!
@vankk I think you should make it according with new report system, /ban target, type, reason, comment, but not type as time, as a type itself, each type has a ban time, reason could be reasons that has in report window, comment could be a custom one by administrator or automated to get type + reason, however, to it works means that we should support new reporting things, i'll work on it.
I'll do some research on this.
local config = {
sep = '\n\n----------------------------------------------------------\n',
file = "data/logs/bans.txt"
}
function onSay(cid, words, param)
local file = io.open(config.file, "a+")
if not file then
return print("Warning: Could not open ".. config.file)
end
local player = Player(cid)
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local split = param:split(",")
if split[1] ~= nil then
local accountId = getAccountNumberByPlayerName(split[1])
if accountId > 0 then
local comment = ""
if split[2] == nil then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Usage: /ban Nick, hours, reason\nFor example: /ban PlayerName, 1, Bug abuse")
return false
elseif isNumber(split[2]) == false then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Usage: /ban Nick, hours, reason\nFor example: /ban PlayerName, 1, Bug abuse")
return false
end
if split[3] == nil then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Usage: /ban Nick, hours, reason\nFor example: /ban PlayerName, 1, Bug abuse")
comment = split[3]
return false
end
else
player:sendCancelMessage("Player with name " .. split[1] .. " doesn't exist.")
return false
end
local resultId = db.storeQuery("SELECT 1 FROM `account_bans` WHERE `account_id` = " .. accountId)
if resultId ~= false then
result.free(resultId)
return false
end
local targetCid = getPlayerByName(split[1])
local timeNow = os.time()
local queryBool = db:query("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" .. accountId .. "," .. "'" .. tostring(split[3]) .. "'" ..", " .. timeNow .. ", " .. timeNow + (split[2] * 3600) .. ", " .. getPlayerGUIDByName(getCreatureName(cid)) .. ")")
if queryBool == true then
if targetCid ~= false then
doRemoveCreature(targetCid)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE,"" .. split[1] .. " was banished because of " .. split[3] .. " for " .. split[2] .. " days by " .. player:getName() .. ".")
file:write(string.format('Date [%s] |%s Banished by %s because of%s%s', os.date("%d/%m/%y %H:%M"), split[1], player:getName(), split[3], config.sep))
file:close()
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Usage: /ban Nick, hours, reason\nFor example: /ban PlayerName, 1, Bug abuse")
end
end end
credits djseban otland member, changes and little update for me
Are we a agreed a modalwindow system would be accepted?
Also related to #2178 for IPv6 support in bans.
Most helpful comment
I agree with @wgrriffel . We should proceed with params, something in mind? I think the way that I suggested is awesome!