mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Added functionality to handle NPC LSes in quests. Linked the rest of the sequences up for Man0l1.
This commit is contained in:
		| @@ -35,6 +35,7 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|         private QuestState questState = null; | ||||
|         private QuestData data = null; | ||||
|  | ||||
|  | ||||
|         // Creates a Static Quest for the StaticActors list. | ||||
|         public Quest(uint actorID, string className, string classPath) | ||||
|             : base(actorID) | ||||
| @@ -59,11 +60,11 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|         } | ||||
|  | ||||
|         // 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) | ||||
|         public Quest(Player owner, Quest staticQuest, ushort sequence, uint flags, ushort counter1, ushort counter2, ushort counter3, ushort counter4, uint npcLsFrom, byte npcLsMsgStep) : this(staticQuest) | ||||
|         { | ||||
|             this.owner = owner; | ||||
|             currentSequence = sequence; | ||||
|             data = new QuestData(owner, this, flags, counter1, counter2, counter3, counter4); | ||||
|             data = new QuestData(owner, this, flags, counter1, counter2, counter3, counter4, npcLsFrom, npcLsMsgStep); | ||||
|             questState = new QuestState(owner, this); | ||||
|             questState.UpdateState(); | ||||
|         } | ||||
| @@ -137,6 +138,35 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public void NewNpcLsMsg(uint from) | ||||
|         { | ||||
|             data.SetNpcLsFrom(from); | ||||
|             owner.SetNpcLs(from, Player.NPCLS_ALERT);             | ||||
|             owner.SendGameMessage(Server.GetWorldManager().GetActor(), 25119, 0x20, (object)from); // A glow emanates from the <NpcLs> linkpearl.  | ||||
|         } | ||||
|  | ||||
|         public void ReadNpcLsMsg() | ||||
|         {             | ||||
|             data.IncrementNpcLsMsgStep(); | ||||
|             owner.SetNpcLs(data.GetNpcLsFrom(), Player.NPCLS_ACTIVE); | ||||
|         } | ||||
|  | ||||
|         public void EndOfNpcLsMsgs() | ||||
|         { | ||||
|             owner.SetNpcLs(data.GetNpcLsFrom(), Player.NPCLS_INACTIVE); | ||||
|             data.ClearNpcLs(); | ||||
|         } | ||||
|  | ||||
|         public bool HasNpcLsMsgs(uint from) | ||||
|         { | ||||
|             return data.GetNpcLsFrom() == from; | ||||
|         } | ||||
|  | ||||
|         public int GetNpcLsMsgStep() | ||||
|         { | ||||
|             return data.GetMsgStep(); | ||||
|         } | ||||
|  | ||||
|         public QuestState GetQuestState() | ||||
|         { | ||||
|             return questState; | ||||
| @@ -164,9 +194,9 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|             LuaEngine.GetInstance().CallLuaFunction(caller, this, "onNotice", true, triggerName); | ||||
|         } | ||||
|  | ||||
|         public void OnNpcLS(Player caller, uint npcLSId) | ||||
|         public void OnNpcLS(Player caller) | ||||
|         { | ||||
|             LuaEngine.GetInstance().CallLuaFunction(caller, this, "onNpcLS", true, npcLSId); | ||||
|             LuaEngine.GetInstance().CallLuaFunction(caller, this, "onNpcLS", true, data.GetNpcLsFrom(), data.GetMsgStep()); | ||||
|         } | ||||
|  | ||||
|         public object[] GetJournalInformation() | ||||
| @@ -213,6 +243,12 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|             questState.UpdateState(); | ||||
|         } | ||||
|  | ||||
|         public void StartSequenceForNpcLs(ushort sequence) | ||||
|         { | ||||
|             currentSequence = sequence; | ||||
|             questState.UpdateState(); | ||||
|         } | ||||
|  | ||||
|         public void OnAccept() | ||||
|         { | ||||
|             data = new QuestData(owner, this); | ||||
| @@ -237,6 +273,5 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|             data = null; | ||||
|             questState.UpdateState(); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,9 +17,12 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|         private ushort counter3; | ||||
|         private ushort counter4; | ||||
|  | ||||
|         private uint npcLsFrom = 0; | ||||
|         private byte npcLsMessageStep = 0; | ||||
|  | ||||
|         public bool Dirty { get; private set; } = false; | ||||
|  | ||||
|         public QuestData(Player owner, Quest parent, uint flags, ushort counter1, ushort counter2, ushort counter3, ushort counter4) | ||||
|         public QuestData(Player owner, Quest parent, uint flags, ushort counter1, ushort counter2, ushort counter3, ushort counter4, uint npcLsFrom, byte npcLsMessageStep) | ||||
|         { | ||||
|             this.owner = owner; | ||||
|             this.parent = parent; | ||||
| @@ -28,6 +31,8 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|             this.counter2 = counter2; | ||||
|             this.counter3 = counter3; | ||||
|             this.counter4 = counter4; | ||||
|             this.npcLsFrom = npcLsFrom; | ||||
|             this.npcLsMessageStep = npcLsMessageStep; | ||||
|         } | ||||
|  | ||||
|         public QuestData(Player owner, Quest parent) | ||||
| @@ -160,6 +165,34 @@ namespace Meteor.Map.Actors.QuestNS | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         public void SetNpcLsFrom(uint from) | ||||
|         { | ||||
|             npcLsFrom = from; | ||||
|             npcLsMessageStep = 1; | ||||
|             Dirty = true; | ||||
|         } | ||||
|  | ||||
|         public void IncrementNpcLsMsgStep() | ||||
|         { | ||||
|             npcLsMessageStep++; | ||||
|             Dirty = true; | ||||
|         } | ||||
|  | ||||
|         public uint GetNpcLsFrom() | ||||
|         { | ||||
|             return npcLsFrom; | ||||
|         } | ||||
|  | ||||
|         public byte GetMsgStep() | ||||
|         { | ||||
|             return npcLsMessageStep; | ||||
|         } | ||||
|  | ||||
|         public void ClearNpcLs() | ||||
|         { | ||||
|             npcLsFrom = 0; | ||||
|         } | ||||
|  | ||||
|         public void ClearDirty() | ||||
|         { | ||||
|             Dirty = false; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user