mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 06:34:55 +02:00
Resolve "Merge the best from 7.40 branch"
This commit is contained in:
@@ -45,7 +45,71 @@ function onUse(player, item, fromPosition, target, toPosition)
|
||||
end
|
||||
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found " .. rewardName .. ".")
|
||||
player:addItemEx(reward:clone(), true)
|
||||
|
||||
local attackAttribute = math.random(-2, 5)
|
||||
local rewardClone = reward:clone()
|
||||
if rewardClone:getType():getAttack() > 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_ATTACK, rewardClone:getType():getAttack() + attackAttribute)
|
||||
local description = rewardClone:hasAttribute(ITEM_ATTRIBUTE_DESCRIPTION) and rewardClone:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION) or rewardClone:getType():getDescription()
|
||||
if description ~= nil and description ~= '' then
|
||||
description = description .. ". "
|
||||
end
|
||||
|
||||
if attackAttribute == 5 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. "Enchanted with perfect attack.")
|
||||
else
|
||||
if attackAttribute ~= 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. "Enchanted with " .. attackAttribute .. " attack.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local defenseAttribute = math.random(-2, 5)
|
||||
if rewardClone:getType():getDefense() > 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DEFENSE, rewardClone:getType():getDefense() + defenseAttribute)
|
||||
local description = rewardClone:hasAttribute(ITEM_ATTRIBUTE_DESCRIPTION) and rewardClone:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION) or rewardClone:getType():getDescription()
|
||||
|
||||
if rewardClone:getType():getAttack() > 0 and attackAttribute ~= 0 then
|
||||
if defenseAttribute == 5 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. " Enchanted with perfect defense.")
|
||||
else
|
||||
if defenseAttribute ~= 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. " Enchanted with " .. defenseAttribute .. " defense.")
|
||||
end
|
||||
end
|
||||
else
|
||||
if description ~= nil and description ~= '' then
|
||||
description = description .. ". "
|
||||
end
|
||||
|
||||
if defenseAttribute == 5 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. "Enchanted with perfect defense.")
|
||||
else
|
||||
if defenseAttribute ~= 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. "Enchanted with " .. defenseAttribute .. " defense.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local armorAttribute = math.random(-1, 2)
|
||||
if rewardClone:getType():getArmor() > 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_ARMOR, rewardClone:getType():getArmor() + armorAttribute)
|
||||
local description = rewardClone:hasAttribute(ITEM_ATTRIBUTE_DESCRIPTION) and rewardClone:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION) or rewardClone:getType():getDescription()
|
||||
if description ~= nil and description ~= '' then
|
||||
description = description .. ". "
|
||||
end
|
||||
|
||||
if armorAttribute == 2 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. "Enchanted with perfect armor protection.")
|
||||
else
|
||||
if armorAttribute ~= 0 then
|
||||
rewardClone:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, description .. "Enchanted with " .. armorAttribute .. " armor protection.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
player:addItemEx(rewardClone, true)
|
||||
player:setStorageValue(chestQuestNumber, 1)
|
||||
return true
|
||||
end
|
||||
|
@@ -19,18 +19,15 @@ function onUse(player, item, fromPosition, target, toPosition)
|
||||
end
|
||||
|
||||
if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
|
||||
if player:getItemCount(3492) >= 1 then
|
||||
player:addSkillTries(SKILL_FISHING, 1)
|
||||
if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
|
||||
player:addItem(3578, 1)
|
||||
|
||||
if target:getId() ~= 622 then
|
||||
target:transform(4609, 1)
|
||||
end
|
||||
|
||||
target:decay()
|
||||
player:removeItem(3492, 1)
|
||||
player:addSkillTries(SKILL_FISHING, 1)
|
||||
if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
|
||||
player:addItem(3578, 1)
|
||||
|
||||
if target:getId() ~= 622 then
|
||||
target:transform(4609, 1)
|
||||
end
|
||||
|
||||
target:decay()
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -35,6 +35,18 @@ function onUse(player, item, fromPosition, target, toPosition)
|
||||
end
|
||||
end
|
||||
|
||||
if (configManager.getBoolean(configKeys.UH_TRAP)) then
|
||||
local tile = Tile(toPosition)
|
||||
local creature = tile:getBottomCreature()
|
||||
if creature and creature:isPlayer() then
|
||||
target = creature
|
||||
end
|
||||
else
|
||||
-- monsters do not use mana also I do not know if you can use life fluid on monsters
|
||||
-- if you can just want to use life fluids on monster then change isPlayer to isCreature
|
||||
target = target:isPlayer() and target
|
||||
end
|
||||
|
||||
if target:isCreature() and target:getPlayer() ~= nil then
|
||||
if item:getFluidType() == FLUID_NONE then
|
||||
player:sendCancelMessage("It is empty.")
|
||||
@@ -68,7 +80,12 @@ function onUse(player, item, fromPosition, target, toPosition)
|
||||
else
|
||||
target:say("Gulp.", TALKTYPE_MONSTER_SAY)
|
||||
end
|
||||
item:transform(item:getId(), FLUID_NONE)
|
||||
|
||||
if player:getStorageValue(17742) ~= 1 then
|
||||
item:transform(item:getId(), FLUID_NONE)
|
||||
else
|
||||
item:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if toPosition.x == CONTAINER_POSITION then
|
||||
|
@@ -8,39 +8,69 @@ local holeSpots = {
|
||||
595, 607, 609, 610, 615, 1066, 1067, 1080
|
||||
}
|
||||
|
||||
local pools = {2886, 2887, 2888, 2889, 2890, 2891, 2895, 2896, 2897, 2898, 2899, 2900}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local tile = Tile(toPosition)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
if not tile:getGround() then
|
||||
return false
|
||||
end
|
||||
|
||||
if table.contains(ropeSpots, tile:getGround():getId()) then
|
||||
player:teleportTo(target:getPosition():moveRel(0, 1, -1))
|
||||
if (configManager.getBoolean(configKeys.ROPE_SPOT_BLOCK)) then
|
||||
-- Rope for 7.4 protocol.
|
||||
local newPos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
|
||||
local groundItem = getThingfromPos(newPos)
|
||||
local blockingItem = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 255})
|
||||
if table.contains(ropeSpots, groundItem.itemid) then
|
||||
newPos.y = newPos.y + 1
|
||||
newPos.z = newPos.z - 1
|
||||
if((blockingItem.itemid > 0 and not isInArray(pools, blockingItem.itemid)) or isCreature(blockingItem.uid)) then
|
||||
doPlayerSendCancel(player, "You cannot use this object.")
|
||||
else
|
||||
doTeleportThing(player, newPos)
|
||||
end
|
||||
elseif table.contains(holeSpots, groundItem.itemid) then
|
||||
newPos.y = newPos.y + 1
|
||||
local downPos = {x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 255}
|
||||
local downItem = getThingfromPos(downPos)
|
||||
if(downItem.itemid > 0) then
|
||||
doTeleportThing(downItem.uid, newPos)
|
||||
else
|
||||
doPlayerSendCancel(player, "You cannot use this object.")
|
||||
end
|
||||
end
|
||||
return true
|
||||
elseif table.contains(holeSpots, tile:getGround():getId()) or target:getId() == 435 then
|
||||
local tile = Tile(target:getPosition():moveRel(0, 0, 1))
|
||||
else
|
||||
local tile = Tile(toPosition)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
local thing = tile:getTopCreature()
|
||||
if not thing then
|
||||
thing = tile:getTopVisibleThing()
|
||||
if not tile:getGround() then
|
||||
return false
|
||||
end
|
||||
|
||||
if thing:isCreature() then
|
||||
thing:teleportTo(target:getPosition():moveRel(0, 1, 0), false)
|
||||
if table.contains(ropeSpots, tile:getGround():getId()) then
|
||||
player:teleportTo(target:getPosition():moveRel(0, 1, -1))
|
||||
return true
|
||||
elseif table.contains(holeSpots, tile:getGround():getId()) or target:getId() == 435 then
|
||||
local tile = Tile(target:getPosition():moveRel(0, 0, 1))
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
local thing = tile:getTopCreature()
|
||||
if not thing then
|
||||
thing = tile:getTopVisibleThing()
|
||||
end
|
||||
|
||||
if thing:isCreature() then
|
||||
thing:teleportTo(target:getPosition():moveRel(0, 1, 0), false)
|
||||
return true
|
||||
end
|
||||
if thing:isItem() and thing:getType():isMovable() then
|
||||
thing:moveTo(target:getPosition():moveRel(0, 1, 0))
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
if thing:isItem() and thing:getType():isMovable() then
|
||||
thing:moveTo(target:getPosition():moveRel(0, 1, 0))
|
||||
return true
|
||||
end
|
||||
return true
|
||||
return false
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
@@ -1,6 +1,6 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
||||
if player:getStorageValue(17582) < os.time() then
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your experience earnings have been enchanted by the Sabrehaven Gods.")
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your experience earnings have been enchanted by the Tibianus Gods.")
|
||||
player:setStorageValue(17582, os.time() + 24 * 60 * 60) -- 24 hour
|
||||
item:remove(1)
|
||||
else
|
||||
|
15
data/actions/scripts/misc/shop_points_scroll.lua
Normal file
15
data/actions/scripts/misc/shop_points_scroll.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local hundredPoints = 6554
|
||||
local fiftyPoints = 6555
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
if item:getId() == hundredPoints then
|
||||
db.query("UPDATE znote_accounts SET points = points + 100 WHERE account_id = ".. player:getAccountId() .."")
|
||||
elseif item:getId() == fiftyPoints then
|
||||
db.query("UPDATE znote_accounts SET points = points + 50 WHERE account_id = ".. player:getAccountId() .."")
|
||||
end
|
||||
|
||||
item:getPosition():sendMagicEffect(3)
|
||||
item:remove()
|
||||
player:save()
|
||||
return true
|
||||
end
|
@@ -7,24 +7,24 @@ local statues = {
|
||||
}
|
||||
|
||||
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
||||
local skill = statues[item:getActionId()]
|
||||
if not player:isPremium() then
|
||||
player:sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT)
|
||||
return true
|
||||
end
|
||||
-- local skill = statues[item:getActionId()]
|
||||
-- if not player:isPremium() then
|
||||
-- player:sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT)
|
||||
-- return true
|
||||
-- end
|
||||
|
||||
if player:isPzLocked() then
|
||||
return false
|
||||
end
|
||||
-- if player:isPzLocked() then
|
||||
-- return false
|
||||
-- end
|
||||
|
||||
local entreePrice = 1000
|
||||
if player:getBankBalance() < entreePrice then
|
||||
player:sendCancelMessage("You do not have 1000 gold coins in your bank account balance to participate in offline training.")
|
||||
return true
|
||||
end
|
||||
-- local entreePrice = 1000
|
||||
-- if player:getBankBalance() < entreePrice then
|
||||
-- player:sendCancelMessage("You do not have 1000 gold coins in your bank account balance to participate in offline training.")
|
||||
-- return true
|
||||
-- end
|
||||
|
||||
player:setOfflineTrainingSkill(skill)
|
||||
player:setBankBalance(player:getBankBalance() - entreePrice)
|
||||
player:remove()
|
||||
-- player:setOfflineTrainingSkill(skill)
|
||||
-- player:setBankBalance(player:getBankBalance() - entreePrice)
|
||||
-- player:remove()
|
||||
return true
|
||||
end
|
||||
|
Reference in New Issue
Block a user