public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { Unit target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", (object)target); } else { Character character = (Character)target; uint id = trigger.Text.NextUInt(0U); QuestTemplate questTemplate = null; if (id > 0U) { questTemplate = QuestMgr.GetTemplate(id); } if (questTemplate == null) { trigger.Reply("Invalid QuestId: {0}", (object)id); } else if (!character.QuestLog.RemoveFinishedQuest(id)) { character.QuestLog.Cancel(id); trigger.Reply("Removed active quest: {0}", (object)questTemplate); } else { trigger.Reply("Removed finished quest: {0}", (object)questTemplate); } } }
public static void InitializeQuestTriggers() { foreach (AreaTrigger areaTrigger in AreaTriggerMgr.AreaTriggers) { if (areaTrigger != null) { ATTemplate template1 = areaTrigger.Template; if (template1 != null && template1.TriggerQuestId != 0U) { template1.Type = AreaTriggerType.QuestTrigger; QuestTemplate template2 = QuestMgr.GetTemplate(template1.TriggerQuestId); if (template2 != null) { template1.Type = AreaTriggerType.QuestTrigger; template2.AddAreaTriggerObjective(areaTrigger.Id); } } } } if (AreaTriggerMgr.AreaTriggers.Length <= 0) { return; } AreaTriggerMgr.Loaded = true; }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { Unit target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", (object)target); } else { Character receiver = (Character)target; uint id = trigger.Text.NextUInt(0U); uint rewardSlot = trigger.Text.NextUInt(0U); QuestTemplate questTemplate = null; if (id > 0U) { questTemplate = QuestMgr.GetTemplate(id); } if (questTemplate == null) { trigger.Reply("Invalid QuestId: {0}", (object)id); } else { questTemplate.GiveRewards(receiver, rewardSlot); trigger.Reply("Done."); } } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { var target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", target); } else { var chr = (Character)target; var id = trigger.Text.NextUInt(0); var slot = trigger.Text.NextUInt(0); QuestTemplate quest = null; if (id > 0) { quest = QuestMgr.GetTemplate(id); } if (quest == null) { trigger.Reply("Invalid QuestId: {0}", id); } else { quest.GiveRewards(chr, slot); trigger.Reply("Done."); } } }
/// <summary>Handles the quest giver query quest.</summary> public static void HandleQuestGiverQueryQuest(IRealmClient client, RealmPacketIn packet) { EntityId guid = packet.ReadEntityId(); Character activeCharacter = client.ActiveCharacter; uint num = packet.ReadUInt32(); IQuestHolder questGiver = activeCharacter.QuestLog.GetQuestGiver(guid); QuestTemplate template = QuestMgr.GetTemplate(num); if (questGiver == null || template == null) { return; } if (!activeCharacter.QuestLog.HasActiveQuest(num)) { bool flag = template.Flags.HasFlag(QuestFlags.AutoAccept); SendDetails(questGiver, template, activeCharacter, !flag); if (!flag) { return; } activeCharacter.QuestLog.TryAddQuest(template, questGiver); } else { SendRequestItems(questGiver, template, activeCharacter, false); } }
public static void HandleQuestGiverQueryQuest(IRealmClient client, RealmPacketIn packet) { var guid = packet.ReadEntityId(); var chr = client.ActiveCharacter; var questid = packet.ReadUInt32(); var qHolder = chr.QuestLog.GetQuestGiver(guid); var qt = QuestMgr.GetTemplate(questid); if (qHolder != null && qt != null) { //var qs = qt.GetStartStatus(qHolder.QuestHolderInfo, client.ActiveCharacter); if (!chr.QuestLog.HasActiveQuest(questid)) { var autoAccept = qt.Flags.HasFlag(QuestFlags.AutoAccept); SendDetails(qHolder, qt, chr, !autoAccept); if (autoAccept) { chr.QuestLog.TryAddQuest(qt, qHolder); } } else { SendRequestItems(qHolder, qt, chr, false); } } }
public static void InitializeQuestTriggers() { foreach (var at in AreaTriggers) { if (at == null) { continue; } var templ = at.Template; if (templ != null && templ.TriggerQuestId != 0) { templ.Type = AreaTriggerType.QuestTrigger; var quest = QuestMgr.GetTemplate(templ.TriggerQuestId); if (quest != null) { templ.Type = AreaTriggerType.QuestTrigger; quest.AddAreaTriggerObjective(at.Id); } } } if (AreaTriggers.Length > 0) { Loaded = true; } }
/// <summary>Handles the quest query.</summary> /// <param name="client">The client.</param> /// <param name="packet">The packet.</param> public static void HandleQuestQuery(IRealmClient client, RealmPacketIn packet) { QuestTemplate template = QuestMgr.GetTemplate(packet.ReadUInt32()); if (template == null) { return; } SendQuestQueryResponse(template, client.ActiveCharacter); }
public static void HandleQuestQuery(IRealmClient client, RealmPacketIn packet) { uint questid = packet.ReadUInt32(); QuestTemplate qt = QuestMgr.GetTemplate(questid); if (qt != null) { SendQuestQueryResponse(qt, client.ActiveCharacter); } }
/// <summary>Handles the quest giver request reward.</summary> /// <param name="client">The client.</param> /// <param name="packet">The packet.</param> public static void HandleQuestGiverRequestReward(IRealmClient client, RealmPacketIn packet) { EntityId guid = packet.ReadEntityId(); IQuestHolder questGiver = client.ActiveCharacter.QuestLog.GetQuestGiver(guid); QuestMgr.GetTemplate(packet.ReadUInt32()); if (questGiver == null) { ; } }
/// <summary>Handles the quest giver accept quest.</summary> /// <param name="client">The client.</param> /// <param name="packet">The packet.</param> public static void HandleQuestGiverAcceptQuest(IRealmClient client, RealmPacketIn packet) { EntityId guid = packet.ReadEntityId(); Character activeCharacter = client.ActiveCharacter; IQuestHolder questGiver = activeCharacter.QuestLog.GetQuestGiver(guid); QuestTemplate template = QuestMgr.GetTemplate(packet.ReadUInt32()); if (template == null || questGiver == null || !questGiver.QuestHolderInfo.QuestStarts.Contains(template)) { return; } activeCharacter.QuestLog.TryAddQuest(template, questGiver); }
public static void HandleQuestGiverRequestReward(IRealmClient client, RealmPacketIn packet) { var guid = packet.ReadEntityId(); var chr = client.ActiveCharacter; var qHolder = chr.QuestLog.GetQuestGiver(guid); var questid = packet.ReadUInt32(); var qt = QuestMgr.GetTemplate(questid); if ((qHolder != null) && (qt != null)) { //SendQuestGiverOfferReward(qHolder, qt, client.ActiveCharacter); } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { var qt = QuestMgr.GetTemplate(trigger.Text.NextUInt()); if (qt != null) { var questReceiver = trigger.Args.Character.Target as Character; if (questReceiver != null) { QuestHandler.SendComplete(qt, questReceiver); } } trigger.Reply("Done."); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { var qt = QuestMgr.GetTemplate(trigger.Text.NextUInt()); if (qt != null) { var questGiver = trigger.Args.Character as IQuestHolder; var questReceiver = (Character)trigger.Args.Character.Target; if (questGiver != null) { QuestHandler.SendDetails(questGiver, qt, questReceiver, false); } } trigger.Reply("Done."); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { QuestTemplate template = QuestMgr.GetTemplate(trigger.Text.NextUInt()); if (template != null) { Character target = trigger.Args.Character.Target as Character; if (target != null) { QuestHandler.SendComplete(template, target); } } trigger.Reply("Done."); }
public QuestTemplate GetTemplate(CmdTrigger <RealmServerCmdArgs> trigger) { uint questId = GetQuestId(trigger); if (questId == 0U) { return(null); } QuestTemplate template = QuestMgr.GetTemplate(questId); if (template == null) { trigger.Reply("Invalid Id - Use: 'Quest Lookup <search term>' to find quest-ids."); } return(template); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { QuestTemplate template = QuestMgr.GetTemplate(trigger.Text.NextUInt()); if (template != null) { IQuestHolder character = trigger.Args.Character as IQuestHolder; Character target = (Character)trigger.Args.Character.Target; if (character != null) { QuestHandler.SendDetails(character, template, target, false); } } trigger.Reply("Done."); }
public static void HandlePushQuestToParty(IRealmClient client, RealmPacketIn packet) { QuestTemplate qt = QuestMgr.GetTemplate(packet.ReadUInt32()); if (qt == null || !qt.Sharable || client.ActiveCharacter.QuestLog.GetActiveQuest(qt.Id) == null) { return; } Group group = client.ActiveCharacter.Group; if (group == null) { return; } group.ForeachCharacter(chr => { if (chr == null) { return; } if (chr.QuestLog.ActiveQuestCount >= 25) { SendQuestPushResult(chr, QuestPushResponse.QuestlogFull, client.ActiveCharacter); } else if (chr.QuestLog.GetActiveQuest(qt.Id) != null) { SendQuestPushResult(chr, QuestPushResponse.AlreadyHave, client.ActiveCharacter); } else if (chr.QuestLog.FinishedQuests.Contains(qt.Id) && !qt.Repeatable) { SendQuestPushResult(chr, QuestPushResponse.AlreadyFinished, client.ActiveCharacter); } else if (qt.CheckBasicRequirements(chr) != QuestInvalidReason.Ok || !chr.IsAlive) { SendQuestPushResult(chr, QuestPushResponse.CannotTake, client.ActiveCharacter); } else if (!chr.IsInRadius(client.ActiveCharacter, 30f)) { SendQuestPushResult(chr, QuestPushResponse.TooFar, client.ActiveCharacter); } else { SendQuestPushResult(chr, QuestPushResponse.Sharing, client.ActiveCharacter); SendDetails(client.ActiveCharacter, qt, chr, true); } }); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { var target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", target); } else { var chr = (Character)target; var id = trigger.Text.NextUInt(0); QuestTemplate templ = null; if (id > 0) { templ = QuestMgr.GetTemplate(id); } if (templ == null) { trigger.Reply("Invalid QuestId: {0}", id); } else { if (!chr.QuestLog.RemoveFinishedQuest(id)) { // if its not already been finished, maybe it's still in progress? chr.QuestLog.Cancel(id); } var quest = chr.QuestLog.AddQuest(templ); if (quest == null) { trigger.Reply("Could not add Quest: " + templ); } else { trigger.Reply("Quest added: " + templ); } } } }
public static void HandleQuestGiverAcceptQuest(IRealmClient client, RealmPacketIn packet) { var guid = packet.ReadEntityId(); var chr = client.ActiveCharacter; var qGiver = chr.QuestLog.GetQuestGiver(guid); var questid = packet.ReadUInt32(); var qt = QuestMgr.GetTemplate(questid); //if it's item then check if has associated //character - has the quest and it is shareable //gameobject - has the quest, has all the requirements if (qt != null && qGiver != null) { if (qGiver.QuestHolderInfo.QuestStarts.Contains(qt)) { chr.QuestLog.TryAddQuest(qt, qGiver); } } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { Unit target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", (object)target); } else { Character character = (Character)target; uint id = trigger.Text.NextUInt(0U); QuestTemplate qt = (QuestTemplate)null; if (id > 0U) { qt = QuestMgr.GetTemplate(id); } if (qt == null) { trigger.Reply("Invalid QuestId: {0}", (object)id); } else { if (!character.QuestLog.RemoveFinishedQuest(id)) { character.QuestLog.Cancel(id); } if (character.QuestLog.AddQuest(qt) == null) { trigger.Reply("Could not add Quest: " + (object)qt); } else { trigger.Reply("Quest added: " + (object)qt); } } } }
public static void FixIt() { //The Emblazoned Runeblade var quest = QuestMgr.GetTemplate(12619); quest.QuestFinished += EmblazonRuneBladeQuestFinished; //The Endless Hunger quest = QuestMgr.GetTemplate(12848); var index = quest.GetInteractionTemplateFor(NPCId.UnworthyInitiate).Index; quest.AddLinkedNPCInteractions(index, NPCId.UnworthyInitiate_2, NPCId.UnworthyInitiate_3, NPCId.UnworthyInitiate_4, NPCId.UnworthyInitiate_5); //Death Comes From On High quest = QuestMgr.GetTemplate(12641); quest.QuestCancelled += DeathComesFromOnHighCancelled; //make the go sparkle, we dont click the eye //we must click the holder under it! quest.AddGOInteraction(GOEntryId.EyeOfAcherusControlMechanism, 0); }
internal static void EnsureItemQuestRelations() { // Collect quests foreach (var quest in QuestMgr.Templates) { if (quest == null) { continue; } if (quest.CollectableItems == null) { continue; } foreach (var itemInfo in quest.CollectableItems) { var item = GetTemplate(itemInfo.ItemId); if (item == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", quest, itemInfo); } else { if (item.CollectQuests == null) { item.CollectQuests = new[] { quest }; } else { ArrayUtil.AddOnlyOne(ref item.CollectQuests, quest); } } } foreach (var itemInfo in quest.CollectableSourceItems) { var item = GetTemplate(itemInfo.ItemId); if (item == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", quest, itemInfo); } else { if (item.CollectQuests == null) { item.CollectQuests = new[] { quest }; } else { ArrayUtil.AddOnlyOne(ref item.CollectQuests, quest); } } } } // Item QuestGivers foreach (var item in Templates) { if (item != null && item.QuestId != 0) { var quest = QuestMgr.GetTemplate(item.QuestId); if (quest == null) { ContentMgr.OnInvalidDBData("Item {0} had invalid QuestId: {1}", item, item.QuestId); continue; } quest.Starters.Add(item); } } }
public static void HandlePushQuestToParty(IRealmClient client, RealmPacketIn packet) { var questid = packet.ReadUInt32(); var qt = QuestMgr.GetTemplate(questid); if (qt != null && qt.Sharable) { var qst = client.ActiveCharacter.QuestLog.GetActiveQuest(qt.Id); if (qst != null) { var group = client.ActiveCharacter.Group; if (group != null) { group.ForeachCharacter(chr => { if (chr == null) { return; } if (chr.QuestLog.ActiveQuestCount >= QuestLog.MaxQuestCount) { SendQuestPushResult(chr, QuestPushResponse.QuestlogFull, client.ActiveCharacter); return; } if (chr.QuestLog.GetActiveQuest(qt.Id) != null) { SendQuestPushResult(chr, QuestPushResponse.AlreadyHave, client.ActiveCharacter); return; } if (chr.QuestLog.FinishedQuests.Contains(qt.Id) && !qt.Repeatable) { SendQuestPushResult(chr, QuestPushResponse.AlreadyFinished, client.ActiveCharacter); return; } if ((qt.CheckBasicRequirements(chr) != QuestInvalidReason.Ok) || !chr.IsAlive) { SendQuestPushResult(chr, QuestPushResponse.CannotTake, client.ActiveCharacter); return; } // not sure about range if (!chr.IsInRadius(client.ActiveCharacter, 30f)) { SendQuestPushResult(chr, QuestPushResponse.TooFar, client.ActiveCharacter); return; } /* * if (chr.CanInteractWith(client.ActiveCharacter){ * // bank, trading, combat, talking to a quest npc allready, accepting a quest from another person sharing a quest * QuestMgr.SendQuestPushResult(chr, QuestPushResponse.Busy, client.ActiveCharacter); * continue; * } */ SendQuestPushResult(chr, QuestPushResponse.Sharing, client.ActiveCharacter); SendDetails(client.ActiveCharacter, qt, chr, true); }); } } } }
internal static void EnsureItemQuestRelations() { foreach (QuestTemplate template1 in QuestMgr.Templates) { if (template1 != null && template1.CollectableItems != null) { foreach (Asda2ItemStackDescription collectableItem in template1.CollectableItems) { ItemTemplate template2 = GetTemplate(collectableItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne(ref template2.CollectQuests, template1); } } foreach (Asda2ItemStackDescription collectableSourceItem in template1.CollectableSourceItems) { ItemTemplate template2 = GetTemplate(collectableSourceItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableSourceItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne(ref template2.CollectQuests, template1); } } } } foreach (ItemTemplate template1 in Templates) { if (template1 != null && template1.QuestId != 0U) { QuestTemplate template2 = QuestMgr.GetTemplate(template1.QuestId); if (template2 == null) { ContentMgr.OnInvalidDBData("Item {0} had invalid QuestId: {1}", (object)template1, (object)template1.QuestId); } else { template2.Starters.Add(template1); } } } }