1 QuestHelper_File
["teleport.lua"] = "Development Version"
2 QuestHelper_Loadtime
["teleport.lua"] = GetTime()
4 function QuestHelper
:CreateTeleportInfo()
5 local info
= self
:CreateTable()
6 info
.node
= self
:CreateTable()
7 info
.reag
= self
:CreateTable()
11 function QuestHelper
:ReleaseTeleportInfo(info
)
12 for _
, data
in pairs(info
.node
) do
13 self
:ReleaseTable(data
)
16 self
:ReleaseTable(info
.node
)
17 self
:ReleaseTable(info
.reag
)
18 self
:ReleaseTable(info
)
21 function QuestHelper
:TeleportInfoClear(info
)
22 for node
, data
in pairs(info
.node
) do
23 self
:ReleaseTable(data
)
27 for id
in pairs(info
.reag
) do
32 function QuestHelper
:SetTeleportInfoTarget(info
,
33 node
, -- The world graph node this will take us to.
34 start
, -- The last time this spell was used.
35 duration
, -- How long the spell cooldown is.
36 cast
, -- How long does the spell take to cast.
37 reagent_id
) -- What reagent is consumed by using the spell (can be nil)
38 local data
= info
.node
[node
]
39 if not data
then data
= self
:CreateTable() info
.node
[node
] = data
end
41 data
[1], data
[2], data
[3], data
[4] = start
, duration
, cast
, reagent_id
44 function QuestHelper
:SetTeleportInfoReagent(info
, reagent_id
, count
)
46 info
.reag
[reagent_id
] = count
48 info
.reag
[reagent_id
] = nil
52 function QuestHelper
:TeleportInfoUseNode(info
, node
, time_delta
)
53 local data
= info
.node
[node
]
55 self
:TextOut("Used "..(node
.name
or "unnamed node").." in path.")
57 data
[1] = GetTime()+time_delta
59 local count
= info
.reag
[data
[3]]
or 0
62 info
.reag
[data
[4]]
= count
64 info
.reag
[data
[4]]
= nil
70 function QuestHelper
:TeleportInfoTransfer(original
, dest
)
71 for key
in pairs(dest
.node
) do
72 if not original
.node
[key
] then
73 self
:ReleaseTable(dest
.node
[key
])
78 for key
, data
in pairs(original
.node
) do
79 local data2
= dest
.node
[key
]
81 data2
= self
:CreateTable()
82 dest
.node
[key
] = data2
84 data2
[1], data2
[2], data2
[3], data2
[4] = data
[1], data
[2], data
[3], data
[4]
87 for key
in pairs(dest
.reag
) do
88 if not original
.reag
[key
] then
93 for key
, value
in pairs(original
.reag
) do
94 dest
.reag
[key
] = value
98 function QuestHelper
:TeleportInfoAddGraphPoints(info
, graph
, end_list
, time_delta
)
99 for node
, data
in pairs(info
.node
) do
100 if data
[1]+data
[2] >= time_delta
+GetTime() and (not data
[4] or (data
[4] and info
.reag
[data
[4]]
)) then
101 self
:TextOut("Considering "..(node
.name
or "unnamed node").." for use in pathing.")
102 graph
:AddStartNode(node
, data
[3], end_list
)
107 QuestHelper
.teleport_info
= QuestHelper
:CreateTeleportInfo()