public static void UpdateBuff(Mobile m) { BaseCreature pet = KhaldunTastyTreat.GetPetUnderEffects(m); Caddellite equipped = null; Item item = m.FindItemOnLayer(Layer.TwoHanded); if (item == null) { item = m.FindItemOnLayer(Layer.OneHanded); } if (item != null) { equipped = item.GetSocket <Caddellite>(); } if (equipped == null && pet == null) { BuffInfo.RemoveBuff(m, BuffIcon.CaddelliteInfused); } else { BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.CaddelliteInfused, 1158662, 1158677, string.Format("{0}\t{1}\t{2}\t{3}", equipped != null && equipped.Owner is BaseWeapon ? "100" : "0", equipped != null && equipped.Owner is Spellbook ? "100" : "0", pet != null ? pet.Name : "", pet != null ? "100" : "0"))); } }
public static bool CheckDrop(Mobile from, Container droppedTo, Item dropped) { EnchantedHotItemSocket socket = dropped.GetSocket <EnchantedHotItemSocket>(); if (socket != null) { Container c = socket.Container; if (droppedTo != c && droppedTo != from.Backpack) { from.SendLocalizedMessage(1152083); // The stolen item magically returns to the trunk where you found it. if (c != null) { c.DropItem(dropped); } else { dropped.Delete(); } return(false); } } return(true); }
public static void OnDropped(ContainerDroppedToEventArgs e) { Item dropped = e.Dropped; Mobile from = e.Mobile; if (dropped != null) { HonestyItemSocket honestySocket = dropped.GetSocket <HonestyItemSocket>(); if (honestySocket != null && honestySocket.HonestyPickup == DateTime.MinValue) { honestySocket.HonestyPickup = DateTime.UtcNow; honestySocket.StartHonestyTimer(); if (honestySocket.HonestyOwner == null) { Server.Services.Virtues.HonestyVirtue.AssignOwner(honestySocket); } if (from != null) { from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item. } } } }
public static SlayerName GetSlayer(Item item) { SlayerSocket socket = item?.GetSocket <SlayerSocket>(); if (socket != null) { return(socket.Slayer); } return(SlayerName.None); }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack)) { m.SendLocalizedMessage(1155613); // Target the weapon, spellbook, or instrument you wish to apply this to... m.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (from, targeted) => { if (targeted is Item && targeted is ISlayer) { Item item = (Item)targeted; ISlayer slayer = (ISlayer)targeted; SlayerSocket socket = item.GetSocket <SlayerSocket>(); if (socket == null || socket.Slayer != SlayerName.Silver) { if (slayer.Slayer != SlayerName.None && slayer.Slayer2 != SlayerName.None) { from.SendLocalizedMessage(1155680); // You cannot apply Tincture of Silver to items that are already slayers! } else { item.AttachSocket(new SlayerSocket(SlayerName.Silver, TimeSpan.FromHours(1))); Delete(); from.SendLocalizedMessage(1155616); // You carefully apply Tincture of Silver to the item. The effects will fade in one hour. } } else { from.SendLocalizedMessage(1155614); // This item is already treated with Tincture of Silver! } } else { from.SendLocalizedMessage(1155615); // You cannot apply Tincture of Silver to this item. } }); } }
public override bool OnDragDropInto(Mobile from, Item item, Point3D p) { if (!CheckHold(from, item, true, true)) { return(false); } if (item.QuestItem && from.Backpack != this) { from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item. return(false); } BaseHouse house = BaseHouse.FindHouseAt(this); if (house != null && house.IsLockedDown(this)) { if (item is VendorRentalContract || (item is Container && ((Container)item).FindItemByType(typeof(VendorRentalContract)) != null)) { from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container. return(false); } if (!house.LockDown(from, item, false)) { return(false); } } item.Location = new Point3D(p.X, p.Y, 0); AddItem(item); from.SendSound(GetDroppedSound(item), GetWorldLocation()); ItemFlags.SetTaken(item, true); var honestySocket = item.GetSocket <HonestyItemSocket>(); if (honestySocket != null && honestySocket.HonestyPickup == DateTime.MinValue) { honestySocket.HonestyPickup = DateTime.UtcNow; honestySocket.StartHonestyTimer(); if (honestySocket.HonestyOwner == null) { Server.Services.Virtues.HonestyVirtue.AssignOwner(honestySocket); } from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item. } if (Siege.SiegeShard && this != from.Backpack && from is PlayerMobile && ((PlayerMobile)from).BlessedItem != null && ((PlayerMobile)from).BlessedItem == item) { ((PlayerMobile)from).BlessedItem = null; item.LootType = LootType.Regular; from.SendLocalizedMessage(1075292, item.Name != null ? item.Name : "#" + item.LabelNumber.ToString()); // ~1_NAME~ has been unblessed. } if (!EnchantedHotItemSocket.CheckDrop(from, this, item)) { return(false); } return(true); }
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage) { if (!CheckHold(from, dropped, sendFullMessage, !CheckStack(from, dropped))) { return(false); } if (dropped.QuestItem && from.Backpack != this) { from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item. return(false); } BaseHouse house = BaseHouse.FindHouseAt(this); if (house != null && house.IsLockedDown(this)) { if (dropped is VendorRentalContract || (dropped is Container && ((Container)dropped).FindItemByType(typeof(VendorRentalContract)) != null)) { from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container. return(false); } if (!house.LockDown(from, dropped, false)) { return(false); } } List <Item> list = Items; for (int i = 0; i < list.Count; ++i) { Item item = list[i]; if (!(item is Container) && item.StackWith(from, dropped, false)) { return(true); } } DropItem(dropped); ItemFlags.SetTaken(dropped, true); var honestySocket = dropped.GetSocket <HonestyItemSocket>(); if (honestySocket != null && honestySocket.HonestyPickup == DateTime.MinValue) { honestySocket.HonestyPickup = DateTime.UtcNow; honestySocket.StartHonestyTimer(); if (honestySocket.HonestyOwner == null) { Server.Services.Virtues.HonestyVirtue.AssignOwner(honestySocket); } from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item. } if (Siege.SiegeShard && this != from.Backpack && from is PlayerMobile && ((PlayerMobile)from).BlessedItem != null && ((PlayerMobile)from).BlessedItem == dropped) { ((PlayerMobile)from).BlessedItem = null; dropped.LootType = LootType.Regular; from.SendLocalizedMessage(1075292, dropped.Name != null ? dropped.Name : "#" + dropped.LabelNumber.ToString()); // ~1_NAME~ has been unblessed. } if (!EnchantedHotItemSocket.CheckDrop(from, this, dropped)) { return(false); } return(true); }