public DungeonMouldWeaponGump(Mobile gumpTarget, Mobile crafter, Mobile mobileTarget, DungeonMould mould, bool newWeapon, BaseWeapon weapon, DungeonEnum dungeon, int amountDemanded, bool confirmed) : base(10, 10) { m_GumpTarget = gumpTarget; m_Crafter = crafter; m_MobileTarget = mobileTarget; m_DungeonMould = mould; m_NewWeapon = newWeapon; m_Weapon = weapon; m_Dungeon = dungeon; m_AmountDemanded = amountDemanded; m_Confirmed = confirmed; bool selfCraft = (m_Crafter == m_MobileTarget); Closable = true; Disposable = true; Dragable = true; Resizable = false; AddImage(70, 100, 103); AddImage(5, 100, 103); AddImage(70, 5, 103); AddImage(5, 5, 103); AddImage(200, 100, 103); AddImage(200, 5, 103); AddImage(70, 281, 103); AddImage(5, 281, 103); AddImage(70, 186, 103); AddImage(5, 186, 103); AddImage(200, 281, 103); AddImage(200, 186, 103); AddImage(70, 374, 103); AddImage(5, 374, 103); AddImage(200, 374, 103); AddImage(17, 18, 3604, 2052); AddImage(76, 18, 3604, 2052); AddImage(204, 18, 3604, 2052); AddImage(17, 140, 3604, 2052); AddImage(76, 140, 3604, 2052); AddImage(204, 140, 3604, 2052); AddImage(17, 262, 3604, 2052); AddImage(76, 262, 3604, 2052); AddImage(204, 262, 3604, 2052); AddImage(17, 335, 3604, 2052); AddImage(76, 335, 3604, 2052); AddImage(204, 335, 3604, 2052); //----- int WhiteTextHue = 2655; int EffectHue = WhiteTextHue; string offerText = ""; if (!selfCraft) { if (m_GumpTarget == m_MobileTarget) { offerText = "Offer from " + m_Crafter.Name; AddLabel(Utility.CenteredTextOffset(175, offerText), 17, 149, offerText); } } if (m_NewWeapon) { offerText = "Create Dungeon Weapon"; if (selfCraft || m_GumpTarget == m_Crafter) { AddLabel(Utility.CenteredTextOffset(175, offerText), 17, WhiteTextHue, offerText); } else { AddLabel(Utility.CenteredTextOffset(175, offerText), 37, WhiteTextHue, offerText); } } else { offerText = "Upgrade Dungeon Weapon"; if (selfCraft || m_GumpTarget == m_Crafter) { AddLabel(Utility.CenteredTextOffset(175, offerText), 17, WhiteTextHue, offerText); } else { AddLabel(Utility.CenteredTextOffset(175, offerText), 37, WhiteTextHue, offerText); } } //Weapon Info int weaponTier = m_Weapon.TierLevel; string dungeonName = GetDungeonName(m_Dungeon) + " Dungeon"; string weaponName = m_Weapon.Name; if (weaponName == null) { weaponName = ""; } weaponName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(weaponName); int newDurability = DungeonWeapon.BaselineDurability + (DungeonWeapon.IncreasedDurabilityPerTier * weaponTier); int adjustedBlessedCharges = DungeonWeapon.ArcaneMaxCharges; double accuracy = 100 * (DungeonWeapon.BaseAccuracy + (DungeonWeapon.AccuracyPerTier * (double)weaponTier)); double tactics = DungeonWeapon.BaseTactics + (DungeonWeapon.TacticsPerTier * (double)weaponTier); double effectChance = DungeonWeapon.BaseEffectChance + (DungeonWeapon.BaseEffectChancePerTier * (double)weaponTier); effectChance *= DungeonWeapon.GetSpeedScalar(m_Weapon.Speed); DungeonArmor.DungeonArmorDetail detail = new DungeonArmor.DungeonArmorDetail(m_Dungeon, 1); EffectHue = detail.Hue - 1; int itemId = weapon.ItemID; int itemHue = EffectHue; int offsetX = 0; int offsetY = 0; AddLabel(Utility.CenteredTextOffset(120, dungeonName), 60, EffectHue, dungeonName); AddLabel(Utility.CenteredTextOffset(120, weaponName), 80, EffectHue, weaponName); AddItem(103 + m_Weapon.IconOffsetX, 115 + m_Weapon.IconOffsetY, m_Weapon.IconItemId, itemHue); AddLabel(97, 165, EffectHue, "Tier " + weaponTier.ToString()); AddLabel(71, 190, WhiteTextHue, "Charges:"); AddLabel(135, 190, EffectHue, adjustedBlessedCharges.ToString()); AddLabel(55, 210, WhiteTextHue, "Experience:"); AddLabel(135, 210, EffectHue, "0/" + DungeonWeapon.MaxDungeonExperience.ToString()); AddLabel(60, 230, WhiteTextHue, "Durability:"); AddLabel(135, 230, EffectHue, newDurability.ToString() + "/" + newDurability.ToString()); AddLabel(65, 250, WhiteTextHue, "Accuracy:"); AddLabel(135, 250, EffectHue, "+" + accuracy.ToString() + "%"); AddLabel(74, 270, WhiteTextHue, "Tactics:"); AddLabel(135, 270, EffectHue, "+" + tactics.ToString()); AddLabel(31, 290, WhiteTextHue, "Effect Chance:"); AddLabel(135, 290, EffectHue, Utility.CreateDecimalPercentageString(effectChance, 1)); AddLabel(30, 310, WhiteTextHue, "(scaled for weapon speed)"); DungeonWeaponDetail weaponDetail = DungeonWeapon.GetDungeonWeaponDetail(m_Dungeon); AddLabel(70, 335, WhiteTextHue, "Special Effect:"); AddButton(78, 359, 1210, 1209, 4, GumpButtonType.Reply, 0); AddLabel(98, 355, EffectHue, weaponDetail.m_EffectDisplayName); //----- if (newWeapon) { if (selfCraft || m_GumpTarget == m_MobileTarget) { AddLabel(225, 60, WhiteTextHue, "Choose Dungeon"); AddLabel(265, 95, WhiteTextHue, "Covetous"); AddLabel(265, 130, WhiteTextHue, "Deceit"); AddLabel(265, 165, WhiteTextHue, "Despise"); AddLabel(265, 200, WhiteTextHue, "Destard"); AddLabel(265, 235, WhiteTextHue, "Fire"); AddLabel(265, 270, WhiteTextHue, "Hythloth"); AddLabel(265, 305, WhiteTextHue, "Ice"); AddLabel(265, 340, WhiteTextHue, "Shame"); AddLabel(265, 375, WhiteTextHue, "Wrong"); if (m_Dungeon == DungeonEnum.Covetous) { AddButton(228, 90, 9724, 9721, 10, GumpButtonType.Reply, 0); } else { AddButton(228, 90, 9721, 9724, 10, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Deceit) { AddButton(228, 125, 9724, 9721, 11, GumpButtonType.Reply, 0); } else { AddButton(228, 125, 9721, 9724, 11, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Despise) { AddButton(228, 160, 9724, 9721, 12, GumpButtonType.Reply, 0); } else { AddButton(228, 160, 9721, 9724, 12, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Destard) { AddButton(228, 195, 9724, 9721, 13, GumpButtonType.Reply, 0); } else { AddButton(228, 195, 9721, 9724, 13, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Fire) { AddButton(228, 230, 9724, 9721, 14, GumpButtonType.Reply, 0); } else { AddButton(228, 230, 9721, 9724, 14, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Hythloth) { AddButton(228, 265, 9724, 9721, 15, GumpButtonType.Reply, 0); } else { AddButton(228, 265, 9721, 9724, 15, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Ice) { AddButton(228, 300, 9724, 9721, 16, GumpButtonType.Reply, 0); } else { AddButton(228, 300, 9721, 9724, 16, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Shame) { AddButton(228, 335, 9724, 9721, 17, GumpButtonType.Reply, 0); } else { AddButton(228, 335, 9721, 9724, 17, GumpButtonType.Reply, 0); } if (m_Dungeon == DungeonEnum.Wrong) { AddButton(228, 370, 9724, 9721, 18, GumpButtonType.Reply, 0); } else { AddButton(228, 370, 9721, 9724, 18, GumpButtonType.Reply, 0); } } } if (!selfCraft) { if (m_GumpTarget == m_Crafter) { AddLabel(26, 388, 149, "Price"); AddItem(57, 386, 3823); AddImage(103, 387, 2445); AddTextEntry(108, 388, 95, 20, WhiteTextHue, 4, m_AmountDemanded.ToString()); AddButton(214, 392, 1209, 1210, 3, GumpButtonType.Reply, 0); } else { AddLabel(26, 388, 149, "Price"); AddItem(57, 386, 3823); AddLabel(103, 388, WhiteTextHue, m_AmountDemanded.ToString()); } } if (selfCraft) { AddButton(24, 423, 2151, 2154, 1, GumpButtonType.Reply, 0); AddLabel(57, 426, WhiteTextHue, "Confirm"); } else { if (m_GumpTarget == m_Crafter) { if (m_Confirmed) { AddButton(191, 423, 2154, 2151, 2, GumpButtonType.Reply, 0); } else { AddButton(191, 423, 2151, 2154, 2, GumpButtonType.Reply, 0); } AddLabel(227, 427, WhiteTextHue, "Confirm Offer"); } else { AddButton(24, 423, 2151, 2154, 1, GumpButtonType.Reply, 0); AddLabel(57, 426, WhiteTextHue, "Accept Their Offer"); if (m_Confirmed) { AddImage(191, 423, 9729); } else { AddImage(191, 423, 9731); } AddLabel(227, 427, WhiteTextHue, "They Are Ready"); } } }
public static bool HasRequiredMaterials(Mobile from, Mobile mobileTarget, DungeonMould dungeonMould, bool newWeapon, DungeonEnum dungeon) { if (from == null) { return(false); } if (from.Backpack == null) { return(false); } if (mobileTarget == null) { return(false); } if (mobileTarget.Backpack == null) { return(false); } if (dungeonMould == null) { return(false); } if (dungeonMould.Deleted) { return(false); } if (!dungeonMould.IsChildOf(from.Backpack)) { return(false); } List <DungeonCore> m_DungeonCores = mobileTarget.Backpack.FindItemsByType <DungeonCore>(); List <DungeonDistillation> m_DungeonDistillations = mobileTarget.Backpack.FindItemsByType <DungeonDistillation>(); List <DungeonCore> m_MatchingDungeonCores = new List <DungeonCore>(); List <DungeonDistillation> m_MatchingDungeonDistillations = new List <DungeonDistillation>(); int totalMatchingDungeonCores = 0; foreach (DungeonCore dungeonCore in m_DungeonCores) { if (dungeonCore.Dungeon == dungeon) { totalMatchingDungeonCores += dungeonCore.Amount; m_MatchingDungeonCores.Add(dungeonCore); } } foreach (DungeonDistillation dungeonDistillation in m_DungeonDistillations) { if (dungeonDistillation.Dungeon == dungeon) { m_MatchingDungeonDistillations.Add(dungeonDistillation); } } if (newWeapon) { if (totalMatchingDungeonCores >= DungeonWeapon.CoresNeededForCreation && m_MatchingDungeonDistillations.Count >= DungeonWeapon.DistillationNeededForCreation) { return(true); } } else { if (totalMatchingDungeonCores >= DungeonWeapon.CoresNeededForUpgrade && m_MatchingDungeonDistillations.Count >= DungeonWeapon.DistillationNeededForUpgrade) { return(true); } } return(false); }
public static void ConsumeMaterials(Mobile from, Mobile mobileTarget, DungeonMould dungeonMould, bool newWeapon, DungeonEnum dungeon) { if (from == null || mobileTarget == null) { return; } List <DungeonCore> m_DungeonCores = mobileTarget.Backpack.FindItemsByType <DungeonCore>(); List <DungeonDistillation> m_DungeonDistillations = mobileTarget.Backpack.FindItemsByType <DungeonDistillation>(); List <DungeonCore> m_MatchingDungeonCores = new List <DungeonCore>(); List <DungeonDistillation> m_MatchingDungeonDistillations = new List <DungeonDistillation>(); int coresNeeded = DungeonWeapon.CoresNeededForUpgrade; int distillationsNeeded = DungeonWeapon.DistillationNeededForUpgrade; if (newWeapon) { coresNeeded = DungeonWeapon.CoresNeededForCreation; distillationsNeeded = DungeonWeapon.DistillationNeededForCreation; } Queue m_Queue = new Queue(); foreach (DungeonCore dungeonCore in m_DungeonCores) { if (dungeonCore.Dungeon == dungeon) { if (dungeonCore.Amount > coresNeeded) { dungeonCore.Amount -= coresNeeded; coresNeeded = 0; } else { //Queue for Deletion coresNeeded -= dungeonCore.Amount; m_Queue.Enqueue(dungeonCore); } } if (coresNeeded <= 0) { break; } } while (m_Queue.Count > 0) { DungeonCore dungeonCore = (DungeonCore)m_Queue.Dequeue(); dungeonCore.Delete(); } m_Queue = new Queue(); foreach (DungeonDistillation dungeonDistillation in m_DungeonDistillations) { if (dungeonDistillation.Dungeon == dungeon) { m_Queue.Enqueue(dungeonDistillation); distillationsNeeded--; } if (distillationsNeeded <= 0) { break; } } while (m_Queue.Count > 0) { DungeonDistillation dungeonDistillation = (DungeonDistillation)m_Queue.Dequeue(); dungeonDistillation.Delete(); } if (dungeonMould != null) { dungeonMould.Delete(); } }
public WeaponTarget(DungeonMould dungeonMould) : base(18, false, TargetFlags.None) { m_DungeonMould = dungeonMould; }