コード例 #1
0
ファイル: BountyOfficer.cs プロジェクト: nydehi/imagine-uo
        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);
            }
        }