Пример #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (_Item.Deleted)
                {
                    return;
                }

                if (!_Item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                    return;
                }

                if (targeted is BaseCreature && ((BaseCreature)targeted).ControlMaster == from)
                {
                    if (((BaseCreature)targeted).IsBonded)
                    {
                        if (_Item.IsUsable)
                        {
                            _Item.PetLinked      = (BaseCreature)targeted;
                            _Item.NextLinkedTime = DateTime.UtcNow + TimeSpan.FromDays(7);
                            _Item.InvalidateProperties();

                            from.CloseGump(typeof(PetWhistleGump));
                            from.SendGump(new PetWhistleGump(_Item));
                        }
                        else
                        {
                            if ((DateTime.UtcNow - _Item.NextLinkedTime).Seconds > 60)
                            {
                                from.SendLocalizedMessage(1159391); // You must wait ~1_minutes~ minutes before you can link another pet to this whistle.
                            }
                            else
                            {
                                from.SendLocalizedMessage(1159392); // You must wait ~1_seconds~ seconds before you can link another pet to this whistle.
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1159373); // This item can only be linked to a bonded pet.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1149667); // Invalid target.
                }
            }