Skip to content
Permalink
Browse files

Bug fixes, performance tweaks, new commands, queues and timers and st…

…uff.

New command /remove/leave expired claims.
The bot can automatically remove dead claims.  The default is to leave them alone.

Fixed a bug in the screamer alert toggle.  Used wrong value for true and false.

Base separation has been changed.  There is a new base deadzone that can be set.  The lowest setting allowed is 2x the base size.  This is so that base protections won't overlap.  If players are friends, the base separation restriction is waived.

Fixed issue in hotspot commands that broke them in API mode.  It seems the API is a bit picky about the use of #.  This was also fixed in a few other places for the same reason.

The /locations command now reports when there are no locations instead of saying nothing.

The bot now always sends the 'sa' command via telnet to fix an issue I encountered with sending it via the API.

Fixed typo in /enable/disable return so that it matches the help.

Added an API queue and timer so that API commands sent by the bot are sent one at a time on a timer to avoid spamming too many too fast.  Currently this is only used for chat sent by the bot.  You will notice that chat appears with a slight delay due to this.  This should also help to stop some players spamming bot commands in an attempt to disrupt the bot or server.  You can also set a command delay.

Added a new post update function which does some maintenance tasks after a bot update.  At the moment all it does is a bot restart 5 minutes after the update.  This will help to ensure that the bot is properly initialised with any changes introduced by the update.  It won't do this until the next update since the code is new and not live before the update.

Added IRC command, reload bot.  Same as ingame command.

Added IRC command empty category {category name}.  A fast way to delete everything from a category.

Added IRC command igplayers.  Its used for debugging the bot.  The bot creates a temporary ingame player record for each player online.  This command lets you view all of it for each player.  There is also igplayer {name} to list a specific player's data.

Fixed a bug when loading the server table from the database.  If the IRC server was not defined, the bot would fail to load properly.

Removed a very basic 'phone home' feature as I haven't been monitoring it anyway.  It will be replaced with restful API in the web interface.

To help reduce command spam on servers with large online player counts, when online players exceeds 24 players, several timed bot commands switch to slower timers.  This results in a slower bot but it should help to prevent freezes and crashes when the server is busy.

Fixed bug in gimme arena that prevented zombies spawning.

Fixed bug that caused admins to return to the admin list that had been removed.

Added delay after a player spawns after joining the server before the bot attempts to teleport them.  This may be unnecessary but there was an issue with players sometimes getting desynced and causing the server to crash if they are teleported too quickly.
  • Loading branch information...
MatthewDwyer committed Oct 8, 2018
1 parent 73fef80 commit bc37fcb2bfc7ba433ed85d9d8478b10ab79bdad2
Showing with 1,963 additions and 1,402 deletions.
  1. +0 −36 mudlet/profiles/newbot/scripts/APITimer.lua
  2. +119 −8 mudlet/profiles/newbot/scripts/chat/gmsg_admin.lua
  3. +980 −888 mudlet/profiles/newbot/scripts/chat/gmsg_base.lua
  4. +1 −1 mudlet/profiles/newbot/scripts/chat/gmsg_bot.lua
  5. +10 −4 mudlet/profiles/newbot/scripts/chat/gmsg_functions.lua
  6. +8 −8 mudlet/profiles/newbot/scripts/chat/gmsg_hotspots.lua
  7. +8 −1 mudlet/profiles/newbot/scripts/chat/gmsg_locations.lua
  8. +1 −1 mudlet/profiles/newbot/scripts/chat/gmsg_mail.lua
  9. +1 −1 mudlet/profiles/newbot/scripts/chat/gmsg_misc.lua
  10. +2 −2 mudlet/profiles/newbot/scripts/chat/gmsg_server.lua
  11. +2 −2 mudlet/profiles/newbot/scripts/chat/gmsg_teleports.lua
  12. +76 −27 mudlet/profiles/newbot/scripts/core_functions.lua
  13. +138 −38 mudlet/profiles/newbot/scripts/functions.lua
  14. +59 −0 mudlet/profiles/newbot/scripts/irc_message.lua
  15. +6 −4 mudlet/profiles/newbot/scripts/load_lua_tables.lua
  16. +11 −4 mudlet/profiles/newbot/scripts/mysql.lua
  17. +42 −18 mudlet/profiles/newbot/scripts/reload_bot_scripts.lua
  18. +5 −2 mudlet/profiles/newbot/scripts/shop.lua
  19. +29 −25 mudlet/profiles/newbot/scripts/startup_bot.lua
  20. +1 −17 mudlet/profiles/newbot/scripts/teleport_functions.lua
  21. +2 −2 mudlet/profiles/newbot/scripts/thirty_minutes.lua
  22. +10 −0 mudlet/profiles/newbot/scripts/timers/APITimer.lua
  23. +20 −0 mudlet/profiles/newbot/scripts/timers/fifteen_second_timer.lua
  24. +25 −0 mudlet/profiles/newbot/scripts/timers/gimme_queued_commands_timer.lua
  25. +22 −6 mudlet/profiles/newbot/scripts/timers/list_players_timer.lua
  26. +10 −10 mudlet/profiles/newbot/scripts/timers/one_minute_timer.lua
  27. +2 −2 mudlet/profiles/newbot/scripts/timers/player_queued_commands_timer.lua
  28. +12 −14 mudlet/profiles/newbot/scripts/timers/ten_second_timer.lua
  29. +1 −3 mudlet/profiles/newbot/scripts/timers/thirty_second_timer.lua
  30. +3 −2 mudlet/profiles/newbot/scripts/timers/track_player_timer.lua
  31. +6 −2 mudlet/profiles/newbot/scripts/timers/two_minute_timer.lua
  32. +18 −28 mudlet/profiles/newbot/scripts/trialCode.lua
  33. +21 −2 mudlet/profiles/newbot/scripts/triggers/end_list_players.lua
  34. +56 −48 mudlet/profiles/newbot/scripts/triggers/list_known_players.lua
  35. +22 −21 mudlet/profiles/newbot/scripts/triggers/llp.lua
  36. +25 −26 mudlet/profiles/newbot/scripts/triggers/match_all.lua
  37. +22 −21 mudlet/profiles/newbot/scripts/triggers/player_info.lua
  38. +187 −128 mudlet/profiles/newbot/scripts/webAPI_functions.lua

This file was deleted.

@@ -186,6 +186,13 @@ function gmsg_admin()

setChatColour(id)

-- save the player record to the database
if not isArchived then
updatePlayer(id)
else
updateArchivedPlayer(id)
end

botman.faultyChat = false
return true
end
@@ -1557,6 +1564,8 @@ function gmsg_admin()


local function cmd_ArchivePlayers() --tested
local k,v

if (chatvars.showHelp and not skipHelp) or botman.registerHelp then
help = {}
help[1] = " {#}archive players"
@@ -1607,6 +1616,17 @@ function gmsg_admin()
irc_chat(chatvars.ircAlias, "Players (except staff) who have not played in 60 days will be archived. The bot may become un-responsive during this time.")
end

botman.archivePlayers = true

-- first flag everyone except staff as notInLKP. We will remove that flag as we find them in LKP.
for k,v in pairs(players) do
if tonumber(v.accessLevel) > 3 then
v.notInLKP = true
else
v.notInLKP = false
end
end

tempTimer( 10, [[sendCommand("lkp")]] )
botman.faultyChat = false
return true
@@ -4574,9 +4594,9 @@ function gmsg_admin()
end

if (chatvars.playername ~= "Server") then
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]Player " .. playerName .. " will spawn at " .. locations[loc].name .. " next time they join.[-]")
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]Player " .. playerName .. " will be moved to " .. locations[loc].name .. " next time they join.[-]")
else
irc_chat(chatvars.ircAlias, "Player " .. playerName .. " will spawn at " .. locations[loc].name .. " next time they join.")
irc_chat(chatvars.ircAlias, "Player " .. playerName .. " will be moved to " .. locations[loc].name .. " next time they join.")
end
end

@@ -5375,12 +5395,21 @@ function gmsg_admin()

if botman.dbConnected then conn:execute("UPDATE keystones SET remove = 1 WHERE steam = " .. id) end

if (chatvars.playername ~= "Server") then
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]I will remove all of player " .. playerName .. "'s claims when their chunks are loaded.[-]")
if accessLevel(id) > 2 then
if (chatvars.playername ~= "Server") then
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]Player " .. playerName .. "'s claims will be removed when players are nearby.[-]")
else
irc_chat(chatvars.ircAlias, "Player " .. playerName .. "'s claims will be removed when players are nearby.")
end
else
irc_chat(chatvars.ircAlias, "I will remove all of player " .. playerName .. "'s claims when their chunks are loaded.")
if (chatvars.playername ~= "Server") then
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]Admin " .. playerName .. "'s claims will be marked for removal but will only be removed when they are no longer an admin (and not using {#}test as player).[-]")
else
irc_chat(chatvars.ircAlias, "Admin " .. playerName .. "'s claims will be marked for removal but will only be removed when they are no longer an admin (and not using {#}test as player).")
end
end

-- do a scan now so all of their claims are recorded
sendCommand("llp " .. id .. " parseable")
end

@@ -7019,6 +7048,8 @@ function gmsg_admin()
end
end

players[pid].testAsPlayer = true

-- force an early retirement
owners[pid] = nil
admins[pid] = nil
@@ -7202,7 +7233,7 @@ function gmsg_admin()
end
end

if (chatvars.words[1] == "disable" or chatvars.words[1] == "enable") and chatvars.words[2] == "level" and chatvars.words[3] == "hack" and chatvars.words[3] == "alert" then
if (chatvars.words[1] == "disable" or chatvars.words[1] == "enable") and chatvars.words[2] == "level" and chatvars.words[3] == "hack" and chatvars.words[4] == "alert" then
if (chatvars.playername ~= "Server") then
if (chatvars.accessLevel > 1) then
message(string.format("pm %s [%s]" .. restrictedCommandMessage(), chatvars.playerid, server.chatColour))
@@ -8046,6 +8077,77 @@ function gmsg_admin()
end


local function cmd_ToggleRemoveExpiredClaims()
if (chatvars.showHelp and not skipHelp) or botman.registerHelp then
help = {}
help[1] = " {#}remove/leave expired claims"
help[2] = "By default the bot will not remove expired claims. It will always ignore admin claims."

if botman.registerHelp then
tmp.command = help[1]
tmp.keywords = "remo,leav,togg,claim,exp"
tmp.accessLevel = 1
tmp.description = help[2]
tmp.notes = ""
tmp.ingameOnly = 0
registerHelp(tmp)
end

if (chatvars.words[1] == "help" and (string.find(chatvars.command, "remove") or string.find(chatvars.command, "leave") or string.find(chatvars.command, "exp") or string.find(chatvars.command, "claim"))) or chatvars.words[1] ~= "help" then
irc_chat(chatvars.ircAlias, help[1])

if not shortHelp then
irc_chat(chatvars.ircAlias, help[2])
irc_chat(chatvars.ircAlias, ".")
end

chatvars.helpRead = true
end
end

if (chatvars.words[1] == "remove" or chatvars.words[1] == "leave") and chatvars.words[2] == "expired" and string.find(chatvars.words[3], "claim") then
if (chatvars.playername ~= "Server") then
if (chatvars.accessLevel > 1) then
message(string.format("pm %s [%s]" .. restrictedCommandMessage(), chatvars.playerid, server.chatColour))
botman.faultyChat = false
return true
end
else
if (chatvars.accessLevel > 1) then
irc_chat(chatvars.ircAlias, "This command is restricted.")
botman.faultyChat = false
return true
end
end

if chatvars.words[1] == "remove" then
server.removeExpiredClaims = true
conn:execute("UPDATE server SET removeExpiredClaims = 1")

if (chatvars.playername ~= "Server") then
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]Expired claims will be removed when players are nearby.[-]")
else
irc_chat(chatvars.ircAlias, "Expired claims will be removed when players are nearby.")
end
else
server.removeExpiredClaims = false
conn:execute("UPDATE server SET removeExpiredClaims = 0")

if (chatvars.playername ~= "Server") then
message("pm " .. chatvars.playerid .. " [" .. server.chatColour .. "]Expired claims will not be removed.[-]")
else
irc_chat(chatvars.ircAlias, "Expired claims will not be removed.")
end
end

irc_chat(chatvars.ircAlias, ".")

botman.faultyChat = false
return true
end
end


local function cmd_ToggleReservedSlotPlayer()
local playerName, isArchived

@@ -8210,7 +8312,7 @@ function gmsg_admin()

if chatvars.words[1] == "disable" then
disableTrigger("Zombie Scouts")
server.enableScreamerAlert = 0
server.enableScreamerAlert = false
conn:execute("UPDATE server SET enableScreamerAlert = 0")

if (chatvars.playername ~= "Server") then
@@ -8220,7 +8322,7 @@ function gmsg_admin()
end
else
enableTrigger("Zombie Scouts")
server.enableScreamerAlert = 1
server.enableScreamerAlert = true
conn:execute("UPDATE server SET enableScreamerAlert = 1")

if (chatvars.playername ~= "Server") then
@@ -9854,6 +9956,15 @@ if debug then dbug("debug admin") end

if (debug) then dbug("debug admin line " .. debugger.getinfo(1).currentline) end

result = cmd_ToggleRemoveExpiredClaims()

if result then
if debug then dbug("debug cmd_ToggleRemoveExpiredClaims triggered") end
return result
end

if (debug) then dbug("debug admin line " .. debugger.getinfo(1).currentline) end

result = cmd_ToggleReservedSlotPlayer()

if result then

0 comments on commit bc37fcb

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