public override void OnItemLifted(Mobile from, Item item) { base.OnItemLifted(from,item); if(from is PlayerMobile && Owner == null) { Owner = from as PlayerMobile; LootType = LootType.Blessed; // flag the owner as carrying a questtoken assuming the book contains quests and then confirm it with CheckOwnerFlag Owner.SetFlag(XmlQuest.CarriedXmlQuestFlag,true); CheckOwnerFlag(); } }
public override void OnAdded(object parent) { base.OnAdded(parent); if(parent != null && parent is Container) { // find the parent of the container // note, the only valid additions are to the player pack. Anything else is invalid. This is to avoid exploits involving storage or transfer of questtokens object from = ((Container)parent).Parent; // check to see if it can be added if(from != null && from is PlayerMobile) { // if it was not owned then allow it to go anywhere if(Owner == null) { Owner = from as PlayerMobile; LootType = LootType.Blessed; // could also bless all of the quests inside as well but not actually necessary since blessed containers retain their // contents whether blessed or not, and when dropped the questtokens will be blessed // flag the owner as carrying a questtoken Owner.SetFlag(XmlQuest.CarriedXmlQuestFlag,true); CheckOwnerFlag(); } else if(from as PlayerMobile != Owner || parent is BankBox) { // tried to give it to another player or placed it in the players bankbox. try to return it to the owners pack Owner.AddToBackpack(this); } } else { if(Owner != null) { // try to return it to the owners pack Owner.AddToBackpack(this); } // allow placement into npcs or drop on their corpses when owner is null else if(!(from is Mobile) && !(parent is Corpse)) { // in principle this should never be reached // invalidate the token CheckOwnerFlag(); Invalidate(); } } } }