mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Merge remote-tracking branch 'origin/ioncannon/quest_system' into Jorge/quest_system
This commit is contained in:
commit
7fea45e1f8
@ -40,7 +40,7 @@ function onTrigger(player, argc, command, var1, var2, var3)
|
|||||||
|
|
||||||
elseif command == "remove" or command == "delete" or command == "-" then
|
elseif command == "remove" or command == "delete" or command == "-" then
|
||||||
if tonumber(var1) and player:HasQuest(tonumber(var1)) == true then
|
if tonumber(var1) and player:HasQuest(tonumber(var1)) == true then
|
||||||
player:RemoveQuestByQuestId(tonumber(var1));
|
player:RemoveQuest(tonumber(var1));
|
||||||
message = ("removing quest "..var1);
|
message = ("removing quest "..var1);
|
||||||
else
|
else
|
||||||
if player:HasQuest(var1) == true then
|
if player:HasQuest(var1) == true then
|
||||||
@ -53,7 +53,7 @@ function onTrigger(player, argc, command, var1, var2, var3)
|
|||||||
q4 = bit32.band(q3, 0xA0F00000);
|
q4 = bit32.band(q3, 0xA0F00000);
|
||||||
printf(q4);
|
printf(q4);
|
||||||
|
|
||||||
--player:RemoveQuest(quest.Name);
|
player:RemoveQuest(quest.Name);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
message = ("remove error: either incorrect ID or quest "..var1.." isn't active on character");
|
message = ("remove error: either incorrect ID or quest "..var1.." isn't active on character");
|
||||||
@ -137,7 +137,7 @@ function onTrigger(player, argc, command, var1, var2, var3)
|
|||||||
player:GetQuest(questvar):GetData():ClearFlag(flagvar);
|
player:GetQuest(questvar):GetData():ClearFlag(flagvar);
|
||||||
end
|
end
|
||||||
player:GetQuest(questvar):UpdateENPCs();
|
player:GetQuest(questvar):UpdateENPCs();
|
||||||
player:GetQuest(questvar):SaveData();
|
player:GetQuest(questvar):GetData():Save();
|
||||||
if boolvar == true then
|
if boolvar == true then
|
||||||
message = ("changing flag "..tonumber(var2).." to true on quest "..questvar);
|
message = ("changing flag "..tonumber(var2).." to true on quest "..questvar);
|
||||||
else
|
else
|
||||||
@ -156,7 +156,7 @@ function onTrigger(player, argc, command, var1, var2, var3)
|
|||||||
|
|
||||||
player:GetQuest(questvar):GetData():SetCounter(index, tonumber(var3));
|
player:GetQuest(questvar):GetData():SetCounter(index, tonumber(var3));
|
||||||
player:GetQuest(questvar):UpdateENPCs();
|
player:GetQuest(questvar):UpdateENPCs();
|
||||||
player:GetQuest(questvar):SaveData();
|
player:GetQuest(questvar):GetData():Save();
|
||||||
message = ("changing counter "..tonumber(var2).." to "..var3);
|
message = ("changing counter "..tonumber(var2).." to "..var3);
|
||||||
else
|
else
|
||||||
message = ("error: command "..command.." not recognized");
|
message = ("error: command "..command.." not recognized");
|
||||||
|
@ -153,13 +153,7 @@ ETYPE_PUSH = 2;
|
|||||||
ETYPE_EMOTE = 3;
|
ETYPE_EMOTE = 3;
|
||||||
ETYPE_NOTICE = 5;
|
ETYPE_NOTICE = 5;
|
||||||
|
|
||||||
-- QUEST INSTANCE
|
-- QUEST FLAGS
|
||||||
ENPC_PROP_QFLAG = 0;
|
|
||||||
ENPC_PROP_CAN_TALK = 1;
|
|
||||||
ENPC_PROP_CAN_PUSH = 2;
|
|
||||||
ENPC_PROP_CAN_EMOTE = 3;
|
|
||||||
ENPC_PROP_CAN_NOTICE = 4;
|
|
||||||
|
|
||||||
QFLAG_NONE = 0;
|
QFLAG_NONE = 0;
|
||||||
QFLAG_PLATE = 2;
|
QFLAG_PLATE = 2;
|
||||||
QFLAG_MAP = 3;
|
QFLAG_MAP = 3;
|
||||||
|
29
Data/scripts/quests/trl1/Trl0g1.lua
Normal file
29
Data/scripts/quests/trl1/Trl0g1.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
require ("global")
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
|
Quest Script
|
||||||
|
|
||||||
|
Name: Getting Started (Mother Miounne)
|
||||||
|
Code: Trl0g1
|
||||||
|
Id: 110141
|
||||||
|
|
||||||
|
Enables the "Getting Started" option on Miounne.
|
||||||
|
* NOTE: This quest is active for all players at all times.
|
||||||
|
]]
|
||||||
|
|
||||||
|
function onTalk(player, quest, npc, eventName)
|
||||||
|
local choice = callClientFunction(player, "delegateEvent", player, quest, "processEventMiounneStart");
|
||||||
|
|
||||||
|
if (choice == 1) then
|
||||||
|
callClientFunction(player, "delegateEvent", player, quest, "processEvent225");
|
||||||
|
elseif (choice == 2) then
|
||||||
|
callClientFunction(player, "delegateEvent", player, quest, "processEvent230");
|
||||||
|
end
|
||||||
|
|
||||||
|
player:EndEvent();
|
||||||
|
end
|
||||||
|
|
||||||
|
function IsQuestENPC(player, quest, npc)
|
||||||
|
return npc:GetActorClassId()] == 1000230;
|
||||||
|
end
|
29
Data/scripts/quests/trl1/Trl0l1.lua
Normal file
29
Data/scripts/quests/trl1/Trl0l1.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
require ("global")
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
|
Quest Script
|
||||||
|
|
||||||
|
Name: Getting Started (Baderon)
|
||||||
|
Code: Trl0l1
|
||||||
|
Id: 110140
|
||||||
|
|
||||||
|
Enables the "Getting Started" option on Baderon.
|
||||||
|
* NOTE: This quest is active for all players at all times.
|
||||||
|
]]
|
||||||
|
|
||||||
|
function onTalk(player, quest, npc, eventName)
|
||||||
|
local choice = callClientFunction(player, "delegateEvent", player, quest, "processEventBaderonStart");
|
||||||
|
|
||||||
|
if (choice == 1) then
|
||||||
|
callClientFunction(player, "delegateEvent", player, quest, "processEvent640");
|
||||||
|
elseif (choice == 2) then
|
||||||
|
callClientFunction(player, "delegateEvent", player, quest, "processEvent650");
|
||||||
|
end
|
||||||
|
|
||||||
|
player:EndEvent();
|
||||||
|
end
|
||||||
|
|
||||||
|
function IsQuestENPC(player, quest, npc)
|
||||||
|
return npc:GetActorClassId()] == 1000137;
|
||||||
|
end
|
29
Data/scripts/quests/trl1/Trl0u1.lua
Normal file
29
Data/scripts/quests/trl1/Trl0u1.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
require ("global")
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
|
Quest Script
|
||||||
|
|
||||||
|
Name: Getting Started (Momodi)
|
||||||
|
Code: Trl0u1
|
||||||
|
Id: 110142
|
||||||
|
|
||||||
|
Enables the "Getting Started" option on Momodi.
|
||||||
|
* NOTE: This quest is active for all players at all times.
|
||||||
|
]]
|
||||||
|
|
||||||
|
function onTalk(player, quest, npc, eventName)
|
||||||
|
local choice = callClientFunction(player, "delegateEvent", player, quest, "processEventMomodiStart");
|
||||||
|
|
||||||
|
if (choice == 1) then
|
||||||
|
callClientFunction(player, "delegateEvent", player, quest, "processEvent235");
|
||||||
|
elseif (choice == 2) then
|
||||||
|
callClientFunction(player, "delegateEvent", player, quest, "processEvent240");
|
||||||
|
end
|
||||||
|
|
||||||
|
player:EndEvent();
|
||||||
|
end
|
||||||
|
|
||||||
|
function IsQuestENPC(player, quest, npc)
|
||||||
|
return npc:GetActorClassId() == 1000841;
|
||||||
|
end
|
@ -1574,9 +1574,9 @@ namespace Meteor.Map.Actors
|
|||||||
|
|
||||||
#region Quests - Debug/Misc Related
|
#region Quests - Debug/Misc Related
|
||||||
// Force-Add a quest by Id. Called be debug scripts.
|
// Force-Add a quest by Id. Called be debug scripts.
|
||||||
public void AddQuest(uint id, bool isSilent = false)
|
public void AddQuest(int id, bool isSilent = false)
|
||||||
{
|
{
|
||||||
Actor actor = Server.GetStaticActors((0xA0F00000 | id));
|
Actor actor = Server.GetStaticActors((0xA0F00000 | (uint)id));
|
||||||
AddQuest(actor.Name, isSilent);
|
AddQuest(actor.Name, isSilent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1597,7 +1597,6 @@ namespace Meteor.Map.Actors
|
|||||||
if (activeQuest == null)
|
if (activeQuest == null)
|
||||||
questStateManager.ForceAddActiveQuest(questScenario[freeSlot]);
|
questStateManager.ForceAddActiveQuest(questScenario[freeSlot]);
|
||||||
|
|
||||||
Database.SaveQuest(this, questScenario[freeSlot], freeSlot);
|
|
||||||
SendQuestClientUpdate(freeSlot);
|
SendQuestClientUpdate(freeSlot);
|
||||||
|
|
||||||
if (!isSilent)
|
if (!isSilent)
|
||||||
@ -1606,9 +1605,11 @@ namespace Meteor.Map.Actors
|
|||||||
}
|
}
|
||||||
|
|
||||||
questScenario[freeSlot].OnAccept();
|
questScenario[freeSlot].OnAccept();
|
||||||
|
|
||||||
|
Database.SaveQuest(this, questScenario[freeSlot], freeSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveQuest(uint id)
|
public void RemoveQuest(int id)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < questScenario.Length; i++)
|
for (int i = 0; i < questScenario.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ namespace Meteor.Map.Actors.QuestNS
|
|||||||
|
|
||||||
public void UpdateENPCs()
|
public void UpdateENPCs()
|
||||||
{
|
{
|
||||||
if (data.Dirty)
|
if (data != null && data.Dirty)
|
||||||
{
|
{
|
||||||
if (questState != null)
|
if (questState != null)
|
||||||
questState.UpdateState();
|
questState.UpdateState();
|
||||||
@ -186,7 +186,7 @@ namespace Meteor.Map.Actors.QuestNS
|
|||||||
{
|
{
|
||||||
List<LuaParam> returned = LuaEngine.GetInstance().CallLuaFunctionForReturn(caller, this, "IsQuestENPC", true, npc, this);
|
List<LuaParam> returned = LuaEngine.GetInstance().CallLuaFunctionForReturn(caller, this, "IsQuestENPC", true, npc, this);
|
||||||
bool scriptReturned = returned != null && returned.Count != 0 && returned[0].typeID == 3;
|
bool scriptReturned = returned != null && returned.Count != 0 && returned[0].typeID == 3;
|
||||||
return scriptReturned || questState.HasENpc(npc.GetActorClassId());
|
return scriptReturned || (questState?.HasENpc(npc.GetActorClassId()) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartSequence(ushort sequence)
|
public void StartSequence(ushort sequence)
|
||||||
|
@ -72,7 +72,7 @@ namespace Meteor.Map.Actors.QuestNS
|
|||||||
|
|
||||||
public void UpdateQuestCompleted(Quest quest)
|
public void UpdateQuestCompleted(Quest quest)
|
||||||
{
|
{
|
||||||
CompletedQuestsBitfield.Set(quest.Id - SCENARIO_START);
|
CompletedQuestsBitfield.Set(quest.GetQuestId() - SCENARIO_START);
|
||||||
QuestGameData[] updated = Server.GetQuestGamedataByPrerequisite(quest.GetQuestId());
|
QuestGameData[] updated = Server.GetQuestGamedataByPrerequisite(quest.GetQuestId());
|
||||||
foreach (var questData in updated)
|
foreach (var questData in updated)
|
||||||
PrereqBitfield.Set(questData.Id - SCENARIO_START);
|
PrereqBitfield.Set(questData.Id - SCENARIO_START);
|
||||||
|
@ -274,9 +274,7 @@ namespace Meteor.Map.packets.send.actor
|
|||||||
|
|
||||||
CloseStreams();
|
CloseStreams();
|
||||||
|
|
||||||
SubPacket packet = new SubPacket(OPCODE, sourceActorId, data);
|
return new SubPacket(OPCODE, sourceActorId, data);
|
||||||
packet.DebugPrintSubPacket();
|
|
||||||
return packet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user