예제 #1
0
        public BountyHunterGump(Mobile from, int listPage, ArrayList list, ArrayList count) : base(50, 50)
        {
            m_List      = list;
            m_ListPage  = listPage;
            m_CountList = count;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);

            AddImage(4, 4, 2170);
            AddLabel(181, 41, 1149, @"Bounty Hunter Board");

            if (m_List == null)
            {
                ArrayList total   = FSBountySystem.GetAllBounties();
                ArrayList newlist = new ArrayList();

                foreach (FSBountySystem.Bounty b in total)
                {
                    newlist.Add(b);
                }

                m_List = newlist;
            }

            if (listPage > 0)
            {
                AddButton(116, 349, 5603, 5607, 1, GumpButtonType.Reply, 0);
            }

            if ((listPage + 1) * 8 < m_List.Count)
            {
                AddButton(370, 349, 5601, 5605, 2, GumpButtonType.Reply, 0);
            }

            int k = 0;

            for (int i = 0, j = 0, index = ((listPage * 8) + k); i < 8 && index >= 0 && index < m_List.Count && j >= 0; ++i, ++j, ++index)
            {
                FSBountySystem.Bounty b = m_List[index] as FSBountySystem.Bounty;

                int buttonOffset = 170 + (i * 20);
                int labelOffset  = 168 + (i * 20);

                if (m_List.Count > 0)
                {
                    AddButton(115, buttonOffset, 4033, 4033, 100 + index, GumpButtonType.Reply, 0);
                    AddLabel(135, labelOffset, 1149, @"Wanted: " + b.Wanted.Name.ToString());
                }
                else
                {
                    AddLabel(135, 168, 1149, @"No bounties at this time.");
                }
            }
        }
예제 #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                Mobile  from = state.Mobile;
                BankBox box  = from.BankBox;
                string  text = (string)info.GetTextEntry(1).Text;

                if (text.Length > 0)
                {
                    try
                    {
                        int amount = Convert.ToInt32(text);

                        if (amount < 1)
                        {
                            from.SendMessage("Thats to low of an amount.");
                            from.SendGump(new CreateBountyGump(from, m_Killer));
                        }
                        else if (box.TotalGold < amount)
                        {
                            from.SendMessage("You lack the gold for that bounty.");
                            from.SendGump(new CreateBountyGump(from, m_Killer));
                        }
                        else
                        {
                            box.ConsumeTotal(typeof(Gold), amount);
                            FSBountySystem.CreateBounty(m_Killer, amount);
                            from.SendMessage("{0} has been removed from your bank.", amount);
                            from.SendMessage("The bounty has been placed on {0}'s head.", m_Killer.Name);
                        }
                    }
                    catch
                    {
                        from.SendMessage("You must enter a number amount.");
                        from.SendGump(new CreateBountyGump(from, m_Killer));
                    }
                }
            }
        }
예제 #3
0
        public override bool OnDragDrop(Mobile m, Item item)
        {
            if (item is Head)               // He said head...
            {
                this.Say(500670);           // Ah, a head! Let me check to see if there is a bounty on this.
                this.Say("There was no bounty on this person.");
                item.Delete();
                return(false);
            }
            else if (item is BountyHead)
            {
                this.Say(500670);                   // Ah, a head! Let me check to see if there is a bounty on this.

                BountyHead bh = (BountyHead)item;

                Mobile   owner  = bh.Owner;
                Mobile   killer = bh.Killer;
                DateTime tod    = bh.TimeOfDeath;

                FSBountySystem.Bounty b = FSBountySystem.FindBounty(owner);

                if (b != null)
                {
                    if (owner != null && killer != null)
                    {
                        if (m == owner)
                        {
                            this.Say("Ha Ha Ha, You think i am going to give you a reward for your own head?");
                            item.Delete();
                            return(false);
                        }
                        else if (m != killer)
                        {
                            this.Say(500543);                               // I had heard this scum was taken care of...but not by you
                            item.Delete();
                            return(false);
                        }
                        else if (tod < b.Expires - TimeSpan.FromDays(30.0))
                        {
                            this.Say("This head is to badly decayed to make a positive id.");
                            item.Delete();
                            return(false);
                        }
                        else if (owner.Guild != null && killer.Guild != null && owner.Guild == killer.Guild)
                        {
                            this.Say("You cannot claim a reward on one of your guildmates.");
                            item.Delete();
                            return(false);
                        }
                        else if (b.Expires < DateTime.Now)
                        {
                            this.Say("It looks like this bounty has expired.");
                            item.Delete();
                            FSBountySystem.ClearBounty(b, owner);
                            return(false);
                        }
                        else
                        {
                            BankBox box = m.BankBox;

                            if (box != null)
                            {
                                box.DropItem(new BankCheck(b.Reward));
                                FSBountySystem.ClearBounty(b, owner);
                                this.Say("There was a bounty for {0}, For the sum of {1} gold.", owner.Name, b.Reward);
                                m.SendMessage("A bankcheck for {0} gold has been depoisted into your bank.", b.Reward);
                                this.Say("I have added the bounty reward to your bank.");
                                item.Delete();
                                return(true);
                            }
                            else
                            {
                                item.Delete();
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        this.Say("I found a bounty for this person, However the bounty was invalid.");
                        m.SendMessage("The person this head belongs to no longer exists on the server, Contact a gamemaster for more details.");
                        FSBountySystem.ClearBounty(b, owner);
                        item.Delete();
                        return(false);
                    }
                }
                else
                {
                    if (owner != null)
                    {
                        this.Say(1042854, owner.Name);                           // There was no bounty on ~1_PLAYER_NAME~.
                        item.Delete();
                        return(false);
                    }
                    else
                    {
                        this.Say("There was no bounty on this person.");
                        item.Delete();
                        return(false);
                    }
                }
            }
            else
            {
                this.Say("I dont want that.");
                return(false);
            }
        }