本文整理汇总了C#中Server.Items.MapItem类的典型用法代码示例。如果您正苦于以下问题:C# MapItem类的具体用法?C# MapItem怎么用?C# MapItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapItem类属于Server.Items命名空间,在下文中一共展示了MapItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMapTarget
public void OnMapTarget( MapItem map )
{
Caster.SendMessage( "OnMapTarget" );
if ( map.RootParent != Caster )
Caster.SendMessage( "The map must be in your backpack for you to use." );
else if ( map.Pins.Count < 1 )
Caster.SendMessage( "The map doesn't have any pins to teleport to." );
else
{
Point3D point = new Point3D( map.Pins[0].X, map.Pins[0].Y, map.DisplayMap.GetAverageZ( map.Pins[0].X, map.Pins[0].Y ) );
Caster.SendMessage( "Base Location " + point.X.ToString() + ", " + point.Y.ToString() );
point.X += map.Bounds.X;
point.Y += map.Bounds.Y;
Caster.SendMessage( "Map Scaled Location " + point.X.ToString() + ", " + point.Y.ToString() );
if ( !SpellHelper.FindValidSpawnLocation( map.DisplayMap, ref point, false ) )
{
Caster.SendMessage( "That is not a valid location." );
Caster.SendMessage( "Failed Location " + point.X.ToString() + ", " + point.Y.ToString() );
}
else if ( !SpellHelper.CheckTravel( map.DisplayMap, point, TravelCheckType.RecallTo ) )
{
Caster.SendMessage( "Travel there is restricted." );
Caster.SendMessage( "Failed Location " + point.X.ToString() + ", " + point.Y.ToString() );
}
else
{
Caster.SendMessage( "Teleporting to " + point.X.ToString() + ", " + point.Y.ToString() );
Caster.Mana -= ScaleMana( GetMana() );
Caster.MoveToWorld( point, map.DisplayMap );
Effects.SendLocationParticles( EffectItem.Create( new Point3D ( point.X, point.Y, point.Z ), Caster.Map, EffectItem.DefaultDuration ), 0x3716, 7, 10, 1266, 3, 5052, 0 );
Effects.SendLocationParticles( EffectItem.Create( new Point3D ( point.X, point.Y, point.Z+20 ), Caster.Map, EffectItem.DefaultDuration ), 0x3716, 7, 10, 1266, 3, 5052, 0 );
Effects.SendLocationParticles( EffectItem.Create( new Point3D ( point.X, point.Y, point.Z+40 ), Caster.Map, EffectItem.DefaultDuration ), 0x3716, 7, 10, 1266, 3, 5052, 0 );
Effects.SendLocationParticles( EffectItem.Create( new Point3D ( point.X, point.Y, point.Z+60 ), Caster.Map, EffectItem.DefaultDuration ), 0x3716, 7, 10, 1266, 3, 5052, 0 );
}
}
FinishSequence();
}
示例2: AssociateMap
public void AssociateMap( MapItem map )
{
if ( CheckDecay() )
return;
if ( map is BlankMap )
{
if ( TillerMan != null )
TillerMan.Say( 502575 ); // Ar, that is not a map, tis but a blank piece of paper!
}
else if ( map.Pins.Count == 0 )
{
if ( TillerMan != null )
TillerMan.Say( 502576 ); // Arrrr, this map has no course on it!
}
else
{
StopMove( false );
MapItem = map;
NextNavPoint = -1;
if ( TillerMan != null )
TillerMan.Say( 502577 ); // A map!
}
}
示例3: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 3:
{
m_MapItem = (MapItem) reader.ReadItem();
m_NextNavPoint = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Facing = (Direction)reader.ReadInt();
goto case 1;
}
case 1:
{
m_DecayTime = reader.ReadDeltaTime();
goto case 0;
}
case 0:
{
if ( version < 3 )
m_NextNavPoint = -1;
if ( version < 2 )
{
if ( ItemID == NorthID )
m_Facing = Direction.North;
else if ( ItemID == SouthID )
m_Facing = Direction.South;
else if ( ItemID == EastID )
m_Facing = Direction.East;
else if ( ItemID == WestID )
m_Facing = Direction.West;
}
m_Owner = reader.ReadMobile();
m_PPlank = reader.ReadItem() as Plank;
m_SPlank = reader.ReadItem() as Plank;
m_TillerMan = reader.ReadItem() as TillerMan;
m_Hold = reader.ReadItem() as Hold;
m_Anchored = reader.ReadBool();
m_ShipName = reader.ReadString();
if ( version < 1)
Refresh();
break;
}
}
m_Instances.Add( this );
}
示例4: OnComplete
public override void OnComplete()
{
PlayerMobile from = System.From;
Point3D loc = WitchApprenticeQuest.RandomZeefzorpulLocation();
MapItem mapItem = new MapItem();
mapItem.SetDisplay( loc.X - 200, loc.Y - 200, loc.X + 200, loc.Y + 200, 200, 200 );
mapItem.AddWorldPin( loc.X, loc.Y );
from.AddToBackpack( mapItem );
from.AddToBackpack( new MagicFlute() );
from.SendLocalizedMessage( 1055061 ); // You have received a map and a magic flute.
System.AddConversation( new ImpDeathConversation( loc ) );
}
示例5: GetRoutes_OnCommand
public static void GetRoutes_OnCommand(CommandEventArgs e)
{
MapItem mapitem;
for (int i = 0; i < SpawnDefinition.PirateTramFelCoursesJhelom.Length; i++)
{
mapitem = new MapItem();
mapitem.SetDisplay(5, 5, 5120 - 32, 4096 - 10, 400, 400);
for (int j = 0; j < SpawnDefinition.PirateTramFelCoursesJhelom[i].Length; j++)
{
Point2D pnt = SpawnDefinition.PirateTramFelCoursesJhelom[i][j];
mapitem.AddWorldPin(pnt.X, pnt.Y);
}
mapitem.Name = String.Format("Pirate - Jhelom {0}", i + 1);
e.Mobile.AddToBackpack(mapitem);
}
for (int i = 0; i < SpawnDefinition.PirateTramFelCoursesMoonglow.Length; i++)
{
mapitem = new MapItem();
mapitem.SetDisplay(5, 5, 5120 - 32, 4096 - 10, 400, 400);
for (int j = 0; j < SpawnDefinition.PirateTramFelCoursesJhelom[i].Length; j++)
{
Point2D pnt = SpawnDefinition.PirateTramFelCoursesJhelom[i][j];
mapitem.AddWorldPin(pnt.X, pnt.Y);
}
mapitem.Name = String.Format("Pirate - Moonglow {0}", i + 1);
e.Mobile.AddToBackpack(mapitem);
}
for (int i = 0; i < SpawnDefinition.PirateTokunoCourses.Length; i++)
{
mapitem = new MapItem();
mapitem.SetDisplay(5, 5, 1448 - 32, 1448 - 10, 400, 400);
for (int j = 0; j < SpawnDefinition.PirateTokunoCourses[i].Length; j++)
{
Point2D pnt = SpawnDefinition.PirateTokunoCourses[i][j];
mapitem.AddWorldPin(pnt.X, pnt.Y);
}
mapitem.Name = String.Format("Pirate - tokuno {0}", i + 1);
e.Mobile.AddToBackpack(mapitem);
}
for (int i = 0; i < SpawnDefinition.MerchantTokunoCourses.Length; i++)
{
mapitem = new MapItem();
mapitem.SetDisplay(5, 5, 1448 - 32, 1448 - 10, 400, 400);
for (int j = 0; j < SpawnDefinition.PirateTokunoCourses[i].Length; j++)
{
Point2D pnt = SpawnDefinition.PirateTokunoCourses[i][j];
mapitem.AddWorldPin(pnt.X, pnt.Y);
}
mapitem.Name = String.Format("Merchant - tokuno {0}", i + 1);
e.Mobile.AddToBackpack(mapitem);
}
for (int i = 0; i < SpawnDefinition.MerchantTramFelCourses1.Length; i++)
{
mapitem = new MapItem();
mapitem.SetDisplay(5, 5, 5120 - 32, 4096 - 10, 400, 400);
for (int j = 0; j < SpawnDefinition.MerchantTramFelCourses1[i].Length; j++)
{
Point2D pnt = SpawnDefinition.MerchantTramFelCourses1[i][j];
mapitem.AddWorldPin(pnt.X, pnt.Y);
}
mapitem.Name = String.Format("Merchant - tram/fel(a) {0}", i + 1);
e.Mobile.AddToBackpack(mapitem);
}
for (int i = 0; i < SpawnDefinition.MerchantTramFelCourses2.Length; i++)
{
mapitem = new MapItem();
mapitem.SetDisplay(5, 5, 5120 - 32, 4096 - 10, 400, 400);
for (int j = 0; j < SpawnDefinition.MerchantTramFelCourses2[i].Length; j++)
{
Point2D pnt = SpawnDefinition.MerchantTramFelCourses2[i][j];
mapitem.AddWorldPin(pnt.X, pnt.Y);
}
mapitem.Name = String.Format("Merchant - tram/fel(b) {0}", i + 1);
e.Mobile.AddToBackpack(mapitem);
}
}
示例6: MapSetEditable
public MapSetEditable( MapItem map, bool editable ) : base( map, 7, editable ? 1 : 0, 0, 0 )
{
}
示例7: MapAddPin
public MapAddPin( MapItem map, Point2D point ) : base( map, 1, 0, point.X, point.Y )
{
}
示例8: MapDisplay
public MapDisplay( MapItem map ) : base( map, 5, 0, 0, 0 )
{
}
示例9: MapCommand
public MapCommand( MapItem map, int command, int number, int x, int y ) : base ( 0x56, 11 )
{
m_Stream.Write( (int) map.Serial );
m_Stream.Write( (byte) command );
m_Stream.Write( (byte) number );
m_Stream.Write( (short) x );
m_Stream.Write( (short) y );
}
示例10: NewMapDetails
public NewMapDetails(MapItem map) : base(0xF5, 21)
{
m_Stream.Write((int)map.Serial);
m_Stream.Write((short)0x139D);
m_Stream.Write((short)map.Bounds.Start.X);
m_Stream.Write((short)map.Bounds.Start.Y);
m_Stream.Write((short)map.Bounds.End.X);
m_Stream.Write((short)map.Bounds.End.Y);
m_Stream.Write((short)map.Width);
m_Stream.Write((short)map.Height);
short mapValue = 0x00;
if (map.Facet == Map.Felucca)
mapValue = 0x00;
else if (map.Facet == Map.Trammel)
mapValue = 0x01;
else if (map.Facet == Map.Ilshenar)
mapValue = 0x02;
else if (map.Facet == Map.Malas)
mapValue = 0x03;
else if (map.Facet == Map.Tokuno)
mapValue = 0x04;
else if (map.Facet == Map.TerMur)
mapValue = 0x05;
m_Stream.Write(mapValue);
}
示例11: MapDetails
public MapDetails( MapItem map ) : base ( 0x90, 19 )
{
m_Stream.Write( (int) map.Serial );
m_Stream.Write( (short) 0x139D );
m_Stream.Write( (short) map.Bounds.Start.X );
m_Stream.Write( (short) map.Bounds.Start.Y );
m_Stream.Write( (short) map.Bounds.End.X );
m_Stream.Write( (short) map.Bounds.End.Y );
m_Stream.Write( (short) map.Width );
m_Stream.Write( (short) map.Height );
}
示例12: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 8:
{
m_Sunk = reader.ReadBool();
goto case 7;
}
case 7:
{
int numm_DamageEntries = reader.ReadInt();
for (int i = 0; i < numm_DamageEntries; i++)
{
Mobile mob = reader.ReadMobile();
int damage = reader.ReadInt();
DateTime expiration = DateTime.UtcNow + reader.ReadTimeSpan();
AddDamageEntry(mob, damage, expiration);
}
goto case 6;
}
case 6:
{
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
BoatComponent component = reader.ReadItem() as BoatComponent;
if (component != null) BoatComponents.Add(component);
}
goto case 5;
}
case 5:
{
m_Hits = reader.ReadInt();
goto case 4;
}
case 4:
{
m_RequiresWater = reader.ReadBool();
goto case 3;
}
case 3:
{
m_MapItem = (MapItem)reader.ReadItem();
m_NextNavPoint = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Facing = (Direction)reader.ReadInt();
goto case 1;
}
case 1:
{
m_DecayTime = reader.ReadDeltaTime();
goto case 0;
}
case 0:
{
if (version < 3)
m_NextNavPoint = -1;
if (version < 2)
{
if (ItemID == NorthID)
m_Facing = Direction.North;
else if (ItemID == SouthID)
m_Facing = Direction.South;
else if (ItemID == EastID)
m_Facing = Direction.East;
else if (ItemID == WestID)
m_Facing = Direction.West;
}
m_Owner = reader.ReadMobile();
m_PPlank = reader.ReadItem() as Plank;
m_SPlank = reader.ReadItem() as Plank;
m_TillerMan = reader.ReadItem() as TillerMan;
m_Hold = reader.ReadItem() as Hold;
m_Anchored = reader.ReadBool();
m_ShipName = reader.ReadString();
if (version < 1)
Refresh();
break;
}
}
m_Instances.Add(this);
}
示例13: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 4:
{
if (reader.ReadInt() == 1)
{
m_BoatCourse = new BoatCourse(reader);
m_BoatCourse.Boat = this;
m_BoatCourse.Map = this.Map;
}
m_DockedBoat = reader.ReadItem() as BaseDockedBoat;
m_VirtualMount = reader.ReadItem() as BoatMountItem;
m_Decay = reader.ReadBool();
goto case 3;
}
case 3:
{
m_MapItem = (MapItem)reader.ReadItem();
m_NextNavPoint = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Facing = (Direction)reader.ReadInt();
goto case 1;
}
case 1:
{
m_DecayTime = reader.ReadDeltaTime();
goto case 0;
}
case 0:
{
if (version < 3)
m_NextNavPoint = -1;
if (version < 2)
{
if (ItemID == NorthID)
m_Facing = Direction.North;
else if (ItemID == SouthID)
m_Facing = Direction.South;
else if (ItemID == EastID)
m_Facing = Direction.East;
else if (ItemID == WestID)
m_Facing = Direction.West;
}
m_Owner = reader.ReadMobile();
m_PPlank = reader.ReadItem() as Plank;
m_SPlank = reader.ReadItem() as Plank;
if (!IsClassicBoat && !(this is RowBoat))
m_TillerMan = reader.ReadMobile() as object;
else
m_TillerMan = reader.ReadItem() as object;
m_Hold = reader.ReadItem() as Hold;
m_Anchored = reader.ReadBool();
m_ShipName = reader.ReadString();
m_Anchored = false; //No more anchors[High Seas]
if (version < 1)
Refresh();
break;
}
}
m_Instances.Add(this);
if (m_VirtualMount == null)
m_VirtualMount = new BoatMountItem(this);
if (version == 6)
{
if (m_MapItem != null)
Timer.DelayCall(TimeSpan.FromSeconds(10), delegate
{
BoatCourse = new BoatCourse(this, m_MapItem);
});
}
}
示例14: BoatCourse
public BoatCourse(BaseBoat boat, MapItem item)
{
m_Boat = boat;
m_Map = boat.Map;
m_GivenMap = false;
for (int i = 0; i < item.Pins.Count; i++)
{
int x, y;
item.ConvertToWorld(item.Pins[i].X, item.Pins[i].Y, out x, out y);
m_Waypoints.Add(new Point2D(x, y));
}
}
示例15: NewMapDetails
public NewMapDetails(MapItem map)
: base(0xF5, 21)
{
Map newmap = map.Map;
if (newmap != Map.Trammel)
newmap = Map.Trammel;
m_Stream.Write((int)map.Serial);
m_Stream.Write((short)0x139D);
m_Stream.Write((short)map.Bounds.Start.X);
m_Stream.Write((short)map.Bounds.Start.Y);
m_Stream.Write((short)map.Bounds.End.X);
m_Stream.Write((short)map.Bounds.End.Y);
m_Stream.Write((short)map.Width);
m_Stream.Write((short)map.Height);
m_Stream.Write((short) /*( map.Facet == null ? 0 :*/ newmap.MapID);
}