mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 21:27:46 +00:00
Merge remote-tracking branch 'origin/ioncannon/quest_system' into Jorge/quest_system
# Conflicts: # Data/scripts/player.lua - Resolved. Using theirs.
This commit is contained in:
commit
fac8f269e7
8 changed files with 82 additions and 55 deletions
23
Data/scripts/commands/gm/menuman.lua
Normal file
23
Data/scripts/commands/gm/menuman.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
require("global");
|
||||
|
||||
properties = {
|
||||
permissions = 0,
|
||||
parameters = "d",
|
||||
description = "Spawns the menuman",
|
||||
}
|
||||
|
||||
function onTrigger(player, argc)
|
||||
|
||||
local pos = player:GetPos();
|
||||
local x = pos[1];
|
||||
local y = pos[2];
|
||||
local z = pos[3];
|
||||
local rot = pos[4];
|
||||
|
||||
local actor = player.CurrentArea:SpawnActor(9114437, "menuman", x, y, z, rot, 0, 0);
|
||||
|
||||
if (actor == nil) then
|
||||
player:SendMessage(0x20, "", "This actor class id cannot be spawned.");
|
||||
end
|
||||
|
||||
end;
|
|
@ -7,13 +7,13 @@ function onBeginLogin(player)
|
|||
if (player:GetPlayTime(false) == 0) then
|
||||
initialTown = player:GetInitialTown();
|
||||
if (initialTown == 1 and player:HasQuest(110001) == false) then
|
||||
--player:AddQuest(110001);
|
||||
player:AddQuest(110001);
|
||||
player:SetHomePoint(1280001);
|
||||
elseif (initialTown == 2 and player:HasQuest(110005) == false) then
|
||||
--player:AddQuest(110005);
|
||||
player:SetHomePoint(1280061);
|
||||
elseif (initialTown == 3 and player:HasQuest(110009) == false) then
|
||||
player:AddQuest(110009);
|
||||
--player:AddQuest(110009);
|
||||
player:SetHomePoint(1280031);
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,7 @@ function onBeginLogin(player)
|
|||
player.positionY = 10.35;
|
||||
player.positionZ = -36.91;
|
||||
player.rotation = 0.025;
|
||||
player:GetQuest(110001):ClearData();
|
||||
player:GetQuest(110001):GetData():ClearData();
|
||||
elseif (player:HasQuest(110005) == true and player.CurrentArea.ZoneId == 166) then
|
||||
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||
player:AddDirector(director);
|
||||
|
@ -43,8 +43,7 @@ function onBeginLogin(player)
|
|||
player.positionY = 4.21;
|
||||
player.positionZ = -706.1074;
|
||||
player.rotation = -1.26721;
|
||||
player:GetQuest(110005):ClearQuestData();
|
||||
player:GetQuest(110005):ClearQuestFlags();
|
||||
player:GetQuest(110005):GetData():ClearData();
|
||||
elseif (player:HasQuest(110009) == true and player.CurrentArea.ZoneId == 184) then
|
||||
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||
player:AddDirector(director);
|
||||
|
@ -56,15 +55,7 @@ function onBeginLogin(player)
|
|||
player.positionY = 196.0;
|
||||
player.positionZ = 133.6561;
|
||||
player.rotation = -2.849384;
|
||||
player:GetQuest(110009):ClearData();
|
||||
|
||||
elseif (player:HasQuest(110009) == true and player.CurrentArea.ZoneId == 175) then
|
||||
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||
player:AddDirector(director);
|
||||
director:StartDirector(true);
|
||||
player:SetLoginDirector(director);
|
||||
player:KickEvent(director, "noticeEvent", true);
|
||||
|
||||
player:GetQuest(110009):GetData():ClearData();
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -63,14 +63,16 @@ function onFinish(player, quest)
|
|||
end
|
||||
|
||||
function onStateChange(player, quest, sequence)
|
||||
if (sequence == SEQ_000) then
|
||||
if (sequence == SEQ_000) then
|
||||
-- Setup states incase we loaded in.
|
||||
local rostnsthalFlag = quest:GetFlag(FLAG_SEQ000_MINITUT1) and QFLAG_NONE or QFLAG_PLATE;
|
||||
local vixenFlag = quest:GetFlag(FLAG_SEQ000_MINITUT2) and QFLAG_NONE or QFLAG_PLATE;
|
||||
local babyfaceFlag = quest:GetFlag(FLAG_SEQ000_MINITUT3) and QFLAG_NONE or QFLAG_PLATE;
|
||||
local rostnsthalCanPush = not quest:GetFlag(FLAG_SEQ000_MINITUT0);
|
||||
local exitCanPush = quest:GetFlags() == 0xF;
|
||||
local exitFlag = quest:GetFlags() == 0xF and QFLAG_MAP or QFLAG_NONE;
|
||||
local data = quest:GetData();
|
||||
|
||||
local rostnsthalFlag = data:GetFlag(FLAG_SEQ000_MINITUT1) and QFLAG_NONE or QFLAG_PLATE;
|
||||
local vixenFlag = data:GetFlag(FLAG_SEQ000_MINITUT2) and QFLAG_NONE or QFLAG_PLATE;
|
||||
local babyfaceFlag = data:GetFlag(FLAG_SEQ000_MINITUT3) and QFLAG_NONE or QFLAG_PLATE;
|
||||
local rostnsthalCanPush = not data:GetFlag(FLAG_SEQ000_MINITUT0);
|
||||
local exitCanPush = data:GetFlags() == 0xF;
|
||||
local exitFlag = data:GetFlags() == 0xF and QFLAG_MAP or QFLAG_NONE;
|
||||
|
||||
quest:SetENpc(WELLTRAVELED_MERCHANT);
|
||||
quest:SetENpc(TIPSY_ADVENTURER);
|
||||
|
@ -88,9 +90,10 @@ function onStateChange(player, quest, sequence)
|
|||
quest:SetENpc(GRINNING_ADVENTURER);
|
||||
quest:SetENpc(ROSTNSTHAL, rostnsthalFlag, true, rostnsthalCanPush);
|
||||
quest:SetENpc(EXIT_TRIGGER, exitFlag, false, exitCanPush);
|
||||
print(tostring(exitCanPush));
|
||||
elseif (sequence == SEQ_005) then
|
||||
elseif (sequence == SEQ_010) then
|
||||
quest:SetENpc(HOB);
|
||||
quest:SetENpc(HOB, QFLAG_PLATE);
|
||||
quest:SetENpc(GERT);
|
||||
quest:SetENpc(LORHZANT);
|
||||
quest:SetENpc(MUSCLEBOUND_DECKHAND);
|
||||
|
@ -144,8 +147,7 @@ end
|
|||
function onNotice(player, quest, target)
|
||||
local sequence = quest:getSequence();
|
||||
|
||||
if (sequence == SEQ_000) then
|
||||
quest:ClearData();
|
||||
if (sequence == SEQ_000) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processTtrNomal001withHQ");
|
||||
end
|
||||
|
||||
|
@ -153,7 +155,9 @@ function onNotice(player, quest, target)
|
|||
quest:UpdateENPCs();
|
||||
end
|
||||
|
||||
function seq000_onTalk(player, quest, npc, classId)
|
||||
function seq000_onTalk(player, quest, npc, classId)
|
||||
local data = quest:GetData();
|
||||
|
||||
if (classId == WELLTRAVELED_MERCHANT) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_4");
|
||||
elseif (classId == TIPSY_ADVENTURER) then
|
||||
|
@ -163,9 +167,9 @@ function seq000_onTalk(player, quest, npc, classId)
|
|||
elseif (classId == ANXIOUS_ADVENTURER) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_7");
|
||||
elseif (classId == BABYFACED_ADVENTURER) then
|
||||
if (not quest:GetFlag(FLAG_SEQ000_MINITUT3)) then
|
||||
if (not data:GetFlag(FLAG_SEQ000_MINITUT3)) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processTtrMini003");
|
||||
quest:SetFlag(FLAG_SEQ000_MINITUT3);
|
||||
data:SetFlag(FLAG_SEQ000_MINITUT3);
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_8");
|
||||
end
|
||||
|
@ -178,9 +182,9 @@ function seq000_onTalk(player, quest, npc, classId)
|
|||
elseif (classId == ASTUTE_MERCHANT) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_12");
|
||||
elseif (classId == VOLUPTUOUS_VIXEN) then
|
||||
if (not quest:GetFlag(FLAG_SEQ000_MINITUT2)) then
|
||||
if (not data:GetFlag(FLAG_SEQ000_MINITUT2)) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processTtrMini002");
|
||||
quest:SetFlag(FLAG_SEQ000_MINITUT2);
|
||||
data:SetFlag(FLAG_SEQ000_MINITUT2);
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_13");
|
||||
end
|
||||
|
@ -194,13 +198,13 @@ function seq000_onTalk(player, quest, npc, classId)
|
|||
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_17");
|
||||
elseif (classId == ROSTNSTHAL) then
|
||||
-- Handle the talk tutorial after the push one.
|
||||
if (not quest:GetFlag(FLAG_SEQ000_MINITUT0)) then
|
||||
if (not data:GetFlag(FLAG_SEQ000_MINITUT0)) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processTtrNomal003");
|
||||
quest:SetFlag(FLAG_SEQ000_MINITUT0);
|
||||
data:SetFlag(FLAG_SEQ000_MINITUT0);
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processTtrMini001");
|
||||
if (not quest:GetFlag(FLAG_SEQ000_MINITUT1)) then
|
||||
quest:SetFlag(FLAG_SEQ000_MINITUT1);
|
||||
if (not data:GetFlag(FLAG_SEQ000_MINITUT1)) then
|
||||
data:SetFlag(FLAG_SEQ000_MINITUT1);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -209,6 +213,8 @@ function seq000_onTalk(player, quest, npc, classId)
|
|||
end
|
||||
|
||||
function seq010_onTalk(player, quest, npc, classId)
|
||||
local data = quest:GetData();
|
||||
|
||||
if (classId == MUSCLEBOUND_DECKHAND) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent020_2");
|
||||
elseif (classId == PEARLYTOOTHED_PORTER) then
|
||||
|
|
|
@ -86,6 +86,7 @@ function onFinish(player, quest)
|
|||
end
|
||||
|
||||
function onStateChange(player, quest, sequence)
|
||||
local data = quest:GetData();
|
||||
|
||||
if (sequence == SEQ_000) then
|
||||
quest:SetENpc(YSHTOLA);
|
||||
|
@ -107,8 +108,8 @@ function onStateChange(player, quest, sequence)
|
|||
elseif (sequence == SEQ_006) then
|
||||
quest:SetENpc(BADERON, QFLAG_PLATE);
|
||||
elseif (sequence == SEQ_007) then
|
||||
local subseqCUL = quest:GetCounter(CNTR_SEQ7_CUL);
|
||||
local subseqMRD = quest:GetCounter(CNTR_SEQ7_MRD);
|
||||
local subseqCUL = data:GetCounter(CNTR_SEQ7_CUL);
|
||||
local subseqMRD = data:GetCounter(CNTR_SEQ7_MRD);
|
||||
|
||||
-- Always active in this seqence
|
||||
quest:SetENpc(BADERON);
|
||||
|
@ -220,8 +221,9 @@ function seq000_onTalk(player, quest, npc, classId)
|
|||
end
|
||||
|
||||
function seq007_onTalk(player, quest, npc, classId)
|
||||
local subseqCUL = quest:GetCounter(CNTR_SEQ7_CUL);
|
||||
local subseqMRD = quest:GetCounter(CNTR_SEQ7_MRD);
|
||||
local data = quest:GetData();
|
||||
local subseqCUL = data:GetCounter(CNTR_SEQ7_CUL);
|
||||
local subseqMRD = data:GetCounter(CNTR_SEQ7_MRD);
|
||||
|
||||
if (classId == BADERON) then
|
||||
if (subseqCUL == 1) then
|
||||
|
@ -234,7 +236,7 @@ function seq007_onTalk(player, quest, npc, classId)
|
|||
elseif (classId == CHARLYS) then
|
||||
if (subseqCUL == 0) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent030");
|
||||
quest:IncCounter(CNTR_SEQ7_CUL);
|
||||
data:IncCounter(CNTR_SEQ7_CUL);
|
||||
--give 1000g
|
||||
else
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent030_2");
|
||||
|
@ -242,11 +244,11 @@ function seq007_onTalk(player, quest, npc, classId)
|
|||
elseif (classId == ISANDOREL) then
|
||||
if (subseqMRD == 2) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent050");
|
||||
quest:IncCounter(CNTR_SEQ7_MRD);
|
||||
data:IncCounter(CNTR_SEQ7_MRD);
|
||||
GetWorldManager():WarpToPrivateArea(player, "PrivateAreaMasterPast", 3);
|
||||
elseif (subseqMRD == 0) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent035");
|
||||
quest:IncCounter(CNTR_SEQ7_MRD);
|
||||
data:IncCounter(CNTR_SEQ7_MRD);
|
||||
elseif (subseqMRD == 1) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent035_2");
|
||||
end
|
||||
|
@ -278,19 +280,20 @@ function seq007_onTalk(player, quest, npc, classId)
|
|||
end
|
||||
|
||||
function onPush(player, quest, npc)
|
||||
local data = quest:GetData();
|
||||
local sequence = quest:getSequence();
|
||||
local classId = npc:GetActorClassId();
|
||||
|
||||
if (sequence == SEQ_007) then
|
||||
if (classId == MSK_TRIGGER) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent040");
|
||||
quest:IncCounter(CNTR_SEQ7_MRD);
|
||||
data:IncCounter(CNTR_SEQ7_MRD);
|
||||
player:EndEvent();
|
||||
quest:UpdateENPCs();
|
||||
GetWorldManager():DoZoneChange(player, 230, nil, 0, 15, -620.0, 29.476, -70.050, 0.791);
|
||||
elseif (classId == ECHO_EXIT_TRIGGER) then
|
||||
callClientFunction(player, "delegateEvent", player, quest, "processEvent060");
|
||||
quest:IncCounter(CNTR_SEQ7_MRD);
|
||||
data:IncCounter(CNTR_SEQ7_MRD);
|
||||
player:EndEvent();
|
||||
quest:UpdateENPCs();
|
||||
GetWorldManager():WarpToPublicArea(player);
|
||||
|
@ -327,7 +330,7 @@ function onNpcLS(player, quest, npcLSId)
|
|||
end
|
||||
|
||||
function getJournalInformation(player, quest)
|
||||
return 0, quest:GetCounter(CNTR_SEQ7_CUL) * 5, quest:GetCounter(CNTR_SEQ7_MRD) * 5;
|
||||
return 0, quest:GetData():GetCounter(CNTR_SEQ7_CUL) * 5, quest:GetData():GetCounter(CNTR_SEQ7_MRD) * 5;
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ function onFinish(player, quest)
|
|||
end
|
||||
|
||||
function onStateChange(player, quest, seqNum)
|
||||
quest:ClearENpcs();
|
||||
end
|
||||
|
||||
function onTalk(player, quest, npc)
|
||||
|
|
|
@ -1487,17 +1487,18 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
|
||||
// Replace a quest with another quest in the player's quest state.
|
||||
public void ReplaceQuest(Quest oldQuestInstance, Quest newQuestInstance)
|
||||
public void ReplaceQuest(Quest oldQuestInstance, string questName)
|
||||
{
|
||||
for (int i = 0; i < questScenario.Length; i++)
|
||||
{
|
||||
if (questScenario[i] != null && questScenario[i].Equals(oldQuestInstance))
|
||||
{
|
||||
questScenario[i] = newQuestInstance;
|
||||
playerWork.questScenario[i] = questScenario[i].Id;
|
||||
{
|
||||
SendQuestClientUpdate(i);
|
||||
oldQuestInstance.OnComplete();
|
||||
questStateManager.UpdateQuestCompleted(oldQuestInstance);
|
||||
Quest newQuestInstance = questStateManager.GetActiveQuest(((Quest)Server.GetStaticActors(questName)).GetQuestId());
|
||||
questScenario[i] = newQuestInstance;
|
||||
playerWork.questScenario[i] = questScenario[i].Id;
|
||||
newQuestInstance.OnAccept();
|
||||
Database.SaveQuest(this, questScenario[i], i);
|
||||
break;
|
||||
|
|
|
@ -58,6 +58,16 @@ namespace Meteor.Map.Actors.QuestNS
|
|||
questState.UpdateState();
|
||||
}
|
||||
|
||||
// Creates a Instance Quest that has been started with data.
|
||||
public Quest(Player owner, Quest staticQuest, ushort sequence, uint flags, ushort counter1, ushort counter2, ushort counter3, ushort counter4) : this(staticQuest)
|
||||
{
|
||||
this.owner = owner;
|
||||
currentSequence = sequence;
|
||||
data = new QuestData(owner, this, flags, counter1, counter2, counter3, counter4);
|
||||
questState = new QuestState(owner, this);
|
||||
questState.UpdateState();
|
||||
}
|
||||
|
||||
// Creates a Instance Quest that has not been started.
|
||||
public Quest(Player owner, Quest staticQuest) : this(owner, staticQuest, SEQ_NOT_STARTED)
|
||||
{ }
|
||||
|
@ -98,10 +108,6 @@ namespace Meteor.Map.Actors.QuestNS
|
|||
#endregion
|
||||
|
||||
#region Quest Data
|
||||
public void SetData(uint flags, ushort counter1, ushort counter2, ushort counter3, ushort counter4)
|
||||
{
|
||||
data = new QuestData(owner, this, flags, counter1, counter2, counter3, counter4);
|
||||
}
|
||||
|
||||
public QuestData GetData()
|
||||
{
|
||||
|
|
|
@ -1235,10 +1235,8 @@ namespace Meteor.Map
|
|||
//ushort counter4 = reader.GetUInt16("counter4");
|
||||
|
||||
Quest baseQuest = (Quest) Server.GetStaticActors(questId);
|
||||
|
||||
player.playerWork.questScenario[index] = questId;
|
||||
player.questScenario[index] = new Quest(player, baseQuest, sequence);
|
||||
player.questScenario[index].SetData(flags, counter1, counter2, counter3, 0);
|
||||
player.questScenario[index] = new Quest(player, baseQuest, sequence, flags, counter1, counter2, counter3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue