Beispiel #1
0
            public override void OnClick()
            {
                Mobile from = this.Owner.From;

                if (HuntingPermit.HasPermit(from))
                {
                    from.SendLocalizedMessage(1155702);                     // You already have a hunting permit.
                }
                else if (Banker.Withdraw(from, 5000))
                {
                    Banker.Withdraw(from, 5000);
                    HuntingPermit permit = new HuntingPermit(from);

                    if (from.Backpack == null || !from.Backpack.TryDropItem(from, permit, false))
                    {
                        from.SendLocalizedMessage(1155703);                         // Your backpack was too full so the permit was deleted. Empty your backpack and try again.
                        permit.Delete();
                    }
                    //TODO: Message???
                }
                else
                {
                    from.SendLocalizedMessage(500382); // Thou dost not have sufficient funds in thy account to withdraw that much.
                }
            }
Beispiel #2
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is HuntingPermit)
            {
                HuntingPermit permit = dropped as HuntingPermit;
                HuntingSystem sys    = HuntingSystem.Instance;

                if (sys == null || !sys.Active)
                {
                    return(false);
                }

                if (!permit.HasDocumentedKill)
                {
                    SayTo(from, "You can't submit a kill you haven't documented yet!");
                }
                else if (permit.KillEntry.DateKilled < sys.SeasonBegins)
                {
                    SayTo(from, 1155720);                     // This permit was documented in a different month or year than the current month and year. I only accept permits documented in the current month and year.
                }
                else if (permit.HasSubmitted)
                {
                    SayTo(from, 1155719);                     // This permit has already been submitted.
                }
                else
                {
                    sys.TrySubmitKill(this, from, permit);
                }
            }

            return(false);
        }
Beispiel #3
0
        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();
                        }
                    }
                }
            }
        }