示例#1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            switch (v)
            {
            case 2:
                m_Index       = reader.ReadInt();
                m_Owner       = reader.ReadString();
                m_Measurement = reader.ReadInt();
                m_DateKilled  = reader.ReadString();
                m_Location    = reader.ReadString();
                break;

            case 1:
                reader.ReadBool();
                m_Owner       = reader.ReadString();
                m_Measurement = reader.ReadInt();
                m_DateKilled  = reader.ReadString();
                m_Location    = reader.ReadString();
                var td = TextDefinition.Deserialize(reader);
                reader.ReadInt();
                reader.ReadInt();

                Timer.DelayCall(() =>
                {
                    Index = HuntingTrophyInfo.CheckInfo(td.Number);
                });
                break;
            }

            Timer.DelayCall(TimeSpan.FromSeconds(30), Replace);
        }
示例#2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            switch (v)
            {
            case 1:
                m_Index       = reader.ReadInt();
                m_Owner       = reader.ReadString();
                m_Measurement = reader.ReadInt();
                m_DateKilled  = reader.ReadString();
                m_Location    = reader.ReadString();
                break;

            case 0:
                m_Owner       = reader.ReadString();
                m_Measurement = reader.ReadInt();
                m_DateKilled  = reader.ReadString();
                m_Location    = reader.ReadString();
                TextDefinition td = TextDefinition.Deserialize(reader);
                reader.ReadInt();
                reader.ReadInt();

                Timer.DelayCall(() =>
                {
                    Index = HuntingTrophyInfo.CheckInfo(td.Number);
                });
                break;
            }
        }
示例#3
0
        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            if (HuntingSystem.Instance == null)
            {
                return;
            }

            if (!HuntingSystem.Instance.Leaders.ContainsKey(m_HuntType))
            {
                HuntingSystem.Instance.Leaders[m_HuntType] = new List <HuntingKillEntry>();
            }

            List <HuntingKillEntry> entries = HuntingSystem.Instance.Leaders[m_HuntType];
            HuntingKillEntry        entry   = null;

            if (entries.Count > 0)
            {
                entry = entries[0];
            }

            if (entry != null)
            {
                HuntingTrophyInfo info = HuntingTrophyInfo.GetInfo(m_HuntType);

                if (info != null)
                {
                    list.Add(1155708, entry.Owner != null ? entry.Owner.Name : "Unknown"); // Hunter: ~1_NAME~
                    list.Add(1155709, entry.DateKilled.ToShortDateString());               // Date of Kill: ~1_DATE~

                    if (entry.Location != null)
                    {
                        list.Add(1061114, entry.Location); // Location: ~1_val~
                    }
                    list.Add(1155718, info.Species.ToString());

                    if (info.MeasuredBy == MeasuredBy.Length)
                    {
                        list.Add(1155711, entry.Measurement.ToString()); // Length: ~1_VAL~
                    }
                    else if (info.MeasuredBy == MeasuredBy.Wingspan)
                    {
                        list.Add(1155710, entry.Measurement.ToString());        // Wingspan: ~1_VAL~
                    }
                    else
                    {
                        list.Add(1072789, entry.Measurement.ToString()); // Weight: ~1_WEIGHT~
                    }
                }
            }

            if (HuntingSystem.Instance != null && HuntingSystem.Instance.Active)
            {
                list.Add("Season Ends: {0}", HuntingSystem.Instance.SeasonEnds.ToShortDateString());
            }
        }
示例#4
0
        public void InvalidateType()
        {
            HuntingTrophyInfo info = HuntingTrophyInfo.GetInfo(m_HuntType);

            if (info != null)
            {
                ItemID = info.SouthID;
            }

            InvalidateProperties();
        }
示例#5
0
        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            if (m_KillEntry == null || m_KillEntry.KillIndex < 0 || m_KillEntry.KillIndex >= HuntingTrophyInfo.Infos.Count)
            {
                return;
            }

            HuntingTrophyInfo info = HuntingTrophyInfo.Infos[m_KillEntry.KillIndex];

            if (m_Owner != null)
            {
                list.Add(1155708, m_Owner.Name); // Hunter: ~1_NAME~
            }
            if (m_KillEntry.DateKilled != DateTime.MinValue)
            {
                list.Add(1155709, m_KillEntry.DateKilled.ToShortDateString()); // Date of Kill: ~1_DATE~
            }
            if (m_KillEntry.Location != null)
            {
                list.Add(1061114, m_KillEntry.Location); // Location: ~1_val~
            }
            list.Add(1155718, info.Species.ToString());

            if (info.MeasuredBy == MeasuredBy.Length)
            {
                list.Add(1155711, m_KillEntry.Measurement.ToString()); // Length: ~1_VAL~
            }
            else if (info.MeasuredBy == MeasuredBy.Wingspan)
            {
                list.Add(1155710, m_KillEntry.Measurement.ToString());  // Wingspan: ~1_VAL~
            }
            else
            {
                list.Add(1072789, m_KillEntry.Measurement.ToString()); // Weight: ~1_WEIGHT~
            }
        }
示例#6
0
            public BestKillGump(int filter) : base(20, 20)
            {
                if (HuntingSystem.Instance == null)
                {
                    return;
                }

                m_Filter = filter;

                if (m_Filter < -1)
                {
                    m_Filter = 23;
                }
                if (m_Filter > 23)
                {
                    m_Filter = -1;
                }

                List <HuntingKillEntry> useList = new List <HuntingKillEntry>();

                if (m_Filter == -1)
                {
                    foreach (KeyValuePair <HuntType, List <HuntingKillEntry> > kvp in HuntingSystem.Instance.Top10)
                    {
                        if (kvp.Value.Count > 0)
                        {
                            useList.AddRange(kvp.Value);
                        }
                    }
                }
                else if (HuntingSystem.Instance.Top10.ContainsKey((HuntType)m_Filter))
                {
                    useList = HuntingSystem.Instance.Top10[(HuntType)m_Filter];
                }

                AddBackground(0, 0, 500, 400, 9250);

                AddHtml(0, 15, 500, 16, "<Center>Top 10 Kills</Center>", false, false);
                AddHtml(20, 40, 150, 16, "<Basefont Color=#A52A2A>Hunter</Basefont>", false, false);
                AddHtml(170, 40, 120, 16, "<Basefont Color=#A52A2A>Species</Basefont>", false, false);
                AddHtml(290, 40, 150, 16, "<Basefont Color=#A52A2A>Measurement</Basefont>", false, false);
                AddHtml(390, 40, 110, 16, "<Basefont Color=#A52A2A>Date Killed</Basefont>", false, false);

                useList.Sort();
                int y = 80;

                for (int i = 0; i < useList.Count && i < 10; i++)
                {
                    HuntingKillEntry  entry = useList[i];
                    HuntingTrophyInfo info  = HuntingTrophyInfo.Infos[entry.KillIndex];

                    AddHtml(20, y, 150, 16, entry.Owner != null ? FormatFont(entry.Owner.Name, i) : FormatFont("Unknown", i), false, false);
                    AddHtml(170, y, 120, 16, FormatFont(GetHuntTypeString(info.HuntType), i), false, false);
                    AddHtml(290, y, 100, 16, info.MeasuredBy == MeasuredBy.Weight ? FormatFont(entry.Measurement.ToString() + " stones", i) : FormatFont(entry.Measurement.ToString() + " feet", i), false, false);
                    AddHtml(390, y, 150, 16, FormatFont(entry.DateKilled.ToShortDateString(), i), false, false);

                    y += 20;
                }

                AddHtml(0, 365, 500, 16, String.Format("<Center>{0}</Center>", GetHuntTypeString()), false, false);

                AddButton(150, 365, 4014, 4016, 1, GumpButtonType.Reply, 0);
                AddButton(328, 365, 4005, 4007, 2, GumpButtonType.Reply, 0);
            }
示例#7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Corpse)
                {
                    Corpse c = targeted as Corpse;

                    if (!from.InRange(c.Location, 3))
                    {
                        from.SendLocalizedMessage(500446); // That is too far away.
                    }
                    if (c.VisitedByTaxidermist)
                    {
                        from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already.
                    }
                    else if (!m_Permit.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else if (c.Owner == null)
                    {
                        from.SendLocalizedMessage(1155706); // That is not a valid kill.
                    }
                    else if (!IsOnlyAttacker(from, c.Owner))
                    {
                        from.SendLocalizedMessage(1155707);       // You cannot document someone else's kill.
                    }
                    else
                    {
                        Type t = c.Owner.GetType();

                        if (t == typeof(RagingGrizzlyBear)) // Bandaid Fix, we'll keep this until others arise
                        {
                            t = typeof(GrizzlyBear);
                        }

                        for (int i = 0; i < HuntingTrophyInfo.Infos.Count; i++)
                        {
                            HuntingTrophyInfo info = HuntingTrophyInfo.Infos[i];

                            if (t == info.CreatureType)
                            {
                                int v = 0;

                                if (HuntingSystem.Instance != null && HuntingSystem.Instance.IsPrimeHunt(from, c.Location))
                                {
                                    v = Utility.RandomMinMax(0, 100);
                                }
                                else
                                {
                                    v = Utility.RandomMinMax(0, 10000);
                                    v = (int)Math.Sqrt(v);
                                    v = 100 - v;
                                }

                                int measurement = info.MinMeasurement + (int)((double)(info.MaxMeasurement - info.MinMeasurement) * (double)((double)v / 100.0));
                                m_Permit.KillEntry     = new HuntingKillEntry(m_Permit.Owner, measurement, DateTime.Now, i, WorldLocationInfo.GetLocationString(c.Location, c.Map));
                                c.VisitedByTaxidermist = true;

                                from.PlaySound(0x249);
                                from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x45, 1155713, from.NetState); // *You document your kill on the permit*
                                m_Permit.InvalidateProperties();
                                return;
                            }
                        }

                        from.SendLocalizedMessage(1155706); // That is not a valid kill.
                    }
                }
            }
示例#8
0
            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 < HuntingTrophyInfo.Infos.Count)
                        {
                            HuntingTrophyInfo info = 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 < TrophyInfos.Length; i++)
                        {
                            if (TrophyInfos[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, TrophyInfos[i].DeedNumber, TrophyInfos[i].AddonNumber, TrophyInfos[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, TrophyInfos[i].DeedNumber, TrophyInfos[i].AddonNumber, TrophyInfos[i].NorthID));

                                        fish.Delete();
                                        m_Kit.Delete();
                                        return;
                                    }
                                    #endregion
                                    var deed = new TrophyDeed(TrophyInfos[i], hunter, weight);

                                    if (dateCaught != DateTime.MinValue)
                                    {
                                        deed.DateCaught = dateCaught;
                                    }

                                    from.AddToBackpack(new TrophyDeed(TrophyInfos[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.
                }
            }