本文整理汇总了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();
}
}
}
}