public void TrySubmitKill(HuntMaster master, Mobile from, HuntingPermit permit) { if (permit.KillEntry == null || permit.KillEntry.KillIndex < 0 || permit.KillEntry.KillIndex > HuntingTrophyInfo.Infos.Count) { master.SayTo(from, 1155706); // That is not a valid kill. } else { HuntingTrophyInfo info = HuntingTrophyInfo.Infos[permit.KillEntry.KillIndex]; if (info != null) { if (!m_Leaders.ContainsKey(info.HuntType)) { m_Leaders[info.HuntType] = new List <HuntingKillEntry>(); } List <HuntingKillEntry> leaders = m_Leaders[info.HuntType]; if (leaders.Count == 0 || permit.KillEntry.Measurement >= leaders[0].Measurement) { if (leaders.Count > 0 && permit.KillEntry.Measurement > leaders[0].Measurement) { leaders.Clear(); } leaders.Add(new HuntingKillEntry(permit.Owner, permit.KillEntry.Measurement, permit.KillEntry.DateKilled, permit.KillEntry.KillIndex, permit.KillEntry.Location)); from.SendGump(new BasicInfoGump(1155722)); HuntingDisplayTrophy.InvalidateDisplayTrophies(); master.PlaySound(0x3D); } else { master.SayTo(from, 1155721); // Begging thy pardon, but your permit has not broken the current record for this species! } permit.HasSubmitted = true; CheckKill(info.HuntType, permit.KillEntry); if (from is PlayerMobile) { BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(HuntmastersChallengeQuest)); if (quest != null && quest is HuntmastersChallengeQuest) { ((HuntmastersChallengeQuest)quest).CompleteChallenge(); } } } } }
public static int CheckInfo(int number) { for (int i = 0; i < Infos.Count; i++) { HuntingTrophyInfo info = Infos[i]; if (info.Species.Number == number) { return(i); } } return(0); }
public int CompareTo(object o) { if (((HuntingKillEntry)o).KillIndex == m_KillIndex || m_KillIndex < 0 || m_KillIndex >= HuntingTrophyInfo.Infos.Count) { return(((HuntingKillEntry)o).Measurement - m_Measurement); } HuntingTrophyInfo info1 = HuntingTrophyInfo.Infos[((HuntingKillEntry)o).KillIndex]; HuntingTrophyInfo info2 = HuntingTrophyInfo.Infos[m_KillIndex]; double perc1 = (double)((HuntingKillEntry)o).Measurement / info1.MaxMeasurement; double perc2 = (double)m_Measurement / info2.MaxMeasurement; return((int)((perc1 * 100) - (perc2 * 100))); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Kit.Deleted) { return; } if (!(targeted is Corpse) && !(targeted is BigFish) && !(targeted is BaseHighseasFish) && !(targeted is HuntingPermit)) { from.SendLocalizedMessage(1042600); // That is not a corpse! } else if (targeted is Corpse && ((Corpse)targeted).VisitedByTaxidermist) { from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already. } else if (!m_Kit.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.Skills[SkillName.Carpentry].Base < 90.0) { from.SendLocalizedMessage(1042603); // You would not understand how to use the kit. } #region Huntmasters Challenge else if (targeted is HuntingPermit) { HuntingPermit lic = targeted as HuntingPermit; if (from.Backpack == null || !lic.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (!lic.CanUseTaxidermyOn) { //TODO: Message? } else if (from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Board), 10)) { int index = lic.KillEntry.KillIndex; if (index >= 0 && index < Server.Engines.HuntsmasterChallenge.HuntingTrophyInfo.Infos.Count) { Server.Engines.HuntsmasterChallenge.HuntingTrophyInfo info = Server.Engines.HuntsmasterChallenge.HuntingTrophyInfo.Infos[index]; if (info != null) { string name = lic.KillEntry.Owner != null ? lic.KillEntry.Owner.Name : from.Name; if (info.Complex) { from.AddToBackpack(new HuntTrophyAddonDeed(name, index, lic.KillEntry.Measurement, lic.KillEntry.DateKilled.ToShortDateString(), lic.KillEntry.Location)); } else { from.AddToBackpack(new HuntTrophy(name, index, lic.KillEntry.Measurement, lic.KillEntry.DateKilled.ToShortDateString(), lic.KillEntry.Location)); } lic.ProducedTrophy = true; m_Kit.Delete(); } } } else { from.SendLocalizedMessage(1042598); // You do not have enough boards. return; } } #endregion else { object obj = targeted; if (obj is Corpse) { obj = ((Corpse)obj).Owner; } if (obj != null) { for (int i = 0; i < m_Table.Length; i++) { if (m_Table[i].CreatureType == obj.GetType()) { Container pack = from.Backpack; if (pack != null && pack.ConsumeTotal(typeof(Board), 10)) { from.SendLocalizedMessage(1042278); // You review the corpse and find it worthy of a trophy. from.SendLocalizedMessage(1042602); // You use your kit up making the trophy. Mobile hunter = null; int weight = 0; DateTime dateCaught = DateTime.MinValue; if (targeted is BigFish) { BigFish fish = targeted as BigFish; hunter = fish.Fisher; weight = (int)fish.Weight; dateCaught = fish.DateCaught; fish.Consume(); } #region High Seas else if (targeted is RareFish) { RareFish fish = targeted as RareFish; hunter = fish.Fisher; weight = (int)fish.Weight; dateCaught = fish.DateCaught; from.AddToBackpack(new FishTrophyDeed(weight, hunter, dateCaught, m_Table[i].DeedNumber, m_Table[i].AddonNumber, m_Table[i].NorthID)); fish.Delete(); m_Kit.Delete(); return; } else if (targeted is RareCrabAndLobster) { RareCrabAndLobster fish = targeted as RareCrabAndLobster; hunter = fish.Fisher; weight = (int)fish.Weight; dateCaught = fish.DateCaught; from.AddToBackpack(new FishTrophyDeed(weight, hunter, dateCaught, m_Table[i].DeedNumber, m_Table[i].AddonNumber, m_Table[i].NorthID)); fish.Delete(); m_Kit.Delete(); return; } #endregion var deed = new TrophyDeed(m_Table[i], hunter, weight); if (dateCaught != DateTime.MinValue) { deed.DateCaught = dateCaught; } from.AddToBackpack(new TrophyDeed(m_Table[i], hunter, weight)); if (targeted is Corpse) { ((Corpse)targeted).VisitedByTaxidermist = true; } m_Kit.Delete(); return; } else { from.SendLocalizedMessage(1042598); // You do not have enough boards. return; } } } } from.SendLocalizedMessage(1042599); // That does not look like something you want hanging on a wall. } }