private void _questDialog(QuestState stateinfo, Dictionary<short, string> dialognames, List<string> pages, Dictionary<short, string> links)
		{
			if (QuestDialog.Instance == null)
				QuestDialog.SetupInstance(m_packetAPI);

			if (QuestDialog.Instance == null)
				throw new InvalidOperationException("Something went wrong creating the instance");

			QuestDialog.Instance.SetDisplayData(stateinfo, dialognames, pages, links);
		}
예제 #2
0
		private void _handleQuestDialog(Packet pkt)
		{
			if (OnQuestDialog == null) return;

			int numDialogs = pkt.GetChar();
			short vendorID = pkt.GetShort();
			short questID = pkt.GetShort();
			short sessionID = pkt.GetShort(); //not used by eoserv
			short dialogID = pkt.GetShort(); //not used by eoserv
			if (pkt.GetByte() != 255) return;

			QuestState stateInfo = new QuestState(sessionID, dialogID, questID, vendorID);

			var dialogNames = new Dictionary<short, string>(numDialogs);
			for (int i = 0; i < numDialogs; ++i)
			{
				dialogNames.Add(pkt.GetShort(), pkt.GetBreakString());
			}

			var pages = new List<string>();
			var links = new Dictionary<short, string>();
			while (pkt.ReadPos != pkt.Length)
			{
				var entry = (DialogEntry) pkt.GetShort();
				switch (entry)
				{
					case DialogEntry.DialogText:
						pages.Add(pkt.GetBreakString());
						break;
					case DialogEntry.DialogLink:
						links.Add(pkt.GetShort(), pkt.GetBreakString());
						break;
				}
			}

			OnQuestDialog(stateInfo, dialogNames, pages, links);
		}
예제 #3
0
		public void SetDisplayData(QuestState stateinfo, Dictionary<short, string> dialognames, List<string> pages, Dictionary<short, string> links)
		{
			if(dialognames.Count == 0)
				throw new ArgumentException("Invalid quest dialog data received from server", "dialognames");

			_stateInfo = stateinfo;
			_dialogNames = dialognames;
			_pages = pages;
			_links = links;

			_pageIndex = 0;

			_setDialogTitle();
			_setDialogText();
			_setDialogButtons();
		}
예제 #4
0
		public bool RespondToQuestDialog(QuestState state, DialogReply reply, byte action = 0)
		{
			if (!Initialized || !m_client.ConnectedAndInitialized)
				return false;

			Packet pkt = new Packet(PacketFamily.Quest, PacketAction.Accept);
			pkt.AddShort(state.SessionID); //session ID - ignored by default EOSERV
			pkt.AddShort(state.DialogID); //dialog ID - ignored by default EOSERV
			pkt.AddShort(state.QuestID);
			pkt.AddShort(state.NPCIndex); //npc index - ignored by default EOSERV
			pkt.AddChar((byte) reply);
			if (reply == DialogReply.Link)
				pkt.AddChar(action);

			return m_client.SendPacket(pkt);
		}