f15213992
f15213992
local storeItemID = {
-- registered item ids here are not tradable with players
-- these items can be set to moveable at items.xml
-- 300000 charges exercise weapons
32384, -- exercise sword
32385, -- exercise axe
32386, -- exercise club
32387, -- exercise bow
32388, -- exercise rod
32389, -- exercise wand
-- foods
35172, -- roasted wyvern wings
35173, -- carrot pie
35174, -- tropical marinated tiger
35175, -- delicatessen salad
35176, -- chilli con carniphila
35177, -- svargrond salmon filet
35178, -- carrion casserole
35179, -- consecrated beef
35180, -- overcooked noodles
}
local titles = {
{storageID = 14960, title = " Scout"},
{storageID = 14961, title = " Sentinel"},
{storageID = 14962, title = " Steward"},
{storageID = 14963, title = " Warden"},
{storageID = 14964, title = " Squire"},
{storageID = 14965, title = " Warrior"},
{storageID = 14966, title = " Keeper"},
{storageID = 14967, title = " Guardian"},
{storageID = 14968, title = " Sage"},
{storageID = 14969, title = " Tutor"},
{storageID = 14970, title = " Senior Tutor"},
{storageID = 14971, title = " King"},
}
for i = #titles, 1, -1 do
if player:getStorageValue(titles[i].storageID) == 1 then
return titles[i].title
end
end
return false
end
function Player:onBrowseField(position)
return true
end
timeStr = timeStr .. minutes .. ' minutes and '.. seconds .. ' seconds.'
return timeStr
end
if self:getGroup():getAccess() then
if thing:isItem() then
description = string.format("%s\nItem ID: %d", description,
thing:getId())
if thing:isContainer() then
local quickLootCategories = {}
local container = Container(thing.uid)
for categoryId = LOOT_START, LOOT_END do
if container ~= nil then
if container:hasQuickLootCategory(categoryId)
then
table.insert(quickLootCategories,
categoryId)
end
end
end
description = string.format(
"%s\nPosition: %d, %d, %d",
description, position.x, position.y, position.z
)
if thing:isCreature() then
if thing:isPlayer() then
description = string.format("%s\nIP: %s.", description,
Game.convertIpToString(thing:getIp()))
end
end
end
self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
if creature:isPlayer() then
description = string.format("%s\nIP: %s", description,
Game.convertIpToString(creature:getIp()))
end
end
self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
local config = {
maxItemsPerSeconds = 1,
exhaustTime = 2000,
}
pushDelay[cid].items = pushDelay[cid].items + 1
return true
end
-- Loot Analyser
local t = Tile(fromCylinder:getPosition())
local corpse = t:getTopDownItem()
if corpse then
local itemType = corpse:getType()
if itemType:isCorpse() and toPosition.x == CONTAINER_POSITION then
self:sendLootStats(item)
end
end
-- SSA exhaust
local exhaust = { }
if toPosition.x == CONTAINER_POSITION and toPosition.y == CONST_SLOT_NECKLACE
and item:getId() == ITEM_STONE_SKIN_AMULET then
local pid = self:getId()
if exhaust[pid] then
self:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
return false
else
exhaust[pid] = true
addEvent(function() exhaust[pid] = false end, 2000, pid)
return true
end
end
-- Store Inbox
local containerIdFrom = fromPosition.y - 64
local containerFrom = self:getContainerById(containerIdFrom)
if (containerFrom) then
if (containerFrom:getId() == ITEM_STORE_INBOX
and toPosition.y >= 1 and toPosition.y <= 11 and toPosition.y ~= 3)
then
self:sendCancelMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)
return false
end
end
-- Bath tube
local toTile = Tile(toCylinder:getPosition())
local topDownItem = toTile:getTopDownItem()
if topDownItem and table.contains({ BATHTUB_EMPTY, BATHTUB_FILLED },
topDownItem:getId()) then
return false
end
return true
end
if moveItem then
local parent = item:getParent()
if parent:getSize() == parent:getCapacity() then
self:sendTextMessage(MESSAGE_STATUS_SMALL,
Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM))
return false
else
return moveItem:moveTo(parent)
end
end
end
-- Reward System
if toPosition.x == CONTAINER_POSITION then
local containerId = toPosition.y - 64
local container = self:getContainerById(containerId)
if not container then
return true
end
-- Do not let the player insert items into either the Reward Container
or the Reward Chest
local itemId = container:getId()
if itemId == ITEM_REWARD_CONTAINER or itemId == ITEM_REWARD_CHEST then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
-- The player also shouldn't be able to insert items into the boss
corpse
local tileCorpse = Tile(container:getPosition())
for index, value in ipairs(tileCorpse:getItems() or { }) do
if value:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2^31 - 1 and
value:getName() == container:getName() then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
end
end
return true
end
io.output(file)
io.write("------------------------------\n")
io.write("Reported by: " .. name .. "\n")
io.write("Target: " .. targetName .. "\n")
io.write("Type: " .. reportType .. "\n")
io.write("Reason: " .. reportReason .. "\n")
io.write("Comment: " .. comment .. "\n")
if reportType ~= REPORT_TYPE_BOT then
io.write("Translation: " .. translation .. "\n")
end
io.write("------------------------------\n")
io.close(file)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("Thank you for
reporting %s. Your report \z
will be processed by %s team as soon as possible.", targetName,
configManager.getString(configKeys.SERVER_NAME)))
return
end
io.output(file)
io.write("------------------------------\n")
io.write("Name: " .. name)
if category == BUG_CATEGORY_MAP then
io.write(" [Map position: " .. position.x .. ", " .. position.y .. ", "
.. position.z .. "]")
end
local playerPosition = self:getPosition()
io.write(" [Player Position: " .. playerPosition.x .. ", " ..
playerPosition.y .. ", " .. playerPosition.z .. "]\n")
io.write("Comment: " .. message .. "\n")
io.close(file)
self:sendTextMessage(MESSAGE_EVENT_DEFAULT,
"Your report has been sent to " ..
configManager.getString(configKeys.SERVER_NAME) .. ".")
return true
end
function Player:onTurn(direction)
if self:getGroup():getAccess() and self:getDirection() == direction then
local nextPosition = self:getPosition()
nextPosition:getNextPosition(direction)
self:teleportTo(nextPosition, true)
end
return true
end
if isInArray(storeItemID,item.itemid) then
return false
end
return true
end
-- Soul regeneration
local vocation = self:getVocation()
if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
soulCondition:setParameter(CONDITION_PARAM_SOULTICKS,
vocation:getSoulGainTicks() * 1000)
self:addCondition(soulCondition)
end
-- Prey Bonus
for slot = CONST_PREY_SLOT_FIRST, CONST_PREY_SLOT_THIRD do
if (self:getPreyCurrentMonster(slot) == source:getName()
and self:getPreyBonusType(slot) == CONST_BONUS_XP_BONUS) then
exp = exp + math.floor(exp * (self:getPreyBonusValue(slot) /
100))
break
end
if (self:getPreyTimeLeft(slot) / 60) > 0 then
preyTimeLeft(self, slot) -- slot consumption, outside of the
mosnter check
end
end
-- Store Bonus
useStaminaXp(self) -- Use store boost stamina
self:setStoreXpBoost(storeXpBoostAmount)
-- Stamina Bonus
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
useStamina(self)
local staminaMinutes = self:getStamina()
if staminaMinutes > 2400 and self:isPremium() then
exp = exp * 1.5
self:setStaminaXpBoost(150)
elseif staminaMinutes <= 840 then
exp = exp * 0.5 --TODO destroy loot of people with 840- stamina
self:setStaminaXpBoost(50)
else
self:setStaminaXpBoost(100)
end
end
self:setBaseXpGain(displayRate * 100)
return exp
end
function Player:onLoseExperience(exp)
return exp
end
function Player:onRemoveCount(item)
self:sendWaste(item:getId())
end
function Player:onRequestQuestLog()
self:sendQuestLog()
end
function Player:onRequestQuestLine(questId)
self:sendQuestLine(questId)
end
return true
end
-- Removing items
for _, pid in pairs(imbuement:getItems()) do
if not self:removeItem(pid.itemid, pid.count) then
self:sendImbuementResult(MESSAGEDIALOG_IMBUEMENT_ROLL_FAILED,
"You don't have all necessary items.")
return false
end
end
-- Update item
local nitem = Item(item.uid)
self:sendImbuementPanel(nitem)
return true
end
-- Update item
local nitem = Item(item.uid)
self:sendImbuementResult(MESSAGEDIALOG_CLEARING_CHARM_SUCCESS,
"Congratulations! You have successfully applied the clearing charm to
your item.");
self:sendImbuementPanel(nitem)
return true
end