mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-13 22:34:53 +02:00
introduce svargrond arena quest
This commit is contained in:
35
data/movements/scripts/svargrond_arena/arenaEnter.lua
Normal file
35
data/movements/scripts/svargrond_arena/arenaEnter.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
function onStepIn(creature, item, position, fromPosition)
|
||||
local player = creature:getPlayer()
|
||||
if not player then
|
||||
return true
|
||||
end
|
||||
|
||||
local pitId = player:getStorageValue(1101)
|
||||
if pitId < 1 or pitId > 10 then
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You cannot enter without Halvar\'s permission.')
|
||||
player:teleportTo(fromPosition)
|
||||
return true
|
||||
end
|
||||
|
||||
local arenaId = player:getStorageValue(1100)
|
||||
if not(PITS[pitId] and ARENA[arenaId]) then
|
||||
player:teleportTo(fromPosition)
|
||||
return true
|
||||
end
|
||||
|
||||
local occupant = SvargrondArena.getPitOccupant(pitId, player)
|
||||
if occupant then
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, occupant:getName() .. ' is currently in the next arena pit. Please wait until ' .. (occupant:getSex() == PLAYERSEX_FEMALE and 's' or '') .. 'he is done fighting.')
|
||||
player:teleportTo(fromPosition)
|
||||
return true
|
||||
end
|
||||
|
||||
SvargrondArena.resetPit(pitId)
|
||||
SvargrondArena.scheduleKickPlayer(player.uid, pitId)
|
||||
Game.createMonster(ARENA[arenaId].creatures[pitId], PITS[pitId].summon, false, true)
|
||||
|
||||
player:teleportTo(PITS[pitId].center)
|
||||
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
|
||||
player:say('FIGHT!', TALKTYPE_MONSTER_SAY)
|
||||
return true
|
||||
end
|
65
data/movements/scripts/svargrond_arena/arenaPit.lua
Normal file
65
data/movements/scripts/svargrond_arena/arenaPit.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local condition = Condition(CONDITION_OUTFIT)
|
||||
condition:setTicks(120000)
|
||||
condition:setOutfit({lookType = 111})
|
||||
|
||||
function onStepIn(creature, item, position, fromPosition)
|
||||
local player = creature:getPlayer()
|
||||
if not player then
|
||||
return true
|
||||
end
|
||||
|
||||
local playerId = player.uid
|
||||
if item:getMovementId() == 25300 then
|
||||
player:addCondition(condition)
|
||||
|
||||
player:setStorageValue(1101, 0)
|
||||
player:teleportTo(SvargrondArena.kickPosition)
|
||||
player:say('Coward!', TALKTYPE_MONSTER_SAY)
|
||||
SvargrondArena.cancelEvents(playerId)
|
||||
return true
|
||||
end
|
||||
|
||||
local pitId = player:getStorageValue(1101)
|
||||
local arenaId = player:getStorageValue(1100)
|
||||
if pitId > 10 then
|
||||
player:teleportTo(SvargrondArena.rewardPosition)
|
||||
player:setStorageValue(1101, 0)
|
||||
|
||||
if arenaId == 1 then
|
||||
SvargrondArena.rewardPosition:sendMagicEffect(CONST_ME_FIREWORK_BLUE)
|
||||
player:setStorageValue(26100, 1)
|
||||
player:say('Welcome back, little hero!', TALKTYPE_MONSTER_SAY)
|
||||
elseif arenaId == 2 then
|
||||
SvargrondArena.rewardPosition:sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
|
||||
player:setStorageValue(27100, 1)
|
||||
player:say('Congratulations, brave warrior!', TALKTYPE_MONSTER_SAY)
|
||||
elseif arenaId == 3 then
|
||||
SvargrondArena.rewardPosition:sendMagicEffect(CONST_ME_FIREWORK_RED)
|
||||
player:setStorageValue(28100, 1)
|
||||
player:say('Respect and honour to you, champion!', TALKTYPE_MONSTER_SAY)
|
||||
end
|
||||
|
||||
player:setStorageValue(1100, player:getStorageValue(1100) + 1)
|
||||
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You completed ' .. ARENA[arenaId].name .. ' arena, you should take your reward now.')
|
||||
player:setStorageValue(ARENA[arenaId].questLog, 2)
|
||||
SvargrondArena.cancelEvents(playerId)
|
||||
return true
|
||||
end
|
||||
|
||||
local occupant = SvargrondArena.getPitOccupant(pitId, player)
|
||||
if occupant then
|
||||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, occupant:getName() .. ' is currently in the next arena pit. Please wait until ' .. (occupant:getSex() == PLAYERSEX_FEMALE and 's' or '') .. 'he is done fighting.')
|
||||
player:teleportTo(fromPosition, true)
|
||||
return true
|
||||
end
|
||||
|
||||
SvargrondArena.cancelEvents(playerId)
|
||||
SvargrondArena.resetPit(pitId)
|
||||
SvargrondArena.scheduleKickPlayer(playerId, pitId)
|
||||
Game.createMonster(ARENA[arenaId].creatures[pitId], PITS[pitId].summon, false, true)
|
||||
|
||||
player:teleportTo(PITS[pitId].center)
|
||||
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
|
||||
player:say('Fight!', TALKTYPE_MONSTER_SAY)
|
||||
return true
|
||||
end
|
25
data/movements/scripts/svargrond_arena/arenaTrophy.lua
Normal file
25
data/movements/scripts/svargrond_arena/arenaTrophy.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
function onStepIn(creature, item, position, fromPosition)
|
||||
if not creature:isPlayer() then
|
||||
return true
|
||||
end
|
||||
|
||||
local arenaId = item:getMovementId() - 23200
|
||||
if arenaId >= creature:getStorageValue(1100) then
|
||||
return true
|
||||
end
|
||||
|
||||
local cStorage = ARENA[arenaId].reward.trophyStorage
|
||||
if creature:getStorageValue(cStorage) ~= 1 then
|
||||
local rewardPosition = creature:getPosition()
|
||||
rewardPosition.y = rewardPosition.y - 1
|
||||
|
||||
local rewardItem = Game.createItem(ARENA[arenaId].reward.trophy, 1, rewardPosition)
|
||||
if rewardItem then
|
||||
rewardItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, string.format(ARENA[arenaId].reward.desc, creature:getName()))
|
||||
end
|
||||
|
||||
creature:setStorageValue(cStorage, 1)
|
||||
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
|
||||
end
|
||||
return true
|
||||
end
|
16
data/movements/scripts/svargrond_arena/back.lua
Normal file
16
data/movements/scripts/svargrond_arena/back.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
function onStepIn(creature, item, position, fromPosition)
|
||||
local player = creature:getPlayer()
|
||||
if not player then
|
||||
return true
|
||||
end
|
||||
|
||||
doRelocate(item:getPosition(),{x = 32222, y = 31094, z = 07})
|
||||
item:getPosition():sendMagicEffect(11)
|
||||
Game.sendMagicEffect({x = 32222, y = 31094, z = 07}, 11)
|
||||
end
|
||||
|
||||
function onAddItem(item, tileitem, position)
|
||||
doRelocate(item:getPosition(),{x = 32222, y = 31094, z = 07})
|
||||
item:getPosition():sendMagicEffect(11)
|
||||
Game.sendMagicEffect({x = 32222, y = 31094, z = 07}, 11)
|
||||
end
|
Reference in New Issue
Block a user