public static bool CheckSkill(PlayerMobile player, Skill skill) { for (int i = player.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = player.Quests[i]; for (int j = quest.Objectives.Count - 1; j >= 0; j--) { BaseObjective objective = quest.Objectives[j]; if (objective is ApprenticeObjective) { ApprenticeObjective apprentice = (ApprenticeObjective)objective; if (apprentice.Update(skill)) { if (quest.Completed) { quest.OnCompleted(); } else if (apprentice.Completed) { player.PlaySound(quest.UpdateSound); } } } } } return(false); }
public static bool CheckItem(PlayerMobile player, Item item) { for (int i = player.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = player.Quests[i]; for (int j = quest.Objectives.Count - 1; j >= 0; j--) { BaseObjective objective = quest.Objectives[j]; if (objective is ObtainObjective) { ObtainObjective obtain = (ObtainObjective)objective; if (obtain.Update(item)) { if (quest.Completed) { quest.OnCompleted(); } else if (obtain.Completed) { player.PlaySound(quest.UpdateSound); } return(true); } } } } return(false); }
public static bool CheckRewardItem(PlayerMobile player, Item item) { for (var index = 0; index < player.Quests.Count; index++) { BaseQuest quest = player.Quests[index]; for (var i = 0; i < quest.Objectives.Count; i++) { var obj = quest.Objectives[i]; if (obj is ObtainObjective) { for (var index1 = 0; index1 < quest.Objectives.Count; index1++) { BaseObjective objective = quest.Objectives[index1]; if (objective is ObtainObjective obtain && obtain.IsObjective(item)) { obtain.CurProgress += item.Amount; quest.OnObjectiveUpdate(item); return(true); } } break; } } } return(false); }
public virtual void Deserialize(GenericReader reader) { int version = reader.ReadEncodedInt(); switch (reader.ReadInt()) { case 0x0: m_Quester = null; break; case 0x1: m_Quester = reader.ReadMobile() as MondainQuester; break; case 0x2: m_Quester = reader.ReadItem() as BaseQuestItem; break; } if (m_Quester is BaseEscort) { BaseEscort escort = (BaseEscort)m_Quester; escort.Quest = this; } else if (m_Quester is BaseQuestItem) { BaseQuestItem item = (BaseQuestItem)m_Quester; item.Quest = this; } for (int i = 0; i < m_Objectives.Count; i++) { BaseObjective objective = m_Objectives[i]; objective.Deserialize(reader); } }
public static bool EnhancedSkill(PlayerMobile player, Skill skill) { if (player == null || player.Region == null || skill == null) { return(false); } for (int i = player.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = player.Quests[i]; for (int j = quest.Objectives.Count - 1; j >= 0; j--) { BaseObjective objective = quest.Objectives[j]; if (objective is ApprenticeObjective && !objective.Completed) { ApprenticeObjective apprentice = (ApprenticeObjective)objective; if (apprentice.Region != null) { if (player.Region.IsPartOf(apprentice.Region) && skill.SkillName == apprentice.Skill) { return(true); } } } } } return(false); }
public virtual void OnAccept() { m_Owner.PlaySound(AcceptSound); m_Owner.SendLocalizedMessage(1049019); // You have accepted the Quest. m_Owner.Quests.Add(this); // give items if any for (int i = 0; i < m_Objectives.Count; i++) { BaseObjective objective = m_Objectives[i]; objective.OnAccept(); } if (m_Quester is BaseEscort) { BaseEscort escort = (BaseEscort)m_Quester; if (escort.SetControlMaster(m_Owner)) { escort.Quest = this; escort.LastSeenEscorter = DateTime.Now; escort.StartFollow(); escort.AddHash(Owner); escort.Say(1042806, "destination"); // Lead on! Payment will be made when we arrive at ~1_DESTINATION~! m_Owner.LastEscortTime = DateTime.Now; } } // tick tack StartTimer(); }
public static bool CanOffer(PlayerMobile from, BaseQuest quest, bool message) { if (!quest.CanOffer()) return false; // if a player wants to start quest chain (already started) again (not osi) if (quest.ChainID != QuestChain.None && FirstChainQuest(quest, quest.Quester) && from.Chains.ContainsKey(quest.ChainID)) return false; if (!Delayed(from, quest, message)) return false; for (int i = quest.Objectives.Count - 1; i >= 0; i --) { Type type = quest.Objectives[i].Type(); if (type == null) continue; for (int j = from.Quests.Count - 1; j >= 0; j --) { BaseQuest pQuest = from.Quests[j]; for (int k = pQuest.Objectives.Count - 1; k >= 0; k --) { BaseObjective obj = pQuest.Objectives[k]; if (type == obj.Type()) return false; } } } return true; }
public virtual void Serialize(GenericWriter writer) { writer.WriteEncodedInt((int)0); // version if (m_Quester == null) { writer.Write((int)0x0); } else if (m_Quester is Mobile) { writer.Write((int)0x1); writer.Write((Mobile)m_Quester); } else if (m_Quester is Item) { writer.Write((int)0x2); writer.Write((Item)m_Quester); } for (int i = 0; i < m_Objectives.Count; i++) { BaseObjective objective = m_Objectives[i]; objective.Serialize(writer); } }
public virtual void Slice() { for (int i = 0; i < m_Objectives.Count; i++) { BaseObjective obj = m_Objectives[i]; obj.UpdateTime(); } }
public virtual void Deserialize(GenericReader reader) { int version = reader.ReadEncodedInt(); if (version > 0) { string questerType = reader.ReadString(); if (questerType != null) { m_QuesterType = ScriptCompiler.FindTypeByName(questerType); } } switch (reader.ReadInt()) { case 0x0: m_Quester = null; break; case 0x1: m_Quester = reader.ReadMobile() as NewQuester; break; case 0x2: m_Quester = reader.ReadItem() as BaseQuestItem; break; } /* * if (m_Quester is BaseEscort) * { * BaseEscort escort = (BaseEscort)m_Quester; * * escort.Quest = this; * } */ if (m_Quester is BaseQuestItem) { BaseQuestItem item = (BaseQuestItem)m_Quester; item.Quest = this; } if (version == 0 && m_Quester != null) { m_QuesterType = m_Quester.GetType(); } for (int i = 0; i < m_Objectives.Count; i++) { BaseObjective objective = m_Objectives[i]; objective.Deserialize(reader); } }
public static void DeleteItems(BaseQuest quest) { for (int i = 0; i < quest.Objectives.Count; i++) { BaseObjective objective = quest.Objectives[i]; DeleteItems(quest.Owner, objective.Type(), objective.MaxProgress, true); RemoveStatus(quest.Owner, objective.Type()); } }
public static bool CanOffer(PlayerMobile from, BaseQuest quest, object quester, bool message) { if (!quest.CanOffer()) { return(false); } if (quest.ChainID != QuestChain.None) { // if a player wants to start quest chain (already started) again (not osi) if (from.Chains.ContainsKey(quest.ChainID) && FirstChainQuest(quest, quest.Quester)) { return(false); } // if player already has an active quest from the chain if (InChainProgress(from, quest)) { return(false); } } if (!Delayed(from, quest, quester, message)) { return(false); } for (int i = quest.Objectives.Count - 1; i >= 0; i--) { Type type = quest.Objectives[i].Type(); if (type == null) { continue; } for (int j = from.Quests.Count - 1; j >= 0; j--) { BaseQuest pQuest = from.Quests[j]; for (int k = pQuest.Objectives.Count - 1; k >= 0; k--) { BaseObjective obj = pQuest.Objectives[k]; if (type == obj.Type() && (quest.ChainID == QuestChain.None || quest.ChainID == pQuest.ChainID)) { return(false); } } } } return(true); }
public override bool RenderObjective(MondainQuestGump gump, bool offer) { int offset = 172; BaseObjective first = null; for (var index = 0; index < Objectives.Count; index++) { var o = Objectives[index]; if (o is SlayObjective) { first = o; break; } } SlayObjective slay = first as SlayObjective; for (int i = 0; i < Objectives.Count - 1; i++) { if (i != 0 && i % 3 == 0) { gump.SecObjectivesButtons(); offset = 172; } if (i == 0) { gump.AddHtmlLocalized(98, offset, 312, 16, 1072204, 0x15F90, false, false); // Slay if (slay != null) { gump.AddLabel(133, offset, 0x481, slay.MaxProgress.ToString()); // Count gump.AddLabel(163, offset, 0x481, slay.Name); // Name offset += 16; if (!offer) { gump.AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total gump.AddLabel(223, offset, 0x481, slay.CurProgress.ToString()); // %current progress% offset += 16; } } } gump.AddHtmlLocalized(98, offset, 312, 80, 1150933 + i, 0x15F90, false, false); offset += 80; } return(true); }
public virtual void AddObjective(BaseObjective objective) { if (m_Objectives == null) { m_Objectives = new List <BaseObjective>(); } if (objective != null) { objective.Quest = this; m_Objectives.Add(objective); } }
public static bool CheckSkill(PlayerMobile player, Skill skill) { for (int i = player.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = player.Quests[i]; for (int j = quest.Objectives.Count - 1; j >= 0; j--) { BaseObjective objective = quest.Objectives[j]; } } return(false); }
public static void CompleteQuest(PlayerMobile from, BaseQuest quest) { if (quest == null) return; for (int i = 0; i < quest.Objectives.Count; i ++) { BaseObjective obj = quest.Objectives[i]; obj.Complete(); } from.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete. from.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true)); from.PlaySound(quest.CompleteSound); quest.OnCompleted(); }
public void Update(Type t) { for (var index = 0; index < Objectives.Count; index++) { BaseObjective objective = Objectives[index]; if (objective is InternalObjective obj && obj.Update(t)) { if (Completed) { OnCompleted(); } else if (obj.Completed) { Owner.SendSound(UpdateSound); } } } }
public static bool EnhancedSkill(PlayerMobile player, Skill skill) { if (player == null || player.Region == null || skill == null) { return(false); } for (int i = player.Quests.Count - 1; i >= 0; i--) { BaseQuest quest = player.Quests[i]; for (int j = quest.Objectives.Count - 1; j >= 0; j--) { BaseObjective objective = quest.Objectives[j]; } } return(false); }
public static bool DeliveryArrived(PlayerMobile player, BaseVendor vendor) { for (int i = 0; i < player.Quests.Count; i++) { BaseQuest quest = player.Quests[i]; for (int j = 0; j < quest.Objectives.Count; j++) { BaseObjective objective = quest.Objectives[j]; if (objective is DeliverObjective) { DeliverObjective deliver = (DeliverObjective)objective; if (deliver.Update(vendor)) { if (quest.Completed) { player.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete. player.PlaySound(quest.CompleteSound); quest.OnCompleted(); player.CloseGump(typeof(BaseQuestGump)); if (vendor is MondainQuester) { player.SendGump(new MLQuestFinishGump(player, quest, (MondainQuester)vendor)); } else { player.SendGump(new MLQuestFinishGump(player, quest)); } } return(true); } } } } return(false); }
public virtual void OnAccept() { this.m_Owner.PlaySound(this.AcceptSound); this.m_Owner.SendLocalizedMessage(1049019); // You have accepted the Quest. this.m_Owner.Quests.Add(this); // give items if any for (int i = 0; i < this.m_Objectives.Count; i++) { BaseObjective objective = this.m_Objectives[i]; objective.OnAccept(); } if (this.m_Quester is BaseEscort) { BaseEscort escort = (BaseEscort)this.m_Quester; if (escort.SetControlMaster(this.m_Owner)) { escort.Quest = this; escort.LastSeenEscorter = DateTime.UtcNow; escort.StartFollow(); escort.AddHash(this.Owner); Region region = escort.GetDestination(); if (region != null) { escort.Say(1042806, region.Name); // Lead on! Payment will be made when we arrive at ~1_DESTINATION~! } else { escort.Say(1042806, "destination"); // Lead on! Payment will be made when we arrive at ~1_DESTINATION~! } this.m_Owner.LastEscortTime = DateTime.UtcNow; } } // tick tack this.StartTimer(); }
public static void CompleteQuest(PlayerMobile from, BaseQuest quest) { if (quest == null) { return; } for (int i = 0; i < quest.Objectives.Count; i++) { BaseObjective obj = quest.Objectives[i]; obj.Complete(); } from.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete. from.CloseGump(typeof(BaseQuestGump)); from.SendGump(new MLQuestFinishGump(from, quest)); from.PlaySound(quest.CompleteSound); quest.OnCompleted(); }
public virtual void OnAccept() { m_Owner.PlaySound(AcceptSound); m_Owner.SendLocalizedMessage(1049019); // You have accepted the Quest. m_Owner.Quests.Add(this); // give items if any for (int i = 0; i < m_Objectives.Count; i++) { BaseObjective objective = m_Objectives[i]; objective.OnAccept(); } /* * if (m_Quester is BaseEscort) * { * BaseEscort escort = (BaseEscort)m_Quester; * * if (escort.SetControlMaster(m_Owner)) * { * escort.Quest = this; * escort.LastSeenEscorter = DateTime.UtcNow; * escort.StartFollow(); * escort.AddHash(Owner); * * Region region = escort.GetDestination(); * * if (region != null) * escort.Say(1042806, region.Name); // Lead on! Payment will be made when we arrive at ~1_DESTINATION~! * else * escort.Say(1042806, "destination"); // Lead on! Payment will be made when we arrive at ~1_DESTINATION~! * * m_Owner.LastEscortTime = DateTime.UtcNow; * } * } */ // tick tack StartTimer(); }
public virtual void AddObjective(BaseObjective objective) { if (this.m_Objectives == null) this.m_Objectives = new List<BaseObjective>(); if (objective != null) { objective.Quest = this; this.m_Objectives.Add(objective); } }
public virtual void SecObjectives() { if (m_Quest == null) { return; } if (!m_Quest.RenderObjective(this, m_Offer)) { if (m_Offer) { AddHtmlLocalized(130, 45, 270, 16, 1049010, 0xFFFFFF, false, false); // Quest Offer } else { AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log } AddHtmlObject(160, 70, 200, 40, m_Quest.Title, DarkGreen, false, false); AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective: if (m_Quest.AllObjectives) { AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following } else { AddHtmlLocalized(98, 156, 312, 16, 1072209, 0x2710, false, false); // Only one of the following } int offset = 172; for (int i = 0; i < m_Quest.Objectives.Count; i++) { BaseObjective objective = m_Quest.Objectives[i]; if (objective is SlayObjective) { SlayObjective slay = (SlayObjective)objective; if (slay != null) { AddHtmlLocalized(98, offset, 30, 16, 1072204, 0x15F90, false, false); // Slay AddLabel(133, offset, 0x481, slay.MaxProgress + " " + slay.Name); // %count% + %name% offset += 16; if (m_Offer) { if (slay.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(slay.Seconds)); // %est. time remaining% offset += 16; } continue; } if (slay.Region != null) { AddHtmlLocalized(103, offset, 312, 20, 1018327, 0x15F90, false, false); // Location AddHtmlObject(223, offset, 312, 20, slay.Region.Name, White, false, false); // %location% offset += 16; } AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total AddLabel(223, offset, 0x481, slay.CurProgress.ToString()); // %current progress% offset += 16; if (ReturnTo() != null) { AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false); // Return to AddLabel(223, offset, 0x481, ReturnTo()); // %return to% offset += 16; } if (slay.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(slay.Seconds)); // %est. time remaining% offset += 16; } } } else if (objective is ObtainObjective) { ObtainObjective obtain = (ObtainObjective)objective; if (obtain != null) { AddHtmlLocalized(98, offset, 40, 16, 1072205, 0x15F90, false, false); // Obtain AddLabel(143, offset, 0x481, obtain.MaxProgress + " " + obtain.Name); // %count% + %name% if (obtain.Image > 0) { AddItem(350, offset, obtain.Image, obtain.Hue); // Image } offset += 16; if (m_Offer) { if (obtain.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(obtain.Seconds)); // %est. time remaining% offset += 16; } else if (obtain.Image > 0) { offset += 16; } continue; } AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total AddLabel(223, offset, 0x481, obtain.CurProgress.ToString()); // %current progress% offset += 16; if (ReturnTo() != null) { AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false); // Return to AddLabel(223, offset, 0x481, ReturnTo()); // %return to% offset += 16; } if (obtain.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(obtain.Seconds)); // %est. time remaining% offset += 16; } } } else if (objective is DeliverObjective) { DeliverObjective deliver = (DeliverObjective)objective; if (deliver != null) { AddHtmlLocalized(98, offset, 40, 16, 1072207, 0x15F90, false, false); // Deliver AddLabel(143, offset, 0x481, deliver.MaxProgress + " " + deliver.DeliveryName); // %name% offset += 16; AddHtmlLocalized(103, offset, 120, 16, 1072379, 0x15F90, false, false); // Deliver to AddLabel(223, offset, 0x481, deliver.DestName); // %deliver to% offset += 16; if (deliver.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(deliver.Seconds)); // %est. time remaining% offset += 16; } } } else if (objective is EscortObjective) { EscortObjective escort = (EscortObjective)objective; if (escort != null) { AddHtmlLocalized(98, offset, 50, 16, 1072206, 0x15F90, false, false); // Escort to AddHtmlObject(153, offset, 200, 16, escort.Region.Name, White, false, false); offset += 16; if (escort.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(escort.Seconds)); // %est. time remaining% offset += 16; } } } else if (objective is ApprenticeObjective) { ApprenticeObjective apprentice = (ApprenticeObjective)objective; if (apprentice != null) { AddHtmlLocalized(98, offset, 200, 16, 1077485, "#" + (1044060 + (int)apprentice.Skill) + "\t" + apprentice.MaxProgress, 0x15F90, false, false); // Increase ~1_SKILL~ to ~2_VALUE~ offset += 16; } } else if (objective is SimpleObjective && ((SimpleObjective)objective).Descriptions != null) { SimpleObjective obj = (SimpleObjective)objective; for (int j = 0; j < obj.Descriptions.Count; j++) { offset += 16; AddLabel(98, offset, 0x481, obj.Descriptions[j]); } if (obj.Timed) { offset += 16; AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(obj.Seconds)); // %est. time remaining% } } } } if (m_Offer) { AddButton(95, 455, 0x2EE0, 0x2EE2, (int)Buttons.AcceptQuest, GumpButtonType.Reply, 0); AddButton(313, 455, 0x2EF2, 0x2EF4, (int)Buttons.RefuseQuest, GumpButtonType.Reply, 0); } else { AddButton(95, 455, 0x2EF5, 0x2EF7, (int)Buttons.ResignQuest, GumpButtonType.Reply, 0); AddButton(313, 455, 0x2EEC, 0x2EEE, (int)Buttons.CloseQuest, GumpButtonType.Reply, 0); } AddButton(130, 430, 0x2EEF, 0x2EF1, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0); AddButton(275, 430, 0x2EE9, 0x2EEB, (int)Buttons.NextPage, GumpButtonType.Reply, 0); }
public void SecObjectives() { int limit = m_Offer ? 7 : 5; SecObjectivesButtons(); if (!m_Quest.RenderObjective(this, m_Offer)) { int offset = 172; for (int i = 0; i < m_Quest.Objectives.Count; i++) { if (i != 0 && i % limit == 0) { SecObjectivesButtons(); offset = 172; } BaseObjective objective = m_Quest.Objectives[i]; if (objective is SlayObjective slay) { AddHtmlLocalized(98, offset, 312, 16, 1072204, 0x15F90, false, false); // Slay AddLabel(133, offset, 0x481, slay.MaxProgress.ToString()); // Count AddLabel(163, offset, 0x481, slay.Name); // Name offset += 16; if (m_Offer) { if (slay.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(slay.Seconds)); // %est. time remaining% offset += 16; } } if (slay.Region != null || slay.Label > 0) { AddHtmlLocalized(103, offset, 312, 20, 1018327, 0x15F90, false, false); // Location if (slay.Label > 0) { AddHtmlLocalized(223, offset, 312, 20, slay.Label, 0xFFFFFF, false, false); } else { AddHtmlObject(223, offset, 312, 20, slay.Region, White, false, false); // %location% } offset += 16; } if (!m_Offer) { AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total AddLabel(223, offset, 0x481, slay.CurProgress.ToString()); // %current progress% offset += 16; if (ReturnTo() != null) { AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false); // Return to AddLabel(223, offset, 0x481, ReturnTo()); // %return to% offset += 16; } if (slay.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(slay.Seconds)); // %est. time remaining% offset += 16; } } } else if (objective is ObtainObjective obtain) { AddHtmlLocalized(98, offset, 350, 16, 1072205, 0x15F90, false, false); // Obtain AddLabel(143, offset, 0x481, obtain.MaxProgress.ToString()); // %count% AddLabel(185, offset, 0x481, obtain.Name); // %name% if (obtain.Image > 0) { AddItem(285, offset, obtain.Image, obtain.Hue); // Image } offset += 16; if (m_Offer) { if (obtain.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(obtain.Seconds)); // %est. time remaining% offset += 16; } else if (obtain.Image > 0) { offset += 16; } continue; } AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total AddLabel(223, offset, 0x481, obtain.CurProgress.ToString()); // %current progress% offset += 16; if (ReturnTo() != null) { AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false); // Return to AddLabel(223, offset, 0x481, ReturnTo()); // %return to% offset += 16; } if (obtain.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(obtain.Seconds)); // %est. time remaining% offset += 16; } } else if (objective is DeliverObjective deliver) { AddHtmlLocalized(98, offset, 40, 16, 1072207, 0x15F90, false, false); // Deliver AddLabel(143, offset, 0x481, deliver.MaxProgress.ToString()); // %count% AddLabel(158, offset, 0x481, deliver.DeliveryName); // %name% offset += 16; AddHtmlLocalized(103, offset, 120, 16, 1072379, 0x15F90, false, false); // Deliver to AddLabel(223, offset, 0x481, deliver.DestName); // %deliver to% offset += 16; if (deliver.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(deliver.Seconds)); // %est. time remaining% offset += 16; } } else if (objective is EscortObjective escort) { if (escort != null) { AddHtmlLocalized(98, offset, 312, 16, 1072206, 0x15F90, false, false); // Escort to if (escort.Label == 0) { AddHtmlObject(173, offset, 200, 16, escort.Region, 0xFFFFFF, false, false); } else { AddHtmlLocalized(173, offset, 200, 16, escort.Label, 0xFFFFFF, false, false); } offset += 16; if (escort.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(escort.Seconds)); // %est. time remaining% offset += 16; } } } else if (objective is ApprenticeObjective apprentice) { if (apprentice != null) { AddHtmlLocalized(98, offset, 200, 16, 1077485, "#" + (1044060 + (int)apprentice.Skill) + "\t" + apprentice.MaxProgress, 0x15F90, false, false); // Increase ~1_SKILL~ to ~2_VALUE~ offset += 16; } } else if (objective is SimpleObjective obj && obj.Descriptions != null) { for (int j = 0; j < obj.Descriptions.Count; j++) { offset += 16; AddLabel(98, offset, 0x481, obj.Descriptions[j]); } if (obj.Timed) { offset += 16; AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabel(223, offset, 0x481, FormatSeconds(obj.Seconds)); // %est. time remaining% } } else if (objective.ObjectiveDescription != null) { if (objective.ObjectiveDescription is int iDesc) { AddHtmlLocalized(98, offset, 310, 300, iDesc, 0x15F90, false, false); } else if (objective.ObjectiveDescription is string sDesc) { AddHtmlObject(98, offset, 310, 300, sDesc, 0x15F90, false, false); } } }
public MLQuestLogGump(BaseQuest quest) : base(75, 25) { m_Quest = quest; Intern(""); AddPage(1); Closable = false; AddImageTiled(50, 20, 400, 400, 0x1404); AddImageTiled(50, 29, 30, 390, 0x28DC); AddImageTiled(34, 140, 17, 279, 0x242F); AddImage(48, 135, 0x28AB); AddImage(-16, 285, 0x28A2); AddImage(0, 10, 0x28B5); AddImage(25, 0, 0x28B4); AddImageTiled(83, 15, 350, 15, 0x280A); AddImage(34, 419, 0x2842); AddImage(442, 419, 0x2840); AddImageTiled(51, 419, 392, 17, 0x2775); AddImageTiled(415, 29, 44, 390, 0xA2D); AddImageTiled(415, 29, 30, 390, 0x28DC); AddLabelIntern(100, 50, 0x481, 0); AddImage(370, 50, 0x589); AddImage(379, 60, 0x15A9); AddImage(425, 0, 0x28C9); AddImage(90, 33, 0x232D); AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log AddImageTiled(130, 65, 175, 1, 0x238D); AddButton(95, 395, 0x2EF5, 0x2EF7, 1, GumpButtonType.Reply, 0); // Resign AddButton(313, 395, 0x2EEC, 0x2EEE, 2, GumpButtonType.Reply, 0); // Okay if (m_Quest.Failed) { AddHtmlLocalized(160, 80, 250, 16, 500039, 0x3C00, false, false); // Failed! } AddHtmlLocalized(130, 68, 220, 48, 1114513, String.Format("#{0}", quest.Title.ToString()), 0x2710, false, false); if (m_Quest.ChainID != QuestChain.None) { AddHtmlLocalized(98, 140, 312, 16, 1075024, 0x2710, false, false); // Description (quest chain) } else { AddHtmlLocalized(98, 140, 312, 16, 1072202, 0x2710, false, false); // Description } AddHtmlObject(98, 156, 312, 180, quest.Description, LightGreen, false, true); AddButton(275, 370, 0x2EE9, 0x2EEB, 0, GumpButtonType.Page, 2); // Continue AddPage(2); Closable = false; AddImageTiled(50, 20, 400, 400, 0x1404); AddImageTiled(50, 29, 30, 390, 0x28DC); AddImageTiled(34, 140, 17, 279, 0x242F); AddImage(48, 135, 0x28AB); AddImage(-16, 285, 0x28A2); AddImage(0, 10, 0x28B5); AddImage(25, 0, 0x28B4); AddImageTiled(83, 15, 350, 15, 0x280A); AddImage(34, 419, 0x2842); AddImage(442, 419, 0x2840); AddImageTiled(51, 419, 392, 17, 0x2775); AddImageTiled(415, 29, 44, 390, 0xA2D); AddImageTiled(415, 29, 30, 390, 0x28DC); AddLabelIntern(100, 50, 0x481, 0); AddImage(370, 50, 0x589); AddImage(379, 60, 0x15A9); AddImage(425, 0, 0x28C9); AddImage(90, 33, 0x232D); AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log AddImageTiled(130, 65, 175, 1, 0x238D); AddButton(95, 395, 0x2EF5, 0x2EF7, 1, GumpButtonType.Reply, 0); AddButton(313, 395, 0x2EEC, 0x2EEE, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(130, 68, 220, 48, 1114513, String.Format("#{0}", quest.Title.ToString()), 0x2710, false, false); AddButton(275, 370, 0x2EE9, 0x2EEB, 0, GumpButtonType.Page, 2); AddButton(130, 370, 0x2EEF, 0x2EF1, 0, GumpButtonType.Page, 1); AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective: if (m_Quest.AllObjectives) { AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following } else { AddHtmlLocalized(98, 156, 312, 16, 1072209, 0x2710, false, false); // Only one of the following } int offset = 172; int internidx = 0; for (int i = 0; i < m_Quest.Objectives.Count; i++) { int field = 1; BaseObjective objective = m_Quest.Objectives[i]; if (objective is ObtainObjective) { ObtainObjective obtain = (ObtainObjective)objective; string returnTo = ReturnTo(); AddKRHtmlLocalized(0, 0, 0, 0, -3, false, false); /*1*/ Intern(obtain.MaxProgress.ToString()); /*2*/ Intern(obtain.Name); /*3*/ Intern(obtain.Timed ? obtain.Seconds.ToString() : ""); /*4*/ Intern(""); /*5*/ Intern(""); /*6*/ Intern(obtain.CurProgress.ToString()); /*7*/ Intern(returnTo); AddHtmlLocalized(98, offset, 350, 16, 1072205, 0x15F90, false, false); // Obtain AddLabelIntern(143, offset, 0x481, 1 + (internidx * 7)); AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddLabelIntern(173, offset, 0x481, 2 + (internidx * 7)); if (obtain.Image > 0) { AddItem(350, offset, obtain.Image); // Image } offset += 16; AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); if (obtain.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabelIntern(223, offset, 0x481, 3 + (internidx * 7)); // %est. time remaining% offset += 16; } else { AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 3 + (internidx * 7), false, false); } AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 4 + (internidx * 7), false, false); AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 5 + (internidx * 7), false, false); AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total AddLabelIntern(223, offset, 0x481, 6 + (internidx * 7)); offset += 16; AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false); // Return to AddLabelIntern(223, offset, 0x481, 7 + (internidx * 7)); offset += 16; } else if (objective is SlayObjective) { SlayObjective slay = (SlayObjective)objective; int internOffset = internidx * 8; string returnTo = ReturnTo(); AddKRHtmlLocalized(0, 0, 0, 0, -2, false, false); /*1*/ Intern(slay.MaxProgress.ToString()); /*2*/ Intern(slay.Name); /*3*/ Intern(slay.Timed ? slay.Seconds.ToString() : ""); /*4*/ Intern(slay.Region != null ? slay.Region.Name : ""); /*5*/ Intern(""); /*6*/ Intern(""); /*7*/ Intern(slay.CurProgress.ToString()); /*8*/ Intern(returnTo); AddHtmlLocalized(98, offset, 312, 16, 1072204, 0x15F90, false, false); // Slay AddLabelIntern(133, offset, 0x481, 1 + internOffset); // Amount AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddLabelIntern(slay.MaxProgress > 10 ? 163 : 148, offset, 0x481, 2 + internOffset); // Type offset += 16; if (slay.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: AddLabelIntern(223, offset, 0x481, 3 + internOffset); // %est. time remaining% offset += 16; } else { AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 3 + internOffset, false, false); } if (slay.Region != null) { AddHtmlLocalized(103, offset, 312, 20, 1018327, 0x15F90, false, false); // Location AddLabelIntern(223, offset, 0x481, 4 + internOffset); // %est. time remaining% offset += 16; } else { AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 4 + internOffset, false, false); } AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 5 + internOffset, false, false); AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, 6 + internOffset, false, false); AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false); // Total AddLabelIntern(223, offset, 0x481, 7 + internOffset); offset += 16; AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false); // Return to AddLabelIntern(223, offset, 0x481, 8 + internOffset); offset += 16; } else if (objective is DeliverObjective) { DeliverObjective deliver = (DeliverObjective)objective; int internOffset = internidx * 5; AddKRHtmlLocalized(0, 0, 0, 0, -5, false, false); AddHtmlLocalized(98, offset, 312, 16, 1072207, 0x15F90, false, false); // Deliver Intern(deliver.MaxProgress.ToString()); Intern(deliver.DeliveryName); AddLabelIntern(143, offset, 0x481, internOffset + 1); AddLabelIntern(158, offset, 0x481, internOffset + 2); offset += 16; AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); if (deliver.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: Intern(deliver.Seconds.ToString()); AddLabelIntern(223, offset, 0x481, internOffset + 3); // %est. time remaining% offset += 16; } else { AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, internOffset + 3, false, false); Intern(""); } AddHtmlLocalized(103, offset, 120, 16, 1072379, 0x15F90, false, false); // Deliver to Intern(deliver.DestName); AddLabelIntern(223, offset, 0x481, internOffset + 4); offset += 16; AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, internOffset + 5, false, false); Intern(""); } else if (objective is EscortObjective) { EscortObjective escort = (EscortObjective)objective; AddKRHtmlLocalized(0, 0, 0, 0, -4, false, false); AddHtmlLocalized(98, offset, 312, 16, 1072206, 0x15F90, false, false); // Escort to AddHtmlObject(173, offset, 312, 20, escort.Region.Name, 0xFFFFFF, false, false); offset += 16; if (escort.Timed) { AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false); // Est. time remaining: Intern(escort.Seconds.ToString()); AddLabelIntern(223, offset, 0x481, (internidx * 3) + (field++)); // %est. time remaining% offset += 16; } for (int j = field; j < 3; j++) { AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false); AddKRLabel(0, 0, 0, 0, j, false, false); Intern(""); } } else if (objective is ApprenticeObjective) { ApprenticeObjective apprentice = (ApprenticeObjective)objective; AddKRHtmlLocalized(0, 0, 0, 0, -9, false, false); AddHtmlLocalized(98, offset, 200, 16, 1077485, "#" + (1044060 + (int)apprentice.Skill) + "\t" + apprentice.MaxProgress, 0x15F90, false, false); // Increase ~1_SKILL~ to ~2_VALUE~ offset += 16; } else if (objective is BaseBardObjective) { BaseBardObjective bardObjective = (BaseBardObjective)objective; AddHtmlLocalized(98, offset, 200, 16, bardObjective.Cliloc, 0x15F90, false, false); offset += 16; } internidx++; } AddButton(275, 370, 0x2EE9, 0x2EEB, 0, GumpButtonType.Page, 3); AddPage(3); Closable = false; AddImageTiled(50, 20, 400, 400, 0x1404); AddImageTiled(50, 29, 30, 390, 0x28DC); AddImageTiled(34, 140, 17, 279, 0x242F); AddImage(48, 135, 0x28AB); AddImage(-16, 285, 0x28A2); AddImage(0, 10, 0x28B5); AddImage(25, 0, 0x28B4); AddImageTiled(83, 15, 350, 15, 0x280A); AddImage(34, 419, 0x2842); AddImage(442, 419, 0x2840); AddImageTiled(51, 419, 392, 17, 0x2775); AddImageTiled(415, 29, 44, 390, 0xA2D); AddImageTiled(415, 29, 30, 390, 0x28DC); AddLabelIntern(100, 50, 0x481, 0); AddImage(370, 50, 0x589); AddImage(379, 60, 0x15A9); AddImage(425, 0, 0x28C9); AddImage(90, 33, 0x232D); AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log AddImageTiled(130, 65, 175, 1, 0x238D); AddButton(95, 395, 0x2EF5, 0x2EF7, 1, GumpButtonType.Reply, 0); AddButton(313, 395, 0x2EEC, 0x2EEE, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(130, 68, 220, 48, 1114513, String.Format("#{0}", quest.Title.ToString()), 0x2710, false, false); AddButton(130, 370, 0x2EEF, 0x2EF1, 0, GumpButtonType.Page, 2); AddHtmlLocalized(98, 140, 312, 16, 1072201, 0x2710, false, false); // Reward if (quest.Rewards.Count == 1) { BaseReward reward = m_Quest.Rewards[0]; AddImage(105, 163, 0x4B9); AddHtmlObject(133, 162, 280, 32, reward.Name, 0x15F90, false, false); } else { AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following for (int n = 0; n < quest.Rewards.Count; ++n) { BaseReward reward = m_Quest.Rewards[n]; AddImage(105, 179 + (n * 16), 0x4B9); AddHtmlObject(133, 178 + (n * 16), 280, 32, reward.Name, 0x15F90, false, false); } } }