public void Load(Character_quest_inprogress[] InProgressQuests) { if (InProgressQuests == null) return; foreach (Character_quest_inprogress Quest in InProgressQuests) { Quest.Quest = WorldMgr.GetQuest(Quest.QuestID); if (Quest.Quest == null) continue; foreach (Character_InProgressObjectives Obj in Quest._InProgressObjectives) Obj.Objective = WorldMgr.GetQuestObjective(Obj.ObjectiveID); if (!_InProgressQuests.ContainsKey(Quest.QuestID)) _InProgressQuests.Add(Quest.QuestID, Quest); } }
public void SendQuest(Character_quest_inprogress CQuest) { if (CQuest == null) { Log.Error("QuestsInterface", "SendQuest CQuest == null"); return; } PacketOut Packet = new PacketOut((byte)Opcodes.F_QUEST_INFO); Packet.WriteUInt16(CQuest.QuestID); Packet.WriteByte(0); BuildQuestHeader(Packet, CQuest.Quest, true); Dictionary<Item_Info, uint> Rewards = GenerateRewards(CQuest.Quest, GetPlayer()); Packet.WriteByte(CQuest.Quest.ChoiceCount); Packet.WriteByte(0); Packet.WriteByte((byte)Rewards.Count); foreach (KeyValuePair<Item_Info, uint> Kp in Rewards) { Item.BuildItem(ref Packet, null, Kp.Key, 0, (ushort)Kp.Value); } Packet.WriteByte(0); BuildObjectives(Packet, CQuest._InProgressObjectives); Packet.WriteByte(1); Packet.WritePascalString(CQuest.Quest.Name); Packet.WritePascalString("Return to your giver"); Packet.WriteUInt16(0x006A); Packet.WriteUInt16(0x046D); Packet.WriteUInt16(0x4D9E); Packet.WriteUInt16(0xCB65); Packet.Fill(0, 18); GetPlayer().SendPacket(Packet); }
public bool AcceptQuest(Quest Quest) { if (Quest == null) return false; if (!CanStartQuest(Quest)) return false; Character_quest CQuest = new Character_quest(); CQuest.QuestID = Quest.Entry; CQuest.Done = false; CQuest.CharacterID = GetPlayer().CharacterId; CQuest.Quest = Quest; // F_QUEST_LIST Quests not done Character_quest_inprogress IQuest = new Character_quest_inprogress(); IQuest.QuestID = Quest.Entry; IQuest.CharacterID = GetPlayer().CharacterId; IQuest.Quest = Quest; foreach(Quest_Objectives QObj in Quest.Objectives) { Character_Objectives CObj = new Character_Objectives(); CObj.Count = 0; CObj.Objective = QObj; CObj.ObjectiveID = QObj.Guid; CQuest._Objectives.Add(CObj); // F_QUEST_LIST Quests not done. Character_InProgressObjectives IObj = new Character_InProgressObjectives(); IObj.Count = 0; IObj.Objective = QObj; IObj.ObjectiveID = QObj.Guid; IQuest._InProgressObjectives.Add(IObj); } _Quests.Add(Quest.Entry, CQuest); CharMgr.Database.AddObject(CQuest); // Add Quests into character_quest_inprogress Table. _InProgressQuests.Add(Quest.Entry, IQuest); CharMgr.Database.AddObject(IQuest); SendQuestState(Quest, QuestCompletion.QUESTCOMPLETION_OFFER); return true; }