本文整理匯總了C#中Server.Mobiles.PlayerMobile.SetFlag方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerMobile.SetFlag方法的具體用法?C# PlayerMobile.SetFlag怎麽用?C# PlayerMobile.SetFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Mobiles.PlayerMobile
的用法示例。
在下文中一共展示了PlayerMobile.SetFlag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnItemLifted
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();
}
}
示例2: OnAdded
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();
}
}
}
}