mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 22:54:53 +02:00
introduce changes from streamside fork
This commit is contained in:
65
data/talkactions/scripts/reload.lua
Normal file
65
data/talkactions/scripts/reload.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local reloadTypes = {
|
||||
["all"] = { targetType = RELOAD_TYPE_ALL, name = "all" },
|
||||
|
||||
["action"] = { targetType = RELOAD_TYPE_ACTIONS, name = "actions" },
|
||||
["actions"] = { targetType = RELOAD_TYPE_ACTIONS, name = "actions" },
|
||||
|
||||
["chat"] = { targetType = RELOAD_TYPE_CHAT, name = "chatchannels" },
|
||||
["channel"] = { targetType = RELOAD_TYPE_CHAT, name = "chatchannels" },
|
||||
["chatchannels"] = { targetType = RELOAD_TYPE_CHAT, name = "chatchannels" },
|
||||
|
||||
["config"] = { targetType = RELOAD_TYPE_CONFIG, name = "config" },
|
||||
["configuration"] = { targetType = RELOAD_TYPE_CONFIG, name = "config" },
|
||||
|
||||
["creaturescript"] = { targetType = RELOAD_TYPE_CREATURESCRIPTS, name = "creature scripts" },
|
||||
["creaturescripts"] = { targetType = RELOAD_TYPE_CREATURESCRIPTS, name = "creature scripts" },
|
||||
|
||||
["events"] = { targetType = RELOAD_TYPE_EVENTS, name = "events" },
|
||||
|
||||
["global"] = { targetType = RELOAD_TYPE_GLOBAL, name = "global.lua" },
|
||||
|
||||
["globalevent"] = { targetType = RELOAD_TYPE_GLOBALEVENTS, name = "globalevents" },
|
||||
["globalevents"] = { targetType = RELOAD_TYPE_GLOBALEVENTS, name = "globalevents" },
|
||||
|
||||
["items"] = { targetType = RELOAD_TYPE_ITEMS, name = "items" },
|
||||
|
||||
["monster"] = { targetType = RELOAD_TYPE_MONSTERS, name = "monsters" },
|
||||
["monsters"] = { targetType = RELOAD_TYPE_MONSTERS, name = "monsters" },
|
||||
|
||||
["move"] = { targetType = RELOAD_TYPE_MOVEMENTS, name = "movements" },
|
||||
["movement"] = { targetType = RELOAD_TYPE_MOVEMENTS, name = "movements" },
|
||||
["movements"] = { targetType = RELOAD_TYPE_MOVEMENTS, name = "movements" },
|
||||
|
||||
["npc"] = { targetType = RELOAD_TYPE_NPCS, name = "npcs" },
|
||||
["npcs"] = { targetType = RELOAD_TYPE_NPCS, name = "npcs" },
|
||||
|
||||
["raid"] = { targetType = RELOAD_TYPE_RAIDS, name = "raids" },
|
||||
["raids"] = { targetType = RELOAD_TYPE_RAIDS, name = "raids" },
|
||||
|
||||
["spell"] = { targetType = RELOAD_TYPE_SPELLS, name = "spells" },
|
||||
["spells"] = { targetType = RELOAD_TYPE_SPELLS, name = "spells" },
|
||||
|
||||
["talk"] = { targetType = RELOAD_TYPE_TALKACTIONS, name = "talk actions" },
|
||||
["talkaction"] = { targetType = RELOAD_TYPE_TALKACTIONS, name = "talk actions" },
|
||||
["talkactions"] = { targetType = RELOAD_TYPE_TALKACTIONS, name = "talk actions" }
|
||||
}
|
||||
|
||||
function onSay(player, words, param)
|
||||
if not player:getGroup():getAccess() then
|
||||
return true
|
||||
end
|
||||
|
||||
if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
|
||||
return false
|
||||
end
|
||||
|
||||
local reloadType = reloadTypes[param and param:lower()]
|
||||
if not reloadType then
|
||||
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Reload type not found.")
|
||||
return false
|
||||
end
|
||||
|
||||
Game.reload(reloadType.targetType)
|
||||
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Reloaded %s.", reloadType.name))
|
||||
return true
|
||||
end
|
23
data/talkactions/scripts/save.lua
Normal file
23
data/talkactions/scripts/save.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
function onSay(player, words, param)
|
||||
|
||||
local function timeSave(delay, msg)
|
||||
broadcastMessage(msg, MESSAGE_STATUS_WARNING)
|
||||
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
|
||||
addEvent(saveServer, delay)
|
||||
end
|
||||
|
||||
if not player:getGroup():getAccess() then
|
||||
return true
|
||||
end
|
||||
|
||||
if player:getAccountType() < ACCOUNT_TYPE_GOD then
|
||||
return false
|
||||
end
|
||||
|
||||
if isNumber(param) then
|
||||
local delay = tonumber(param) * 1000
|
||||
timeSave(delay, "Saving server in " .. tonumber(param) .. " seconds.")
|
||||
else
|
||||
saveServer()
|
||||
end
|
||||
end
|
19
data/talkactions/scripts/sellhouse.lua
Normal file
19
data/talkactions/scripts/sellhouse.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
function onSay(player, words, param)
|
||||
local tradePartner = Player(param)
|
||||
if not tradePartner or tradePartner == player then
|
||||
player:sendCancelMessage("Trade player not found.")
|
||||
return false
|
||||
end
|
||||
|
||||
local house = player:getTile():getHouse()
|
||||
if not house then
|
||||
player:sendCancelMessage("You must stand in your house to initiate the trade.")
|
||||
return false
|
||||
end
|
||||
|
||||
local returnValue = house:startTrade(player, tradePartner)
|
||||
if returnValue ~= RETURNVALUE_NOERROR then
|
||||
player:sendCancelMessage(returnValue)
|
||||
end
|
||||
return false
|
||||
end
|
Reference in New Issue
Block a user