-
-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'opentibiabr:main' into Nyedson-patch-2
- Loading branch information
Showing
6 changed files
with
132 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
data-otservbr-global/scripts/actions/addons/afflicted_outfit.lua
This file was deleted.
Oops, something went wrong.
120 changes: 20 additions & 100 deletions
120
data-otservbr-global/scripts/actions/quests/secret_library/brokul_lever.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,23 @@ | ||
bossConfig = { | ||
[34000] = { -- ActionID | ||
requiredLevel = 150, | ||
minPlayersRequired = 1, | ||
|
||
boss = "Brokul", | ||
bossGlobalStorage = 35000, | ||
playerStorage = 36000, | ||
teleportPosition = Position(33483, 31445, 15), | ||
centerRoomPosition = Position(33483, 31439, 15), | ||
northRange = 15, | ||
eastRange = 15, | ||
southRange = 15, | ||
westRange = 15, | ||
exit = Position(33522, 31468, 15), | ||
bossPosition = Position(33483, 31434, 15), | ||
time = 15, | ||
|
||
playerPositions = { | ||
[1] = Position(33520, 31465, 15), | ||
[2] = Position(33521, 31465, 15), | ||
[3] = Position(33522, 31465, 15), | ||
[4] = Position(33523, 31465, 15), | ||
[5] = Position(33524, 31465, 15), | ||
}, | ||
local config = { | ||
boss = { | ||
name = "Brokul", | ||
position = Position(33483, 31434, 15), | ||
}, | ||
requiredLevel = 150, | ||
playerPositions = { | ||
{ pos = Position(33522, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33520, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33521, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33523, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33524, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, | ||
}, | ||
specPos = { | ||
from = Position(33469, 31430, 15), | ||
to = Position(33497, 31453, 15), | ||
}, | ||
exit = Position(33522, 31468, 15), | ||
} | ||
|
||
local function resetBoss(bossConfig, bossId) | ||
local monster = Monster(bossId) | ||
if monster then | ||
monster:remove() | ||
end | ||
local spectators = Game.getSpectators(bossConfig.centerRoomPosition, false, true, bossConfig.westRange, bossConfig.eastRange, bossConfig.northRange, bossConfig.southRange) | ||
for i = 1, #spectators do | ||
spectators[i]:teleportTo(bossConfig.exit) | ||
end | ||
end | ||
|
||
local secretBrokul = Action() | ||
function secretBrokul.onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
if item.itemid == 2773 then | ||
local bossConfig = bossConfig[item:getActionId()] | ||
if not bossConfig then | ||
return false | ||
end | ||
|
||
if getGlobalStorageValue(bossConfig.bossGlobalStorage) > 0 then | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There is already a team inside. Please wait.") | ||
return true | ||
end | ||
|
||
local errorMsg | ||
local rPlayers = {} | ||
for index, ipos in pairs(bossConfig.playerPositions) do | ||
local playerTile = Tile(ipos):getTopCreature() | ||
if playerTile then | ||
if playerTile:isPlayer() then | ||
if playerTile:getLevel() >= bossConfig.requiredLevel then | ||
if playerTile:getStorageValue(bossConfig.playerStorage) <= os.time() then | ||
table.insert(rPlayers, playerTile:getId()) | ||
else | ||
errorMsg = "One or more players have already entered in the last 20 hours." | ||
end | ||
else | ||
errorMsg = "All the players need to be level " .. bossConfig.requiredLevel .. " or higher." | ||
end | ||
end | ||
end | ||
end | ||
|
||
if #rPlayers >= bossConfig.minPlayersRequired then | ||
for _, pid in pairs(rPlayers) do | ||
local rplayer = Player(pid) | ||
if rplayer:isPlayer() then | ||
rplayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, ("You have %o minutes before you get kicked out."):format(bossConfig.time)) | ||
bossConfig.playerPositions[_]:sendMagicEffect(CONST_ME_POFF) | ||
rplayer:teleportTo(bossConfig.teleportPosition) | ||
rplayer:setStorageValue(bossConfig.playerStorage, os.time() + (configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN))) | ||
bossConfig.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA) | ||
rplayer:setDirection(DIRECTION_NORTH) | ||
end | ||
end | ||
setGlobalStorageValue(bossConfig.bossGlobalStorage, 1) | ||
addEvent(setGlobalStorageValue, bossConfig.time * 60 * 1000, bossConfig.bossGlobalStorage, 0) | ||
local monster = Game.createMonster(bossConfig.boss, bossConfig.bossPosition) | ||
addEvent(resetBoss, bossConfig.time * 60 * 1000, bossConfig, monster and monster.uid or 0) | ||
else | ||
if not errorMsg then | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, ("You need %u players."):format(bossConfig.minPlayersRequired)) | ||
else | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, errorMsg) | ||
end | ||
return true | ||
end | ||
end | ||
item:transform(item.itemid == 2773 and 2772 or 2773) | ||
|
||
return true | ||
end | ||
|
||
secretBrokul:aid(34000) | ||
secretBrokul:register() | ||
local lever = BossLever(config) | ||
lever:aid(34000) | ||
lever:register() |
95 changes: 17 additions & 78 deletions
95
...-otservbr-global/scripts/quests/kilmaresh/1-fafnars-wrath/3-urmahlullu-the-immaculate.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,23 @@ | ||
-- lever to urmahlullu room | ||
|
||
local config = { | ||
boss = { | ||
name = "Urmahlullu the Immaculate", | ||
position = Position(33918, 31641, 8), | ||
}, | ||
requiredLevel = 100, | ||
daily = true, | ||
roomCenterPosition = Position(33919, 31648, 8), | ||
playerPositions = { | ||
Position(33918, 31626, 8), | ||
Position(33919, 31626, 8), | ||
Position(33920, 31626, 8), | ||
Position(33921, 31626, 8), | ||
Position(33922, 31626, 8), | ||
{ pos = Position(33918, 31626, 8), teleport = Position(33918, 31657, 8), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33919, 31626, 8), teleport = Position(33918, 31657, 8), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33920, 31626, 8), teleport = Position(33918, 31657, 8), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33921, 31626, 8), teleport = Position(33918, 31657, 8), effect = CONST_ME_TELEPORT }, | ||
{ pos = Position(33922, 31626, 8), teleport = Position(33918, 31657, 8), effect = CONST_ME_TELEPORT }, | ||
}, | ||
teleportPosition = Position(33918, 31657, 8), | ||
bossPosition = Position(33918, 31641, 8), | ||
bossName = "Urmahlullu the Immaculate", | ||
specPos = { | ||
from = Position(33905, 31636, 8), | ||
to = Position(33932, 31667, 8), | ||
}, | ||
exit = Position(33919, 31603, 8), | ||
} | ||
|
||
local leverboss = Action() | ||
|
||
function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
if item.itemid == 8911 then | ||
-- Check if the player that pulled the lever is on the correct position | ||
if player:getPosition() ~= config.playerPositions[1] then | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can't start the battle.") | ||
return true | ||
end | ||
|
||
local team, participant = {} | ||
|
||
for i = 1, #config.playerPositions do | ||
participant = Tile(config.playerPositions[i]):getTopCreature() | ||
|
||
-- Check there is a participant player | ||
if participant and participant:isPlayer() then | ||
-- Check participant level | ||
if participant:getLevel() < config.requiredLevel then | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "All the players need to be level " .. config.requiredLevel .. " or higher.") | ||
return true | ||
end | ||
|
||
-- Check participant boss timer | ||
if config.daily and not participant:canFightBoss(config.bossName) then | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
player:sendCancelMessage("Not all players are ready yet from last battle.") | ||
return true | ||
end | ||
|
||
team[#team + 1] = participant | ||
end | ||
end | ||
|
||
-- Check if a team currently inside the boss room | ||
local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13) | ||
for i = 1, #specs do | ||
spec = specs[i] | ||
if spec:isPlayer() then | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.") | ||
return true | ||
end | ||
|
||
spec:remove() | ||
end | ||
|
||
-- Spawn boss | ||
Game.createMonster("Urmahlullu the Immaculate", config.bossPosition) | ||
|
||
-- Teleport team participants | ||
for i = 1, #team do | ||
team[i]:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
team[i]:teleportTo(config.teleportPosition) | ||
-- Assign boss timer | ||
team[i]:setBossCooldown(config.bossName, os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) -- 20 hours | ||
end | ||
|
||
config.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA) | ||
end | ||
|
||
item:transform(8911) | ||
return true | ||
end | ||
|
||
leverboss:uid(9545) | ||
leverboss:register() | ||
local lever = BossLever(config) | ||
lever:uid(9545) | ||
lever:register() |
57 changes: 57 additions & 0 deletions
57
data/scripts/actions/items/usable_afflicted_outfit_items.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
local usableAfflictedOutfitItems = Action() | ||
|
||
function usableAfflictedOutfitItems.onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
if not player:isPremium() then | ||
player:sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT) | ||
return true | ||
end | ||
|
||
local outfitId = player:getSex() == PLAYERSEX_FEMALE and 431 or 430 | ||
if item.itemid == 12786 then | ||
if not player:hasOutfit(outfitId) or player:hasOutfit(outfitId, 2) then | ||
return true | ||
end | ||
|
||
player:addOutfitAddon(430, 2) | ||
player:addOutfitAddon(431, 2) | ||
player:say("You gained a plague mask for your outfit.", TALKTYPE_MONSTER_SAY, false, player) | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
player:addAchievementProgress("Beak Doctor", 2) | ||
item:remove() | ||
elseif item.itemid == 12787 then | ||
if not player:hasOutfit(outfitId) or player:hasOutfit(outfitId, 1) then | ||
return true | ||
end | ||
|
||
player:addOutfitAddon(430, 1) | ||
player:addOutfitAddon(431, 1) | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
player:say("You gained a plague bell for your outfit.", TALKTYPE_MONSTER_SAY, false, player) | ||
player:addAchievementProgress("Beak Doctor", 2) | ||
item:remove() | ||
else | ||
if player:hasOutfit(outfitId) then | ||
return true | ||
end | ||
|
||
local requiredItemIds = { 12551, 12552, 12553, 12554, 12555, 12556 } | ||
for _, itemId in ipairs(requiredItemIds) do | ||
if player:getItemCount(itemId) < 1 then | ||
return true | ||
end | ||
end | ||
|
||
for _, itemId in ipairs(requiredItemIds) do | ||
player:removeItem(itemId, 1) | ||
end | ||
|
||
player:addOutfit(430) | ||
player:addOutfit(431) | ||
player:say("You have restored an outfit.", TALKTYPE_MONSTER_SAY, false, player) | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
end | ||
return true | ||
end | ||
|
||
usableAfflictedOutfitItems:id(12551, 12552, 12553, 12554, 12555, 12556, 12786, 12787) | ||
usableAfflictedOutfitItems:register() |
Oops, something went wrong.