Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Galthen's Satchel and Artefact Box #2149

67 changes: 67 additions & 0 deletions data-otservbr-global/npc/an_idol.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
local internalNpcName = "An Idol"
local npcType = Game.createNpcType(internalNpcName)
local npcConfig = {}

npcConfig.name = internalNpcName
npcConfig.description = internalNpcName

npcConfig.health = 100
npcConfig.maxHealth = npcConfig.health
npcConfig.walkInterval = 0
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookTypeEx = 15894,
}

npcConfig.flags = {
floorchange = false,
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)
local playerId = player:getId()

if not npcHandler:checkInteraction(npc, creature) then
return false
end

if MsgContains(message, "VBOX") or MsgContains(message, "XBOX") then
npcHandler:say("J-T B^C J^BXT°", npc, creature)
player:teleportTo(Position(32366, 32531, 8), false)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local idol = {
elsongabriel marked this conversation as resolved.
Show resolved Hide resolved
{ clickPos = { x = 32398, y = 32509, z = 7 }, destination = Position(32366, 32531, 8) },
}

local anidol = Action()
function anidol.onUse(player, item, fromPosition, target, toPosition, isHotkey)
for i = 1, #idol do
if item:getPosition() == Position(idol[i].clickPos) then
player:teleportTo(idol[i].destination)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end
end
end

for j = 1, #idol do
anidol:position(idol[j].clickPos)
end
anidol:register()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local galthensTree = Action()
function galthensTree.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local hasExhaustion = player:kv():get("galthens-satchel") or 0
if hasExhaustion < os.time() then
local container = player:addItem(36813)
container:addItem(36810, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a galthens satchel.")
player:teleportTo(Position(32396, 32520, 7))
player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
player:kv():set("galthens-satchel", os.time () + 30 * 24 * 60 * 60)
else
player:teleportTo(Position(32396, 32520, 7))
player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Empty.")
end
end

galthensTree:uid(14044)
galthensTree:register()
3 changes: 3 additions & 0 deletions data-otservbr-global/world/otservbr-npc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2986,4 +2986,7 @@
<npc centerx="33710" centery="32602" centerz="6" radius="1">
<npc name="Hawkhurst Ingol" x="0" y="0" z="15" spawntime="60" />
</npc>
<npc centerx="32398" centery="32509" centerz="7" radius="1">
<npc name="An Idol" x="0" y="0" z="15" spawntime="60" />
</npc>
</npcs>
Loading