Full Distribution

This commit is contained in:
rasanpedromujica
2019-01-16 17:16:38 -05:00
commit 009a571331
1258 changed files with 185603 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
local function getSkillId(skillName)
if skillName == "club" then
return SKILL_CLUB
elseif skillName == "sword" then
return SKILL_SWORD
elseif skillName == "axe" then
return SKILL_AXE
elseif skillName:sub(1, 4) == "dist" then
return SKILL_DISTANCE
elseif skillName:sub(1, 6) == "shield" then
return SKILL_SHIELD
elseif skillName:sub(1, 4) == "fish" then
return SKILL_FISHING
else
return SKILL_FIST
end
end
local function getExpForLevel(level)
level = level - 1
return ((50 * level * level * level) - (150 * level * level) + (400 * level)) / 3
end
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local split = param:split(",")
if split[2] == nil then
player:sendCancelMessage("Insufficient parameters.")
return false
end
local target = Player(split[1])
if target == nil then
player:sendCancelMessage("A player with that name is not online.")
return false
end
-- Trim left
split[2] = split[2]:gsub("^%s*(.-)$", "%1")
local count = 1
if split[3] ~= nil then
count = tonumber(split[3])
end
local ch = split[2]:sub(1, 1)
for i = 1, count do
if ch == "l" or ch == "e" then
target:addExperience(getExpForLevel(target:getLevel() + 1) - target:getExperience(), false)
elseif ch == "m" then
target:addManaSpent(target:getVocation():getRequiredManaSpent(target:getBaseMagicLevel() + 1) - target:getManaSpent())
else
local skillId = getSkillId(split[2])
target:addSkillTries(skillId, target:getVocation():getRequiredSkillTries(skillId, target:getSkillLevel(skillId) + 1) - target:getSkillTries(skillId))
end
end
return false
end

View File

@@ -0,0 +1,21 @@
function onSay(player, words, param)
if player:getAccountType() <= ACCOUNT_TYPE_TUTOR then
return true
end
local target = Player(param)
if target == nil then
player:sendCancelMessage("A player with that name is not online.")
return false
end
if target:getAccountType() ~= ACCOUNT_TYPE_NORMAL then
player:sendCancelMessage("You can only promote a normal player to a tutor.")
return false
end
target:setAccountType(ACCOUNT_TYPE_TUTOR)
target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been promoted to a tutor by " .. player:getName() .. ".")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have promoted " .. target:getName() .. " to a tutor.")
return false
end

View File

@@ -0,0 +1,29 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local effect = tonumber(param)
local position = player:getPosition()
local toPositionLow = {z = position.z}
local toPositionHigh = {z = position.z}
toPositionLow.x = position.x - 7
toPositionHigh.x = position.x + 7
for i = -5, 5 do
toPositionLow.y = position.y + i
toPositionHigh.y = toPositionLow.y
position:sendDistanceEffect(toPositionLow, effect)
position:sendDistanceEffect(toPositionHigh, effect)
end
toPositionLow.y = position.y - 5
toPositionHigh.y = position.y + 5
for i = -6, 6 do
toPositionLow.x = position.x + i
toPositionHigh.x = toPositionLow.x
position:sendDistanceEffect(toPositionLow, effect)
position:sendDistanceEffect(toPositionHigh, effect)
end
return false
end

View File

@@ -0,0 +1,39 @@
local banDays = 7
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local name = param
local reason = ''
local separatorPos = param:find(',')
if separatorPos ~= nil then
name = param:sub(0, separatorPos - 1)
reason = string.trim(param:sub(separatorPos + 1))
end
local accountId = getAccountNumberByPlayerName(name)
if accountId == 0 then
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 timeNow = os.time()
db.query("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..
accountId .. ", " .. db.escapeString(reason) .. ", " .. timeNow .. ", " .. timeNow + (banDays * 86400) .. ", " .. player:getGuid() .. ")")
local target = Player(name)
if target ~= nil then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, target:getName() .. " has been banned.")
target:remove()
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, name .. " has been banned.")
end
end

View File

@@ -0,0 +1,11 @@
function onSay(player, words, param)
if not getPlayerFlagValue(player, PlayerFlag_CanBroadcast) then
return true
end
print("> " .. player:getName() .. " broadcasted: \"" .. param .. "\".")
for _, targetPlayer in ipairs(Game.getPlayers()) do
targetPlayer:sendTextMessage(MESSAGE_STATUS_WARNING, param)
end
return false
end

View File

@@ -0,0 +1,36 @@
function onSay(player, words, param)
if player:getPremiumDays() <= 0 then
player:sendCancelMessage("You need a premium account.")
return false
end
local position = player:getPosition()
position:getNextPosition(player:getDirection())
local tile = Tile(position)
local house = tile and tile:getHouse()
if house == nil then
player:sendCancelMessage("You have to be looking at the door of the house you would like to buy.")
return false
end
if house:getOwnerGuid() > 0 then
player:sendCancelMessage("This house already has an owner.")
return false
end
if player:getHouse() then
player:sendCancelMessage("You are already the owner of a house.")
return false
end
local price = house:getRent() * 5
if not player:removeMoney(price) then
player:sendCancelMessage("You do not have enough money.")
return false
end
house:setOwnerGuid(player:getGuid())
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in the bank.")
return false
end

View File

@@ -0,0 +1,25 @@
local config = {
days = 90,
maxDays = 365,
price = 10000
}
function onSay(player, words, param)
if configManager.getBoolean(configKeys.FREE_PREMIUM) then
return true
end
if player:getPremiumDays() <= config.maxDays then
if player:removeMoney(config.price) then
player:addPremiumDays(config.days)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought " .. config.days .." days of premium account.")
else
player:sendCancelMessage("You don't have enough money, " .. config.maxDays .. " days premium account costs " .. config.price .. " gold coins.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
else
player:sendCancelMessage("You can not buy more than " .. config.maxDays .. " days of premium account.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return false
end

View File

@@ -0,0 +1,25 @@
local condition = Condition(CONDITION_OUTFIT, CONDITIONID_COMBAT)
condition:setTicks(-1)
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local itemType = ItemType(param)
if itemType:getId() == 0 then
itemType = ItemType(tonumber(param))
if itemType:getId() == 0 then
player:sendCancelMessage("There is no item with that id or name.")
return false
end
end
condition:setOutfit(itemType:getId())
player:addCondition(condition)
return false
end

View File

@@ -0,0 +1,19 @@
local premiumDaysCost = 3
function onSay(player, words, param)
if player:getGroup():getAccess() then
player:setSex(player:getSex() == PLAYERSEX_FEMALE and PLAYERSEX_MALE or PLAYERSEX_FEMALE)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have changed your sex.")
return false
end
if player:getPremiumDays() >= premiumDaysCost then
player:removePremiumDays(premiumDaysCost)
player:setSex(player:getSex() == PLAYERSEX_FEMALE and PLAYERSEX_MALE or PLAYERSEX_FEMALE)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have changed your sex for ".. premiumDaysCost .." days of your premium account.")
else
player:sendCancelMessage("You do not have enough premium days, changing sex costs ".. premiumDaysCost .." days of your premium account.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return false
end

View File

@@ -0,0 +1,15 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local itemCount = cleanMap()
if itemCount > 0 then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "Cleaned " .. itemCount .. " item" .. (itemCount > 1 and "s" or "") .. " from the map.")
end
return false
end

View File

@@ -0,0 +1,17 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
if param == "shutdown" then
Game.setGameState(GAME_STATE_SHUTDOWN)
else
Game.setGameState(GAME_STATE_CLOSED)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Server is now closed.")
end
return false
end

View File

@@ -0,0 +1,59 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local split = param:split(",")
local itemType = ItemType(split[1])
if itemType:getId() == 0 then
itemType = ItemType(tonumber(split[1]))
if itemType:getId() == 0 then
player:sendCancelMessage("There is no item with that id or name.")
return false
end
end
local keynumber = 0
local count = tonumber(split[2])
if count ~= nil then
if itemType:isStackable() then
count = math.min(10000, math.max(1, count))
elseif itemType:isKey() then
keynumber = count
count = 1
elseif not itemType:hasSubType() then
count = math.min(100, math.max(1, count))
else
count = math.max(1, count)
end
else
count = 1
end
local result = player:addItem(itemType:getId(), count)
if result ~= nil then
if not itemType:isStackable() then
if type(result) == "table" then
for _, item in ipairs(result) do
if itemType:isKey() then
item:setAttribute(ITEM_ATTRIBUTE_KEYNUMBER, keynumber)
end
item:decay()
end
else
if itemType:isKey() then
result:setAttribute(ITEM_ATTRIBUTE_KEYNUMBER, keynumber)
end
result:decay()
end
end
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
return false
end

View File

@@ -0,0 +1,62 @@
local function getArticle(str)
return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end
local function getMonthDayEnding(day)
if day == "01" or day == "21" or day == "31" then
return "st"
elseif day == "02" or day == "22" then
return "nd"
elseif day == "03" or day == "23" then
return "rd"
else
return "th"
end
end
local function getMonthString(m)
return os.date("%B", os.time{year = 1970, month = m, day = 1})
end
function onSay(player, words, param)
local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param))
if resultId ~= false then
local targetGUID = result.getDataInt(resultId, "id")
local targetName = result.getDataString(resultId, "name")
result.free(resultId)
local str = ""
local breakline = ""
local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC")
if resultId ~= false then
repeat
if str ~= "" then
breakline = "\n"
end
local date = os.date("*t", result.getDataInt(resultId, "time"))
local article = ""
local killed_by = result.getDataString(resultId, "killed_by")
if result.getDataInt(resultId, "is_player") == 0 then
article = getArticle(killed_by) .. " "
killed_by = string.lower(killed_by)
end
if date.day < 10 then date.day = "0" .. date.day end
if date.hour < 10 then date.hour = "0" .. date.hour end
if date.min < 10 then date.min = "0" .. date.min end
if date.sec < 10 then date.sec = "0" .. date.sec end
str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Died at Level " .. result.getDataInt(resultId, "level") .. " by " .. article .. killed_by .. "."
until not result.next(resultId)
result.free(resultId)
end
if str == "" then
str = "No deaths."
end
player:popupFYI("Deathlist for player, " .. targetName .. ".\n\n" .. str)
else
player:sendCancelMessage("A player with that name does not exist.")
end
return false
end

View File

@@ -0,0 +1,17 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local position = player:getPosition()
position.z = position.z + 1
local tile = Tile(position)
if tile == nil or tile:getGround() == nil then
player:sendCancelMessage("You cannot teleport there.")
return false
end
player:teleportTo(position)
return false
end

View File

@@ -0,0 +1,28 @@
function onSay(player, words, param)
local party = player:getParty()
if not party then
player:sendCancelMessage("You are not part of a party.")
return false
end
if party:getLeader() ~= player then
player:sendCancelMessage("You are not the leader of the party.")
return false
end
if party:isSharedExperienceActive() then
if player:getCondition(CONDITION_INFIGHT) then
player:sendCancelMessage("You are in fight. Experience sharing not disabled.")
else
party:setSharedExperience(false)
end
else
if player:getCondition(CONDITION_INFIGHT) then
player:sendCancelMessage("You are in fight. Experience sharing not enabled.")
else
party:setSharedExperience(true)
end
end
return false
end

View File

@@ -0,0 +1,23 @@
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 position = player:getPosition()
local isGhost = not player:isInGhostMode()
player:setGhostMode(isGhost)
if isGhost then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are now invisible.")
position:sendMagicEffect(CONST_ME_POFF)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are visible again.")
position.x = position.x + 1
position:sendMagicEffect(CONST_ME_TELEPORT)
end
return false
end

View File

@@ -0,0 +1,37 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local target = Player(param)
if not target then
player:sendCancelMessage("Player not found.")
return false
end
if target:getAccountType() > player:getAccountType() then
player:sendCancelMessage("You can not get info about this player.")
return false
end
local targetIp = target:getIp()
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Name: " .. target:getName())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Access: " .. (target:getGroup():getAccess() and "1" or "0"))
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Level: " .. target:getLevel())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Magic Level: " .. target:getMagicLevel())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Speed: " .. target:getSpeed())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Position: " .. string.format("(%0.5d / %0.5d / %0.3d)", target:getPosition().x, target:getPosition().y, target:getPosition().z))
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "IP: " .. Game.convertIpToString(targetIp))
local players = {}
for _, targetPlayer in ipairs(Game.getPlayers()) do
if targetPlayer:getIp() == targetIp and targetPlayer ~= target then
players[#players + 1] = targetPlayer:getName() .. " [" .. targetPlayer:getLevel() .. "]"
end
end
if #players > 0 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Other players on same IP: " .. table.concat(players, ", ") .. ".")
end
return false
end

View File

@@ -0,0 +1,36 @@
local ipBanDays = 7
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local resultId = db.storeQuery("SELECT `account_id`, `lastip` FROM `players` WHERE `name` = " .. db.escapeString(param))
if resultId == false then
return false
end
local targetIp = result.getDataLong(resultId, "lastip")
result.free(resultId)
local targetPlayer = Player(param)
if targetPlayer then
targetIp = targetPlayer:getIp()
targetPlayer:remove()
end
if targetIp == 0 then
return false
end
resultId = db.storeQuery("SELECT 1 FROM `ip_bans` WHERE `ip` = " .. targetIp)
if resultId ~= false then
result.free(resultId)
return false
end
local timeNow = os.time()
db.query("INSERT INTO `ip_bans` (`ip`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..
targetIp .. ", '', " .. timeNow .. ", " .. timeNow + (ipBanDays * 86400) .. ", " .. player:getGuid() .. ")")
return false
end

View File

@@ -0,0 +1,19 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local target = Player(param)
if target == nil then
player:sendCancelMessage("Player not found.")
return false
end
if target:getGroup():getAccess() then
player:sendCancelMessage("You cannot kick this player.")
return false
end
target:remove()
return false
end

View File

@@ -0,0 +1,75 @@
function onSay(player, words, param)
if Game.getWorldType() == WORLD_TYPE_PVP_ENFORCED then
player:showTextDialog(1998, "Your character has not murders history.", false)
return false
end
local today = os.time()
local skullTicks = player:getPlayerKillerEnd()
local lastDay = 0
local lastWeek = 0
local lastMonth = 0
local egibleMurders = 0
local dayTimestamp = today - (24 * 60 * 60)
local weekTimestamp = today - (7 * 24 * 60 * 60)
local monthTimestamp = today - (30 * 24 * 60 * 60)
local killsDayRedSkull = configManager.getNumber(configKeys.KILLS_DAY_RED_SKULL)
local killsWeekRedSkull = configManager.getNumber(configKeys.KILLS_WEEK_RED_SKULL)
local killsMonthRedSkull = configManager.getNumber(configKeys.KILLS_MONTH_RED_SKULL)
local killsDayBanishment = configManager.getNumber(configKeys.KILLS_DAY_BANISHMENT)
local killsWeekBanishment = configManager.getNumber(configKeys.KILLS_WEEK_BANISHMENT)
local killsMonthBanishment = configManager.getNumber(configKeys.KILLS_MONTH_BANISHMENT)
for _, timestamp in pairs(player:getMurderTimestamps()) do
if timestamp > dayTimestamp then
lastDay = lastDay + 1
end
if timestamp > weekTimestamp then
lastWeek = lastWeek + 1
end
egibleMurders = lastMonth + 1
if timestamp <= monthTimestamp then
egibleMurders = lastMonth
end
lastMonth = egibleMurders
end
local message = ""
message = message .. "Default murders\n"
message = message .. "- Daily kills for red skull " .. killsDayRedSkull .. "\n"
message = message .. "- Weekly kills for red skull " .. killsWeekRedSkull .. "\n"
message = message .. "- Monthly kills for red skull " .. killsMonthRedSkull .. "\n"
message = message .. "- Daily kills for banishment " .. killsDayBanishment .. "\n"
message = message .. "- Weekly kills for banishment " .. killsWeekBanishment .. "\n"
message = message .. "- Monthly kills for banishment " .. killsMonthBanishment .. "\n"
message = message .. "\n"
message = message .. "Last murders within 24 hours " .. lastDay .. "\n"
message = message .. "Last murders within a week " .. lastDay .. "\n"
message = message .. "Last murders within a month " .. lastDay .. "\n"
message = message .. "\n"
message = message .. "Players you may kill for a red skull:\n"
message = message .. "- Within 24 hours " .. killsDayRedSkull - lastDay .. " murders.\n"
message = message .. "- Within a week " .. killsWeekRedSkull - lastWeek .. " murders.\n"
message = message .. "- Within a month " .. killsMonthRedSkull - lastDay .. " murders.\n"
message = message .. "\n"
message = message .. "Players you may kill for a banishment:\n"
message = message .. "- Within 24 hours " .. killsDayBanishment - lastDay .. " murders.\n"
message = message .. "- Within a week " .. killsWeekBanishment - lastWeek .. " murders.\n"
message = message .. "- Within a month " .. killsMonthBanishment - lastDay .. " murders.\n"
player:showTextDialog(1998, message, false)
return false
end

View File

@@ -0,0 +1,21 @@
function onSay(player, words, param)
local position = player:getPosition()
local tile = Tile(position)
local house = tile and tile:getHouse()
if house == nil then
player:sendCancelMessage("You are not inside a house.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
if house:getOwnerGuid() ~= player:getGuid() then
player:sendCancelMessage("You are not the owner of this house.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
house:setOwnerGuid(0)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully left your house.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end

View File

@@ -0,0 +1,15 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local lookType = tonumber(param)
if lookType >= 0 and lookType ~= 1 and lookType ~= 135 and lookType ~= 411 and lookType ~= 415 and lookType ~= 424 and (lookType <= 160 or lookType >= 192) and lookType ~= 439 and lookType ~= 440 and lookType ~= 468 and lookType ~= 469 and (lookType < 474 or lookType > 485) and lookType ~= 501 and lookType ~= 518 and lookType ~= 519 and lookType ~= 520 and lookType ~= 524 and lookType ~= 525 and lookType ~= 536 and lookType ~= 543 and lookType ~= 549 and lookType ~= 576 and lookType ~= 581 and lookType ~= 582 and lookType ~= 597 and lookType ~= 616 and lookType ~= 623 and lookType ~= 625 and (lookType <= 637 or lookType >= 644) and (lookType <= 644 or lookType >= 647) and (lookType <= 651 or lookType >= 664) and lookType <= 699 then
local playerOutfit = player:getOutfit()
playerOutfit.lookType = lookType
player:setOutfit(playerOutfit)
else
player:sendCancelMessage("A look type with that id does not exist.")
end
return false
end

View File

@@ -0,0 +1,8 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
player:getPosition():sendMagicEffect(tonumber(param))
return false
end

View File

@@ -0,0 +1,40 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Multiclient Check List:")
local ipList = {}
local players = Game.getPlayers()
for i = 1, #players do
local tmpPlayer = players[i]
local ip = tmpPlayer:getIp()
if ip ~= 0 then
local list = ipList[ip]
if not list then
ipList[ip] = {}
list = ipList[ip]
end
list[#list + 1] = tmpPlayer
end
end
for ip, list in pairs(ipList) do
local listLength = #list
if listLength > 1 then
local tmpPlayer = list[1]
local message = ("%s: %s [%d]"):format(Game.convertIpToString(ip), tmpPlayer:getName(), tmpPlayer:getLevel())
for i = 2, listLength do
tmpPlayer = list[i]
message = ("%s, %s [%d]"):format(message, tmpPlayer:getName(), tmpPlayer:getLevel())
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message .. ".")
end
end
return false
end

View File

@@ -0,0 +1,23 @@
local maxPlayersPerMessage = 10
function onSay(player, words, param)
local hasAccess = player:getGroup():getAccess()
local players = Game.getPlayers()
local onlineList = {}
for _, targetPlayer in ipairs(players) do
if hasAccess or not targetPlayer:isInGhostMode() then
table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
end
end
local playersOnline = #onlineList
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, ("%d players online."):format(playersOnline))
for i = 1, playersOnline, maxPlayersPerMessage do
local j = math.min(i + maxPlayersPerMessage - 1, playersOnline)
local msg = table.concat(onlineList, ", ", i, j) .. "."
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
end
return false
end

View File

@@ -0,0 +1,13 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
Game.setGameState(GAME_STATE_NORMAL)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Server is now open.")
return false
end

View File

@@ -0,0 +1,30 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local tile = Tile(player:getPosition())
local house = tile and tile:getHouse()
if house == nil then
player:sendCancelMessage("You are not inside a house.")
return false
end
if param == "" or param == "none" then
house:setOwnerGuid(0)
return false
end
local targetPlayer = Player(param)
if targetPlayer == nil then
player:sendCancelMessage("Player not found.")
return false
end
house:setOwnerGuid(targetPlayer:getGuid())
return false
end

View File

@@ -0,0 +1,20 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local position = player:getPosition()
local monster = Game.createMonster(param, position)
if monster ~= nil then
monster:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
else
player:sendCancelMessage("There is not enough room.")
position:sendMagicEffect(CONST_ME_POFF)
end
return false
end

View File

@@ -0,0 +1,20 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local position = player:getPosition()
local npc = Game.createNpc(param, position)
if npc ~= nil then
npc:setMasterPos(position)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
else
player:sendCancelMessage("There is not enough room.")
position:sendMagicEffect(CONST_ME_POFF)
end
return false
end

View File

@@ -0,0 +1,20 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local position = player:getPosition()
local monster = Game.createMonster(param, position)
if monster ~= nil then
monster:setMaster(player)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
else
player:sendCancelMessage("There is not enough room.")
position:sendMagicEffect(CONST_ME_POFF)
end
return false
end

View File

@@ -0,0 +1,10 @@
function onSay(player, words, param)
if player:getGroup():getAccess() and param ~= "" then
local split = param:split(",")
player:teleportTo(Position(split[1], split[2], split[3]))
else
local position = player:getPosition()
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your current position is: " .. position.x .. ", " .. position.y .. ", " .. position.z .. ".")
end
return false
end

View File

@@ -0,0 +1,27 @@
function onSay(player, words, param)
if player:getAccountType() <= ACCOUNT_TYPE_TUTOR then
return true
end
local resultId = db.storeQuery("SELECT `name`, `account_id`, (SELECT `type` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `account_type` FROM `players` WHERE `name` = " .. db.escapeString(param))
if resultId == false then
player:sendCancelMessage("A player with that name does not exist.")
return false
end
if result.getDataInt(resultId, "account_type") ~= ACCOUNT_TYPE_TUTOR then
player:sendCancelMessage("You can only demote a tutor to a normal player.")
return false
end
local target = Player(param)
if target ~= nil then
target:setAccountType(ACCOUNT_TYPE_NORMAL)
else
db.query("UPDATE `accounts` SET `type` = " .. ACCOUNT_TYPE_NORMAL .. " WHERE `id` = " .. result.getDataInt(resultId, "account_id"))
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have demoted " .. result.getDataString(resultId, "name") .. " to a normal player.")
result.free(resultId)
return false
end

View File

@@ -0,0 +1,33 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local position = player:getPosition()
position:getNextPosition(player:getDirection())
local tile = Tile(position)
if not tile then
player:sendCancelMessage("Object not found.")
return false
end
local thing = tile:getTopVisibleThing(player)
if not thing then
player:sendCancelMessage("Thing not found.")
return false
end
if thing:isCreature() then
thing:remove()
elseif thing:isItem() then
if thing == tile:getGround() then
player:sendCancelMessage("You may not remove a ground tile.")
return false
end
thing:remove(tonumber(param) or -1)
end
position:sendMagicEffect(CONST_ME_MAGIC_RED)
return false
end

View File

@@ -0,0 +1,8 @@
function onSay(player, words, param)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Server Info:"
.. "\nExp rate: " .. Game.getExperienceStage(player:getLevel())
.. "\nSkill rate: " .. configManager.getNumber(configKeys.RATE_SKILL)
.. "\nMagic rate: " .. configManager.getNumber(configKeys.RATE_MAGIC)
.. "\nLoot rate: " .. configManager.getNumber(configKeys.RATE_LOOT))
return false
end

View File

@@ -0,0 +1,15 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local split = param:split(",")
if split[2] == nil then
player:sendCancelMessage("Insufficient parameters.")
return false
end
player:setStorageValue(tonumber(split[1]), tonumber(split[2]))
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[Storage Value] " .. split[1] .. " changed it's value to " .. split[2] .. ".")
return false
end

View File

@@ -0,0 +1,24 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local creature = Creature(param)
if not creature then
player:sendCancelMessage("A creature with that name could not be found.")
return false
end
local oldPosition = creature:getPosition()
local newPosition = creature:getClosestFreePosition(player:getPosition(), false)
if newPosition.x == 0 then
player:sendCancelMessage("You can not teleport " .. creature:getName() .. ".")
return false
elseif creature:teleportTo(newPosition) then
if not creature:isInGhostMode() then
oldPosition:sendMagicEffect(CONST_ME_POFF)
newPosition:sendMagicEffect(CONST_ME_TELEPORT)
end
end
return false
end

View File

@@ -0,0 +1,8 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
player:teleportTo(player:getTown():getTemplePosition())
return false
end

View File

@@ -0,0 +1,28 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local steps = tonumber(param)
if not steps then
return false
end
local position = player:getPosition()
position:getNextPosition(player:getDirection(), steps)
position = player:getClosestFreePosition(position, false)
if position.x == 0 then
player:sendCancelMessage("You cannot teleport there.")
return false
end
local tile = Tile(position)
if tile == nil or tile:getGround() == nil then
player:sendCancelMessage("You cannot teleport there.")
return false
end
player:teleportTo(position)
return false
end

View File

@@ -0,0 +1,14 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local target = Creature(param)
if target == nil then
player:sendCancelMessage("Creature not found.")
return false
end
player:teleportTo(target:getPosition())
return false
end

View File

@@ -0,0 +1,9 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local split = param:split(",")
local position = {x = split[1], y = split[2], z = split[3]}
return player:teleportTo(position)
end

View File

@@ -0,0 +1,18 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local town = Town(param)
if town == nil then
town = Town(tonumber(param))
end
if town == nil then
player:sendCancelMessage("Town not found.")
return false
end
player:teleportTo(town:getTemplePosition())
return false
end

View File

@@ -0,0 +1,16 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local resultId = db.storeQuery("SELECT `account_id`, `lastip` FROM `players` WHERE `name` = " .. db.escapeString(param))
if resultId == false then
return false
end
db.asyncQuery("DELETE FROM `account_bans` WHERE `account_id` = " .. result.getDataInt(resultId, "account_id"))
db.asyncQuery("DELETE FROM `ip_bans` WHERE `ip` = " .. result.getDataInt(resultId, "lastip"))
result.free(resultId)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, param .. " has been unbanned.")
return false
end

View File

@@ -0,0 +1,17 @@
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local position = player:getPosition()
position.z = position.z - 1
local tile = Tile(position)
if tile == nil or tile:getGround() == nil then
player:sendCancelMessage("You cannot teleport there.")
return false
end
player:teleportTo(position)
return false
end

View File

@@ -0,0 +1,8 @@
function onSay(player, words, param)
local uptime = getWorldUpTime()
local hours = math.floor(uptime / 3600)
local minutes = math.floor((uptime - (3600 * hours)) / 60)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Uptime: " .. hours .. " hours and " .. minutes .. " minutes.")
return false
end