本文整理汇总了C#中Server.Item.GetWorldLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetWorldLocation方法的具体用法?C# Item.GetWorldLocation怎么用?C# Item.GetWorldLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Item
的用法示例。
在下文中一共展示了Item.GetWorldLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DestroyFurniture
private void DestroyFurniture( Mobile from, Item item )
{
if ( !from.InRange( item.GetWorldLocation(), 3 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
return;
}
else if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
{
from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
return;
}
from.SendLocalizedMessage( 500461 ); // You destroy the item.
Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );
if ( item is Container )
{
if ( item is TrapableContainer )
(item as TrapableContainer).ExecuteTrap( from );
((Container)item).Destroy();
}
else
{
item.Delete();
}
}
示例2: Resurrect
public static void Resurrect( Mobile m, Item item )
{
if ( m.Alive )
return;
if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) )
m.SendLocalizedMessage( 500446 ); // That is too far away.
else if ( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
else
m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
}
示例3: Resurrect
public static void Resurrect( Mobile m, Item item )
{
if ( m.Alive )
return;
if (m is PlayerMobile && ((PlayerMobile)m).Mortal && m.AccessLevel == AccessLevel.Player)
m.SendMessage("Thy soul was too closely intertwined with thy flesh - thou'rt unable to incorporate a new body.");
else if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) )
m.SendLocalizedMessage( 500446 ); // That is too far away.
else if (m.Map != null && m.Map.CanFit(m.Location, 16, CanFitFlags.requireSurface))
m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
else
m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
}
示例4: Lift
public void Lift( Item item, int amount, out bool rejected, out LRReason reject )
{
rejected = true;
reject = LRReason.Inspecific;
if ( item == null )
return;
Mobile from = this;
GameClient state = m_Client;
if ( from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime )
{
if ( from.CheckAlive() )
{
from.DisruptiveAction();
if ( from.Holding != null )
{
reject = LRReason.AreHolding;
}
else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) )
{
reject = LRReason.OutOfRange;
}
else if ( !from.CanSee( item ) || !from.InLOS( item ) )
{
reject = LRReason.OutOfSight;
}
else if ( !item.VerifyMove( from ) )
{
reject = LRReason.CannotLift;
}
else if ( !item.IsAccessibleTo( from ) )
{
reject = LRReason.CannotLift;
}
else if ( item.CheckLift( from, item, ref reject ) )
{
object root = item.RootParent;
if ( root != null && root is Mobile && !( (Mobile) root ).CheckNonlocalLift( from, item ) )
{
reject = LRReason.TryToSteal;
}
else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) )
{
reject = LRReason.Inspecific;
}
else if ( !from.CheckAlive() )
{
reject = LRReason.Inspecific;
}
else
{
if ( item.Parent != null && item.Parent is Container )
( (Container) item.Parent ).FreePosition( item.GridLocation );
item.SetLastMoved();
if ( item.Spawner != null )
{
item.Spawner.Remove( item );
item.Spawner = null;
}
if ( amount == 0 )
amount = 1;
if ( amount > item.Amount )
amount = item.Amount;
int oldAmount = item.Amount;
//item.Amount = amount; //Set in LiftItemDupe
if ( amount < oldAmount )
LiftItemDupe( item, amount );
InvokeItemLifted( new ItemLiftedEventArgs( item, amount ) );
item.RecordBounce();
item.OnItemLifted( from, item );
item.Internalize();
from.Holding = item;
from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 );
Point3D fixLoc = item.Location;
Map fixMap = item.Map;
bool shouldFix = ( item.Parent == null );
if ( fixMap != null && shouldFix )
fixMap.FixColumn( fixLoc.X, fixLoc.Y );
reject = LRReason.Inspecific;
rejected = false;
}
}
}
//.........这里部分代码省略.........
示例5: TryStealItem
private Item TryStealItem( Item toSteal, ref bool caught )
{
//Zen make bankbox close when stealing!
BankBox box = m_Thief.FindBankNoCreate();
if ( box != null && box.Opened )
{
box.Close();
m_Thief.Send( new MobileUpdate(m_Thief) );
}
Item stolen = null;
object root = toSteal.RootParent;
if ( !IsEmptyHanded( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
}
// stealing off a corpse is looting
else if (root is Corpse && CheckStealing(root as Corpse) == false)
{
m_Thief.SendMessage("You can't steal that!"); // You can't steal that!
}
else if ( root is Mobile
&& ((Mobile)root).Player
/*&& IsInnocentTo( m_Thief, (Mobile)root )*/
&& !IsInGuild( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players.
}
else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 )
{
m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild.
}
else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable )
{
m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers.
}
else if ( root is PlayerVendor )
{
m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors.
}
else if ( !m_Thief.CanSee( toSteal ) )
{
m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) )
{
m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it.
}
else if ( toSteal.Parent is Mobile )
{
m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped.
}
else if ( root == m_Thief )
{
m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed.
}
else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) )
{
m_Thief.SendMessage("You can't steal from them.");
}
else
{
double w = toSteal.Weight + toSteal.TotalWeight;
if ( w > 10 )
{
m_Thief.SendMessage( "That is too heavy to steal." );
}
else
{
if ( toSteal.Stackable && toSteal.Amount > 1 )
{
int minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight);
int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);
if ( minAmount < 1 )
minAmount = 1;
if ( maxAmount < 1 )
maxAmount = 1;
else if ( maxAmount > toSteal.Amount )
maxAmount = toSteal.Amount;
int amount = Utility.RandomMinMax( minAmount, maxAmount );
if ( amount >= toSteal.Amount )
{
int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
pileWeight *= 10;
//.........这里部分代码省略.........
示例6: PublicOverheadItemMessage
public static void PublicOverheadItemMessage(Item item, MessageType type, int hue, int font, string text)
{
if (item != null && item.Map != null)
{
Packet p = null;
Point3D worldLoc = item.GetWorldLocation();
IPooledEnumerable eable = item.Map.GetClientsInRange(worldLoc, item.GetMaxUpdateRange());
foreach (NetState state in eable)
{
Mobile m = state.Mobile;
if (m.CanSee(item) && m.InRange(worldLoc, item.GetUpdateRange(m)))
{
if (p == null)
{
p = new AsciiMessage(item.Serial, item.ItemID, type, hue, font, item.Name, text);
p.Acquire();
}
state.Send(p);
}
}
Packet.Release(p);
eable.Free();
}
}
示例7: LockDown
public bool LockDown( Mobile m, Item item, bool checkIsInside )
{
if ( !IsCoOwner( m ) || !IsActive )
return false;
// Mondain's Legacy Mod
if ( ( item is BaseAddonContainer || item.Movable ) && !IsSecure( item ) )
{
int amt = 1 + item.TotalItems;
Item rootItem = item.RootParent as Item;
Item parentItem = item.Parent as Item;
if ( checkIsInside && item.RootParent is Mobile )
{
m.SendLocalizedMessage( 1005525 );//That is not in your house
}
else if ( checkIsInside && !IsInside( item.GetWorldLocation(), item.ItemData.Height ) )
{
m.SendLocalizedMessage( 1005525 );//That is not in your house
}
else if ( Ethics.Ethic.IsImbued( item ) )
{
m.SendLocalizedMessage( 1005377 );//You cannot lock that down
}
else if ( IsSecure( rootItem ) )
{
m.SendLocalizedMessage( 501737 ); // You need not lock down items in a secure container.
}
else if ( parentItem != null && !IsLockedDown( parentItem ) )
{
m.SendLocalizedMessage( 501736 ); // You must lockdown the container first!
}
else if ( !(item is VendorRentalContract) && ( IsAosRules ? (!CheckAosLockdowns( amt ) || !CheckAosStorage( amt )) : (this.LockDownCount + amt) > m_MaxLockDowns ) )
{
m.SendLocalizedMessage( 1005379 );//That would exceed the maximum lock down limit for this house
}
else
{
SetLockdown( item, true );
return true;
}
}
else if ( m_LockDowns.IndexOf( item ) != -1 )
{
m.SendLocalizedMessage( 1005526 );//That is already locked down
return true;
}
else
{
m.SendLocalizedMessage( 1005377 );//You cannot lock that down
}
return false;
}
示例8: OnDroppedOnto
public virtual bool OnDroppedOnto( Mobile from, Item target )
{
if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null )
return false;
else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) )
return false;
else if ( !from.CanSee( target ) || !from.InLOS( target ) )
return false;
else if ( !target.IsAccessibleTo( from ) )
return false;
else if ( !from.OnDroppedItemOnto( this, target ) )
return false;
else
return target.OnDragDrop( from, this );
}
示例9: Use
public virtual void Use( Item item )
{
if ( item == null || item.Deleted )
return;
DisruptiveAction();
if ( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) )
return;
object root = item.RootParent;
bool okay = false;
if ( !Utility.InUpdateRange( this, item.GetWorldLocation() ) )
item.OnDoubleClickOutOfRange( this );
else if ( !CanSee( item ) )
item.OnDoubleClickCantSee( this );
else if ( !item.IsAccessibleTo( this ) )
{
Region reg = Region.Find( item.GetWorldLocation(), item.Map );
if ( reg == null || !reg.SendInaccessibleMessage( item, this ) )
item.OnDoubleClickNotAccessible( this );
}
else if ( !CheckAlive( false ) )
item.OnDoubleClickDead( this );
else if ( item.InSecureTrade )
item.OnDoubleClickSecureTrade( this );
else if ( !AllowItemUse( item ) )
okay = false;
else if ( !item.CheckItemUse( this, item ) )
okay = false;
else if ( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) )
item.OnSnoop( this );
else if ( m_Region.OnDoubleClick( this, item ) )
okay = true;
if ( okay )
{
if ( !item.Deleted )
item.OnItemUsed( this, item );
if ( !item.Deleted )
item.OnDoubleClick( this );
}
}
示例10: LockDown
public bool LockDown(Mobile m, Item item, bool checkIsInside)
{
if (!IsFriend(m))
return false;
if (item.Movable && !IsSecure(item))
{
// wea: 14/Aug/2006 modified so containers are treated as a single item
int amt;
if (item is BaseContainer)
amt = 1;
else
amt = 1 + item.TotalItems;
Item rootItem = item.RootParent as Item;
if (checkIsInside && item.RootParent is Mobile)
{
m.SendLocalizedMessage(1005525);//That is not in your house
}
else if (checkIsInside && !IsInside(item.GetWorldLocation(), item.ItemData.Height))
{
m.SendLocalizedMessage(1005525);//That is not in your house
}
else if (IsSecure(rootItem))
{
m.SendLocalizedMessage(501737); // You need not lock down items in a secure container.
}
//Pix: In order to eliminate an exploit where players can create non-movable objects anywhere
// in the world, we'll make then not be able to lock down items inside containers.
// If the item is not in a container, then the rootItem will be null.
else if (rootItem != null)
{
m.SendMessage("You cannot lock down items inside containers.");
}
//else if ( rootItem != null && !IsLockedDown( rootItem ) )
//{
// m.SendLocalizedMessage( 501736 ); // You must lockdown the container first!
//}
else if (IsAosRules ? (!CheckAosLockdowns(amt) || !CheckAosStorage(amt)) : (this.LockDownCount + amt) > m_MaxLockDowns)
{
m.SendLocalizedMessage(1005379);//That would exceed the maximum lock down limit for this house
}
else if (item is Container && !IsExceptionContainer(item) && (m_LockBoxCount >= m_MaxLockBoxes /*|| m_Public*/))
{
/*if ( m_Public )
m.SendMessage( "Public houses may not have locked down containers." );
else*/
m.SendMessage("The maximum number of LockBoxes has been reached : {0}", m_MaxLockBoxes.ToString());
return false;
}
else if (item is Container && !IsExceptionContainer(item) && StorageTaxCredits == 0 && m_LockBoxCount >= LockBoxFloor)
{
m.SendMessage("You do not have enough stored tax credits to lock that down.");
return false;
}
else
{
SetLockdown(item, true);
return true;
}
}
else if (m_LockDowns.IndexOf(item) != -1)
{
m.SendLocalizedMessage(1005526);//That is already locked down
return true;
}
else
{
m.SendLocalizedMessage(1005377);//You cannot lock that down
}
return false;
}
示例11: TryStealItem
private Item TryStealItem( Item toSteal, ref bool caught )
{
Item stolen = null;
object root = toSteal.RootParent;
StealableArtifactsSpawner.StealableInstance si = null;
if ( toSteal.Parent == null || !toSteal.Movable )
si = StealableArtifactsSpawner.GetStealableInstance( toSteal );
if ( !IsEmptyHanded( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
}
else if ( root is Mobile && ( (Mobile) root ).IsPlayer && IsInnocentTo( m_Thief, (Mobile) root ) && !IsInGuild( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players.
}
else if ( SuspendOnMurder && root is Mobile && ( (Mobile) root ).IsPlayer && IsInGuild( m_Thief ) && m_Thief.Kills > 0 )
{
m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild.
}
else if ( root is BaseVendor && ( (BaseVendor) root ).IsInvulnerable )
{
m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers.
}
else if ( root is PlayerVendor )
{
m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors.
}
else if ( !m_Thief.CanSee( toSteal ) )
{
m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( m_Thief.Backpack == null || ( !toSteal.Stackable && !m_Thief.Backpack.CheckHold( m_Thief, toSteal, false, true ) ) )
{
m_Thief.SendLocalizedMessage( 1048147 ); // Your backpack can't hold anything else.
}
#region Sigils
else if ( toSteal is Sigil )
{
PlayerState pl = PlayerState.Find( m_Thief );
Faction faction = ( pl == null ? null : pl.Faction );
Sigil sig = (Sigil) toSteal;
if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) )
{
m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it.
}
else if ( root != null ) // not on the ground
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( faction != null )
{
if ( !m_Thief.CanBeginAction( typeof( IncognitoSpell ) ) )
{
m_Thief.SendLocalizedMessage( 1010581 ); // You cannot steal the sigil when you are incognito
}
else if ( DisguiseGump.IsDisguised( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1010583 ); // You cannot steal the sigil while disguised
}
else if ( !m_Thief.CanBeginAction( typeof( PolymorphSpell ) ) )
{
m_Thief.SendLocalizedMessage( 1010582 ); // You cannot steal the sigil while polymorphed
}
else if ( TransformationSpell.UnderTransformation( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1061622 ); // You cannot steal the sigil while in that form.
}
else if ( Spells.Ninjitsu.AnimalForm.UnderTransformation( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1063222 ); // You cannot steal the sigil while mimicking an animal.
}
else if ( pl.IsLeaving )
{
m_Thief.SendLocalizedMessage( 1005589 ); // You are currently quitting a faction and cannot steal the town sigil
}
else if ( sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction )
{
m_Thief.SendLocalizedMessage( 1005590 ); // You cannot steal your own sigil
}
else if ( sig.IsPurifying )
{
m_Thief.SendLocalizedMessage( 1005592 ); // You cannot steal this sigil until it has been purified
}
else if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, 80.0, 80.0 ) )
{
if ( Sigil.ExistsOn( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil.
}
else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, sig, false, true ) )
{
m_Thief.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full
}
else
{
//.........这里部分代码省略.........
示例12: InRange
public bool InRange(Item item, int range)
{
return InRange(item.GetWorldLocation(), item.Map, range);
}
示例13: Resurrect
public static void Resurrect( Mobile m, Item item, bool chaos )
{
if ( m == null || item == null || m.Map == null || m.Alive )
return;
if ( !chaos && m.Kills >= 5 )
{
m.SendMessage( "Thy deeds are those of a scoundrel; thou shalt not be resurrected here." );
return;
}
Point3D loc = item.GetWorldLocation();
if ( !m.InRange( loc, ResurrectRange ) || !m.Map.LineOfSight( m, loc ) )
m.SendLocalizedMessage( 500446 ); // That is too far away.
else if( m.Map.CanFit( m.Location, 16, false, false ) )
{
//m.CloseGump( typeof( ResurrectGump ) );
//m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
if ( m.NetState != null )
new ResurrectMenu(m, chaos ? ResurrectMessage.ChaosShrine : ResurrectMessage.VirtueShrine).SendTo(m.NetState);
}
else
m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
}
示例14: Resurrect
public static void Resurrect( Mobile m, Item item )
{
if ( m.Alive )
{
return;
}
if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) )
{
m.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
{
( (PlayerMobile) m ).CloseGump( typeof( ResurrectGump ) );
m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
}
else
{
m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
}
}
示例15: Resurrect
public static void Resurrect( Mobile m, Item item )
{
if ( m.Alive )
return;
if (m.CantWalk)
return;
if (!m.InRange(item.GetWorldLocation(), ResurrectRange))
{
m.SendAsciiMessage("That is too far away.");
// m.SendLocalizedMessage(500446); // That is too far away.
}
else if (m.Map != null && m.Map.CanFit(m.Location, 16, false, false))
{
m.CantWalk = true;
m.CloseGump(typeof(ResurrectGump));
if (m is PlayerMobile && !((PlayerMobile)m).HasMenu)
{
((PlayerMobile)m).HasMenu = true;
m.SendMenu(new ResurrectGump(m, ResurrectMessage.VirtueShrine));
}
//m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
}
else
m.SendAsciiMessage("Thou can not be resurrected there!");
//m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
}