This commit is contained in:
mark 2010-12-06 06:45:45 +00:00
parent 34d969712e
commit d444b9ba5c
70 changed files with 569 additions and 495 deletions

View file

@ -901,7 +901,7 @@ namespace Server.Commands
m_DeleteQueue.Enqueue( item ); m_DeleteQueue.Enqueue( item );
} }
} }
else if ( (TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.LightSource) != 0 ) else if ( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.LightSource) != 0 )
{ {
eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 ); eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );

View file

@ -898,7 +898,7 @@ namespace Server.Commands
m_DeleteQueue.Enqueue( item ); m_DeleteQueue.Enqueue( item );
} }
} }
else if ( (TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.LightSource) != 0 ) else if ( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.LightSource) != 0 )
{ {
eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 ); eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );

View file

@ -108,7 +108,7 @@ namespace Server.Commands
if ( item is BaseAddon && ((BaseAddon)item).Components.Count == 1 ) if ( item is BaseAddon && ((BaseAddon)item).Components.Count == 1 )
itemID = ((AddonComponent)(((BaseAddon)item).Components[0])).ItemID; itemID = ((AddonComponent)(((BaseAddon)item).Components[0])).ItemID;
if ( itemID >= 0x4000 ) if ( itemID > TileData.MaxItemValue )
itemID = 1; itemID = 1;
xml.WriteAttributeString( "gfx", XmlConvert.ToString( itemID ) ); xml.WriteAttributeString( "gfx", XmlConvert.ToString( itemID ) );

View file

@ -210,13 +210,7 @@ namespace Server
if ( xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8 ) if ( xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8 )
continue; continue;
StaticTile newTile = new StaticTile(); StaticTile newTile = new StaticTile( (ushort)item.ItemID, (byte)xOffset, (byte)yOffset, (sbyte)item.Z, (short)item.Hue );
newTile.m_ID = (short)(item.ItemID & 0x3FFF);
newTile.m_X = (byte)xOffset;
newTile.m_Y = (byte)yOffset;
newTile.m_Z = (sbyte)item.Z;
newTile.m_Hue = (short)item.Hue;
newTiles[newTileCount++] = newTile; newTiles[newTileCount++] = newTile;
@ -241,22 +235,22 @@ namespace Server
{ {
StaticTile toWrite = oldTiles[i]; StaticTile toWrite = oldTiles[i];
mulWriter.Write( (short) toWrite.m_ID ); mulWriter.Write( (ushort) toWrite.ID );
mulWriter.Write( (byte) toWrite.m_X ); mulWriter.Write( (byte) toWrite.X );
mulWriter.Write( (byte) toWrite.m_Y ); mulWriter.Write( (byte) toWrite.Y );
mulWriter.Write( (sbyte) toWrite.m_Z ); mulWriter.Write( (sbyte) toWrite.Z );
mulWriter.Write( (short) toWrite.m_Hue ); mulWriter.Write( (short) toWrite.Hue );
} }
for ( int i = 0; i < newTileCount; ++i ) for ( int i = 0; i < newTileCount; ++i )
{ {
StaticTile toWrite = newTiles[i]; StaticTile toWrite = newTiles[i];
mulWriter.Write( (short) toWrite.m_ID ); mulWriter.Write( (ushort) toWrite.ID );
mulWriter.Write( (byte) toWrite.m_X ); mulWriter.Write( (byte) toWrite.X );
mulWriter.Write( (byte) toWrite.m_Y ); mulWriter.Write( (byte) toWrite.Y );
mulWriter.Write( (sbyte) toWrite.m_Z ); mulWriter.Write( (sbyte) toWrite.Z );
mulWriter.Write( (short) toWrite.m_Hue ); mulWriter.Write( (short) toWrite.Hue );
} }
mulWriter.Flush(); mulWriter.Flush();
@ -381,8 +375,8 @@ namespace Server
{ {
StaticTile oldTile = oldTiles[i]; StaticTile oldTile = oldTiles[i];
int px = baseX + oldTile.m_X; int px = baseX + oldTile.X;
int py = baseY + oldTile.m_Y; int py = baseY + oldTile.Y;
if ( px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight ) if ( px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight )
{ {
@ -392,11 +386,11 @@ namespace Server
{ {
++totalUnfrozen; ++totalUnfrozen;
Item item = new Static( oldTile.m_ID & 0x3FFF ); Item item = new Static( oldTile.ID );
item.Hue = oldTile.m_Hue; item.Hue = oldTile.Hue;
item.MoveToWorld( new Point3D( px + xTileStart, py + yTileStart, oldTile.m_Z ), map ); item.MoveToWorld( new Point3D( px + xTileStart, py + yTileStart, oldTile.Z ), map );
} }
} }
@ -416,11 +410,11 @@ namespace Server
{ {
StaticTile toWrite = newTiles[i]; StaticTile toWrite = newTiles[i];
mulWriter.Write( (short) toWrite.m_ID ); mulWriter.Write( (ushort) toWrite.ID );
mulWriter.Write( (byte) toWrite.m_X ); mulWriter.Write( (byte) toWrite.X );
mulWriter.Write( (byte) toWrite.m_Y ); mulWriter.Write( (byte) toWrite.Y );
mulWriter.Write( (sbyte) toWrite.m_Z ); mulWriter.Write( (sbyte) toWrite.Z );
mulWriter.Write( (short) toWrite.m_Hue ); mulWriter.Write( (short) toWrite.Hue );
} }
mulWriter.Flush(); mulWriter.Flush();
@ -533,11 +527,9 @@ namespace Server
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
staTiles[i].m_ID = (short)(m_Buffer[index++] | (m_Buffer[index++] << 8)); staTiles[i].Set((ushort)(m_Buffer[index++] | (m_Buffer[index++] << 8)),
staTiles[i].m_X = m_Buffer[index++]; (byte)m_Buffer[index++], (byte)m_Buffer[index++], (sbyte)m_Buffer[index++],
staTiles[i].m_Y = m_Buffer[index++]; (short)(m_Buffer[index++] | (m_Buffer[index++] << 8)));
staTiles[i].m_Z = (sbyte)m_Buffer[index++];
staTiles[i].m_Hue = (short)(m_Buffer[index++] | (m_Buffer[index++] << 8));
} }
} }
} }
@ -558,7 +550,7 @@ namespace Server
{ {
m_X = p.X; m_X = p.X;
m_Y = p.Y; m_Y = p.Y;
m_List = new List<Item>(); m_List = new List<Item>();
} }
} }

View file

@ -95,7 +95,7 @@ namespace Server.Engines.BulkOrders
int graphic = Utility.ToInt32( split[split.Length - 1] ); int graphic = Utility.ToInt32( split[split.Length - 1] );
if ( type != null && graphic > 0 ) if ( type != null && graphic > 0 )
list.Add( new SmallBulkEntry( type, 1020000 + graphic, graphic ) ); list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
} }
} }
catch catch

View file

@ -420,12 +420,12 @@ namespace Server.Engines.Craft
int vx = from.X + x; int vx = from.X + x;
int vy = from.Y + y; int vy = from.Y + y;
Tile[] tiles = map.Tiles.GetStaticTiles( vx, vy, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( vx, vy, true );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
int z = tiles[i].Z; int z = tiles[i].Z;
int id = tiles[i].ID & 0x3FFF; int id = tiles[i].ID;
if ( (z + 16) > from.Z && (from.Z + 16) > z && Find( id, itemIDs ) ) if ( (z + 16) > from.Z && (from.Z + 16) > z && Find( id, itemIDs ) )
return true; return true;

View file

@ -92,11 +92,11 @@ namespace Server.Engines.Craft
{ {
for ( int y = -range; (!anvil || !forge) && y <= range; ++y ) for ( int y = -range; (!anvil || !forge) && y <= range; ++y )
{ {
Tile[] tiles = map.Tiles.GetStaticTiles( from.X+x, from.Y+y, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( from.X+x, from.Y+y, true );
for ( int i = 0; (!anvil || !forge) && i < tiles.Length; ++i ) for ( int i = 0; (!anvil || !forge) && i < tiles.Length; ++i )
{ {
int id = tiles[i].ID & 0x3FFF; int id = tiles[i].ID;
bool isAnvil = ( id == 4015 || id == 4016 || id == 0x2DD5 || id == 0x2DD6 ); bool isAnvil = ( id == 4015 || id == 4016 || id == 0x2DD5 || id == 0x2DD6 );
bool isForge = ( id == 4017 || (id >= 6522 && id <= 6569) || id == 0x2DD8 ); bool isForge = ( id == 4017 || (id >= 6522 && id <= 6569) || id == 0x2DD8 );

View file

@ -159,10 +159,14 @@ namespace Server.Engines.Craft
private void AddNecroSpell( int spell, int mana, double minSkill, Type type, params Type[] regs ) private void AddNecroSpell( int spell, int mana, double minSkill, Type type, params Type[] regs )
{ {
int index = AddCraft( type, 1061677, 1060509 + spell, minSkill, minSkill + 1.0, regs[0], 1020000 + CraftItem.ItemIDOf( regs[0] ), 1, 501627 ); //Yes, on OSI it's only 1.0 skill diff'. Don't blame me, blame OSI. int id = CraftItem.ItemIDOf( regs[0] );
for ( int i = 1; i < regs.Length; ++i ) int index = AddCraft( type, 1061677, 1060509 + spell, minSkill, minSkill + 1.0, regs[0], id < 0x4000 ? 1020000 + id : 1078872 + id, 501627 ); //Yes, on OSI it's only 1.0 skill diff'. Don't blame me, blame OSI.
AddRes( index, regs[i], 1020000 + CraftItem.ItemIDOf( regs[i] ), 1, 501627 );
for ( int i = 1; i < regs.Length; ++i ) {
id = CraftItem.ItemIDOf( regs[i] );
AddRes( index, regs[i], id < 0x4000 ? 1020000 + id : 1078872 + id, 1, 501627 );
}
AddRes( index, typeof( BlankScroll ), 1044377, 1, 1044378 ); AddRes( index, typeof( BlankScroll ), 1044377, 1, 1044378 );

View file

@ -467,7 +467,7 @@ namespace Server.Engines.Harvest
{ {
LandTarget obj = (LandTarget)toHarvest; LandTarget obj = (LandTarget)toHarvest;
tileID = obj.TileID & 0x3FFF; tileID = obj.TileID;
map = from.Map; map = from.Map;
loc = obj.Location; loc = obj.Location;
} }

View file

@ -387,7 +387,7 @@ namespace Server.Engines.Harvest
int tx = m.X - 10 + Utility.Random( 21 ); int tx = m.X - 10 + Utility.Random( 21 );
int ty = m.Y - 10 + Utility.Random( 21 ); int ty = m.Y - 10 + Utility.Random( 21 );
Tile t = map.Tiles.GetLandTile( tx, ty ); LandTile t = map.Tiles.GetLandTile( tx, ty );
if ( t.Z == -5 && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, -5 ), map ) ) if ( t.Z == -5 && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, -5 ), map ) )
{ {

View file

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Server; using Server;
using Server.Items;
using Server.Mobiles; using Server.Mobiles;
namespace Server.Movement namespace Server.Movement
@ -30,12 +31,12 @@ namespace Server.Movement
{ {
} }
private bool IsOk( bool ignoreDoors, bool ignoreSpellFields, int ourZ, int ourTop, Tile[] tiles, List<Item> items ) private bool IsOk( bool ignoreDoors, bool ignoreSpellFields, int ourZ, int ourTop, StaticTile[] tiles, List<Item> items )
{ {
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile check = tiles[i]; StaticTile check = tiles[i];
ItemData itemData = TileData.ItemTable[check.ID & 0x3FFF]; ItemData itemData = TileData.ItemTable[check.ID & TileData.MaxItemValue];
if ( (itemData.Flags & ImpassableSurface) != 0 ) // Impassable || Surface if ( (itemData.Flags & ImpassableSurface) != 0 ) // Impassable || Surface
{ {
@ -50,7 +51,7 @@ namespace Server.Movement
for ( int i = 0; i < items.Count; ++i ) for ( int i = 0; i < items.Count; ++i )
{ {
Item item = items[i]; Item item = items[i];
int itemID = item.ItemID & 0x3FFF; int itemID = item.ItemID & TileData.MaxItemValue;
ItemData itemData = TileData.ItemTable[itemID]; ItemData itemData = TileData.ItemTable[itemID];
TileFlag flags = itemData.Flags; TileFlag flags = itemData.Flags;
@ -85,15 +86,15 @@ namespace Server.Movement
{ {
newZ = 0; newZ = 0;
Tile[] tiles = map.Tiles.GetStaticTiles( x, y, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, true );
Tile landTile = map.Tiles.GetLandTile( x, y ); LandTile landTile = map.Tiles.GetLandTile( x, y );
bool landBlocks = (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Impassable) != 0; bool landBlocks = (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) != 0;
bool considerLand = !landTile.Ignored; bool considerLand = !landTile.Ignored;
if ( landBlocks && canSwim && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) != 0 ) //Impassable, Can Swim, and Is water. Don't block it. if ( landBlocks && canSwim && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet) != 0 ) //Impassable, Can Swim, and Is water. Don't block it.
landBlocks = false; landBlocks = false;
else if ( cantWalk && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) == 0 ) //Can't walk and it's not water else if ( cantWalk && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet) == 0 ) //Can't walk and it's not water
landBlocks = true; landBlocks = true;
int landZ = 0, landCenter = 0, landTop = 0; int landZ = 0, landCenter = 0, landTop = 0;
@ -111,8 +112,8 @@ namespace Server.Movement
#region Tiles #region Tiles
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
ItemData itemData = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData itemData = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
TileFlag flags = itemData.Flags; TileFlag flags = itemData.Flags;
if ( (flags & ImpassableSurface) == TileFlag.Surface || (canSwim && (flags & TileFlag.Wet) != 0) ) // Surface && !Impassable if ( (flags & ImpassableSurface) == TileFlag.Surface || (canSwim && (flags & TileFlag.Wet) != 0) ) // Surface && !Impassable
@ -319,13 +320,13 @@ namespace Server.Movement
if ( (item.ItemData.Flags & reqFlags) == 0 ) if ( (item.ItemData.Flags & reqFlags) == 0 )
continue; continue;
if ( sector == sectorStart && item.AtWorldPoint( xStart, yStart ) && item.ItemID < 0x4000 ) if ( sector == sectorStart && item.AtWorldPoint( xStart, yStart ) && item.ItemID <= TileData.MaxItemValue )
itemsStart.Add( item ); itemsStart.Add( item );
else if ( sector == sectorForward && item.AtWorldPoint( xForward, yForward ) && item.ItemID < 0x4000 ) else if ( sector == sectorForward && item.AtWorldPoint( xForward, yForward ) && item.ItemID <= TileData.MaxItemValue )
itemsForward.Add( item ); itemsForward.Add( item );
else if ( sector == sectorLeft && item.AtWorldPoint( xLeft, yLeft ) && item.ItemID < 0x4000 ) else if ( sector == sectorLeft && item.AtWorldPoint( xLeft, yLeft ) && item.ItemID <= TileData.MaxItemValue )
itemsLeft.Add( item ); itemsLeft.Add( item );
else if ( sector == sectorRight && item.AtWorldPoint( xRight, yRight ) && item.ItemID < 0x4000 ) else if ( sector == sectorRight && item.AtWorldPoint( xRight, yRight ) && item.ItemID <= TileData.MaxItemValue )
itemsRight.Add( item ); itemsRight.Add( item );
} }
} }
@ -350,9 +351,9 @@ namespace Server.Movement
if ( (item.ItemData.Flags & reqFlags) == 0 ) if ( (item.ItemData.Flags & reqFlags) == 0 )
continue; continue;
if ( item.AtWorldPoint( xStart, yStart ) && item.ItemID < 0x4000 ) if ( item.AtWorldPoint( xStart, yStart ) && item.ItemID <= TileData.MaxItemValue )
itemsStart.Add( item ); itemsStart.Add( item );
else if ( item.AtWorldPoint( xForward, yForward ) && item.ItemID < 0x4000 ) else if ( item.AtWorldPoint( xForward, yForward ) && item.ItemID <= TileData.MaxItemValue )
itemsForward.Add( item ); itemsForward.Add( item );
} }
} }
@ -368,7 +369,7 @@ namespace Server.Movement
if ( (item.ItemData.Flags & reqFlags) == 0 ) if ( (item.ItemData.Flags & reqFlags) == 0 )
continue; continue;
if ( item.AtWorldPoint( xForward, yForward ) && item.ItemID < 0x4000 ) if ( item.AtWorldPoint( xForward, yForward ) && item.ItemID <= TileData.MaxItemValue )
itemsForward.Add( item ); itemsForward.Add( item );
} }
@ -426,13 +427,13 @@ namespace Server.Movement
{ {
int xCheck = loc.X, yCheck = loc.Y; int xCheck = loc.X, yCheck = loc.Y;
Tile landTile = map.Tiles.GetLandTile( xCheck, yCheck ); LandTile landTile = map.Tiles.GetLandTile( xCheck, yCheck );
int landZ = 0, landCenter = 0, landTop = 0; int landZ = 0, landCenter = 0, landTop = 0;
bool landBlocks = (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Impassable) != 0; bool landBlocks = (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) != 0;
if ( landBlocks && m.CanSwim && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) != 0 ) if ( landBlocks && m.CanSwim && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet) != 0 )
landBlocks = false; landBlocks = false;
else if ( m.CantWalk && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) == 0 ) else if ( m.CantWalk && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet) == 0 )
landBlocks = true; landBlocks = true;
map.GetAverageZ( xCheck, yCheck, ref landZ, ref landCenter, ref landTop ); map.GetAverageZ( xCheck, yCheck, ref landZ, ref landCenter, ref landTop );
@ -453,12 +454,12 @@ namespace Server.Movement
isSet = true; isSet = true;
} }
Tile[] staticTiles = map.Tiles.GetStaticTiles( xCheck, yCheck, true ); StaticTile[] staticTiles = map.Tiles.GetStaticTiles( xCheck, yCheck, true );
for ( int i = 0; i < staticTiles.Length; ++i ) for ( int i = 0; i < staticTiles.Length; ++i )
{ {
Tile tile = staticTiles[i]; StaticTile tile = staticTiles[i];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
int calcTop = (tile.Z + id.CalcHeight); int calcTop = (tile.Z + id.CalcHeight);

View file

@ -270,7 +270,7 @@ namespace Server.Items
if ( !from.Map.CanSpawnMobile( land.Location ) ) if ( !from.Map.CanSpawnMobile( land.Location ) )
return null; return null;
int tileID = land.TileID & 0x3FFF; int tileID = land.TileID;
foreach ( TilesAndEffect taep in m_Table ) foreach ( TilesAndEffect taep in m_Table )
{ {

View file

@ -137,7 +137,7 @@ namespace Server.Engines.Plants
else if ( obj is StaticTarget ) else if ( obj is StaticTarget )
tileID = (((StaticTarget)obj).ItemID & 0x3FFF) | 0x4000; tileID = (((StaticTarget)obj).ItemID & 0x3FFF) | 0x4000;
else if ( obj is LandTarget ) else if ( obj is LandTarget )
tileID = ((LandTarget)obj).TileID & 0x3FFF; tileID = ((LandTarget)obj).TileID;
else else
return false; return false;

View file

@ -285,7 +285,7 @@ namespace Server.Engines.Plants
public int OffsetX { get { return m_OffsetX; } } public int OffsetX { get { return m_OffsetX; } }
public int OffsetY { get { return m_OffsetY; } } public int OffsetY { get { return m_OffsetY; } }
public PlantType PlantType { get { return m_PlantType; } } public PlantType PlantType { get { return m_PlantType; } }
public int Name { get { return 1020000 + m_ItemID; } } public int Name { get { return m_ItemID < 0x4000 ? 1020000 + m_ItemID : 1078872 + m_ItemID; } }
public bool ContainsPlant { get { return m_ContainsPlant; } } public bool ContainsPlant { get { return m_ContainsPlant; } }
public bool Flowery { get { return m_Flowery; } } public bool Flowery { get { return m_Flowery; } }
public bool Crossable { get { return m_Crossable; } } public bool Crossable { get { return m_Crossable; } }

View file

@ -92,7 +92,7 @@ namespace Server.Engines.Quests.Collector
public int Figurine { get { return m_Figurine; } } public int Figurine { get { return m_Figurine; } }
public Type Type { get { return m_Type; } } public Type Type { get { return m_Type; } }
public int Name { get { return 1020000 + m_Figurine; } } public int Name { get { return m_Figurine < 0x4000 ? 1020000 + m_Figurine : 1078872 + m_Figurine; } }
public int X { get { return m_X; } } public int X { get { return m_X; } }
public int Y { get { return m_Y; } } public int Y { get { return m_Y; } }

View file

@ -246,7 +246,7 @@ namespace Server.Gumps
public object FindHouseName( BaseHouse house ) public object FindHouseName( BaseHouse house )
{ {
int multiID = house.ItemID & 0x3FFF; int multiID = house.ItemID;
HousePlacementEntry[] entries; HousePlacementEntry[] entries;
entries = HousePlacementEntry.ClassicHouses; entries = HousePlacementEntry.ClassicHouses;

View file

@ -172,12 +172,12 @@ namespace Server.Items
if ( map == null ) if ( map == null )
return false; return false;
Tile[] tiles = map.Tiles.GetStaticTiles( x, y, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, true );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile t = tiles[i]; StaticTile t = tiles[i];
ItemData id = TileData.ItemTable[t.ID & 0x3FFF]; ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
if ( (id.Flags & TileFlag.Wall) != 0 && (z + 16) > t.Z && (t.Z + t.Height) > z ) if ( (id.Flags & TileFlag.Wall) != 0 && (z + 16) > t.Z && (t.Z + t.Height) > z )
return true; return true;

View file

@ -288,7 +288,7 @@ namespace Server.Items
{ {
Item item = items[i]; Item item = items[i];
if ( item.ItemID < 0x4000 && item.AtWorldPoint( x, y ) && !(item is BaseDoor) ) if ( !(item is BaseMulti) && item.AtWorldPoint( x, y ) && !(item is BaseDoor) )
{ {
ItemData id = item.ItemData; ItemData id = item.ItemData;
bool surface = id.Surface; bool surface = id.Surface;

View file

@ -94,10 +94,10 @@ namespace Server.Items
Point3D loc = new Point3D( p ); Point3D loc = new Point3D( p );
if ( p is StaticTarget ) if ( p is StaticTarget )
loc.Z -= TileData.ItemTable[((StaticTarget)p).ItemID & 0x3FFF].CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here. loc.Z -= TileData.ItemTable[((StaticTarget)p).ItemID].CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call). * A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script. * That functionality may be desired. And so, it's included in this script.
*/ */
if ( ValidatePlacement( from, loc ) ) if ( ValidatePlacement( from, loc ) )
EndPlace( from, (HolidayTreeType) state, loc ); EndPlace( from, (HolidayTreeType) state, loc );

View file

@ -75,9 +75,9 @@ namespace Server.Items
int itemID; int itemID;
if ( targeted is Item ) if ( targeted is Item )
itemID = ((Item)targeted).ItemID & 0x3FFF; itemID = ((Item)targeted).ItemID;
else if ( targeted is StaticTarget ) else if ( targeted is StaticTarget )
itemID = ((StaticTarget)targeted).ItemID & 0x3FFF; itemID = ((StaticTarget)targeted).ItemID;
else else
return false; return false;

View file

@ -164,7 +164,7 @@ namespace Server.Items
else else
to = new Entity( Serial.Zero, new Point3D( p ), Map ); to = new Entity( Serial.Zero, new Point3D( p ), Map );
Effects.SendMovingEffect( from, to, ItemID & 0x3FFF, 7, 0, false, false, Hue, 0 ); Effects.SendMovingEffect( from, to, ItemID, 7, 0, false, false, Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( FirebombReposition_OnTick ), new object[]{ p, Map } ); Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( FirebombReposition_OnTick ), new object[]{ p, Map } );
Internalize(); Internalize();

View file

@ -243,14 +243,14 @@ namespace Server.Items
if ( map == null ) if ( map == null )
return int.MinValue; return int.MinValue;
Tile[] tiles = map.Tiles.GetStaticTiles( item.X, item.Y, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( item.X, item.Y, true );
int z = int.MinValue; int z = int.MinValue;
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
int top = tile.Z; // Confirmed : no height checks here int top = tile.Z; // Confirmed : no height checks here

View file

@ -5,11 +5,10 @@ namespace Server.Items
{ {
public class Static : Item public class Static : Item
{ {
public Static() //Dupe-tastic! public Static() : base( 0x80 )
: base( 0x80 ) {
{ Movable = false;
Movable = false; }
}
[Constructable] [Constructable]
public Static( int itemID ) : base( itemID ) public Static( int itemID ) : base( itemID )
@ -58,7 +57,7 @@ namespace Server.Items
public override int LabelNumber{ get{ return m_LabelNumber; } } public override int LabelNumber{ get{ return m_LabelNumber; } }
[Constructable] [Constructable]
public LocalizedStatic( int itemID ) : this( itemID, 1020000 + itemID ) public LocalizedStatic( int itemID ) : this( itemID, itemID < 0x4000 ? 1020000 + itemID : 1078872 + itemID )
{ {
} }

View file

@ -175,7 +175,7 @@ namespace Server.Items
if ( obj is Item ) if ( obj is Item )
itemID = ((Item)obj).ItemID; itemID = ((Item)obj).ItemID;
else if ( obj is StaticTarget ) else if ( obj is StaticTarget )
itemID = ((StaticTarget)obj).ItemID & 0x3FFF; itemID = ((StaticTarget)obj).ItemID;
return ( itemID == 4017 || (itemID >= 6522 && itemID <= 6569) ); return ( itemID == 4017 || (itemID >= 6522 && itemID <= 6569) );
} }

View file

@ -218,7 +218,7 @@ namespace Server.Items
int tx = p.X - 2 + Utility.Random( 5 ); int tx = p.X - 2 + Utility.Random( 5 );
int ty = p.Y - 2 + Utility.Random( 5 ); int ty = p.Y - 2 + Utility.Random( 5 );
Tile t = map.Tiles.GetLandTile( tx, ty ); LandTile t = map.Tiles.GetLandTile( tx, ty );
if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) ) if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) )
{ {

View file

@ -210,7 +210,7 @@ namespace Server.Items
to = (Mobile)p; to = (Mobile)p;
} }
Effects.SendMovingEffect( from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0 ); Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
if( m_Potion.Amount > 1 ) if( m_Potion.Amount > 1 )
{ {

View file

@ -273,7 +273,7 @@ namespace Server.Items
return; return;
Point3D p3d = new Point3D( p ); Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ m_ItemID & 0x3FFF ]; ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
if ( map.CanFit( p3d, id.Height ) ) if ( map.CanFit( p3d, id.Height ) )
{ {

View file

@ -288,7 +288,7 @@ namespace Server.Items
return; return;
Point3D p3d = new Point3D( p ); Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ m_ItemID & 0x3FFF ]; ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
if ( map.CanFit( p3d, id.Height ) ) if ( map.CanFit( p3d, id.Height ) )
{ {

View file

@ -277,7 +277,7 @@ namespace Server.Items
return; return;
Point3D p3d = new Point3D( p ); Point3D p3d = new Point3D( p );
ItemData id = TileData.ItemTable[ m_ItemID & 0x3FFF ]; ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];
if ( map.CanFit( p3d, id.Height ) ) if ( map.CanFit( p3d, id.Height ) )
{ {

View file

@ -392,8 +392,6 @@ namespace Server
public static bool IsFrame( int id, int[] list ) public static bool IsFrame( int id, int[] list )
{ {
id &= 0x3FFF;
if ( id > list[list.Length - 1] ) if ( id > list[list.Length - 1] )
return false; return false;
@ -432,11 +430,11 @@ namespace Server
public static bool IsEastFrame( int x, int y, int z ) public static bool IsEastFrame( int x, int y, int z )
{ {
Tile[] tiles = m_Map.Tiles.GetStaticTiles( x, y ); StaticTile[] tiles = m_Map.Tiles.GetStaticTiles( x, y );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
if ( tile.Z == z && IsEastFrame( tile.ID ) ) if ( tile.Z == z && IsEastFrame( tile.ID ) )
return true; return true;
@ -447,11 +445,11 @@ namespace Server
public static bool IsSouthFrame( int x, int y, int z ) public static bool IsSouthFrame( int x, int y, int z )
{ {
Tile[] tiles = m_Map.Tiles.GetStaticTiles( x, y ); StaticTile[] tiles = m_Map.Tiles.GetStaticTiles( x, y );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
if ( tile.Z == z && IsSouthFrame( tile.ID ) ) if ( tile.Z == z && IsSouthFrame( tile.ID ) )
return true; return true;
@ -497,11 +495,11 @@ namespace Server
int vx = rx + region.X; int vx = rx + region.X;
int vy = ry + region.Y; int vy = ry + region.Y;
Tile[] tiles = m_Map.Tiles.GetStaticTiles( vx, vy ); StaticTile[] tiles = m_Map.Tiles.GetStaticTiles( vx, vy );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
int id = tile.ID; int id = tile.ID;
int z = tile.Z; int z = tile.Z;

View file

@ -49,7 +49,7 @@ namespace Server
private static bool GetFloorZ( Map map, int x, int y, out int z ) private static bool GetFloorZ( Map map, int x, int y, out int z )
{ {
Tile lt = map.Tiles.GetLandTile( x, y ); LandTile lt = map.Tiles.GetLandTile( x, y );
if ( IsFloor( lt.ID ) && map.CanFit( x, y, lt.Z, 16, false, false ) ) if ( IsFloor( lt.ID ) && map.CanFit( x, y, lt.Z, 16, false, false ) )
{ {
@ -57,12 +57,12 @@ namespace Server
return true; return true;
} }
Tile[] tiles = map.Tiles.GetStaticTiles( x, y ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile t = tiles[i]; StaticTile t = tiles[i];
ItemData id = TileData.ItemTable[t.ID & 0x3FFF]; ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
if ( IsStaticFloor( t.ID ) && map.CanFit( x, y, t.Z + (id.Surface ? id.CalcHeight : 0), 16, false, false ) ) if ( IsStaticFloor( t.ID ) && map.CanFit( x, y, t.Z + (id.Surface ? id.CalcHeight : 0), 16, false, false ) )
{ {
@ -77,17 +77,17 @@ namespace Server
private static bool IsFloor( Map map, int x, int y, bool canFit ) private static bool IsFloor( Map map, int x, int y, bool canFit )
{ {
Tile lt = map.Tiles.GetLandTile( x, y ); LandTile lt = map.Tiles.GetLandTile( x, y );
if ( IsFloor( lt.ID ) && (canFit||CanFit( map, x, y, lt.Z )) ) if ( IsFloor( lt.ID ) && (canFit||CanFit( map, x, y, lt.Z )) )
return true; return true;
Tile[] tiles = map.Tiles.GetStaticTiles( x, y ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile t = tiles[i]; StaticTile t = tiles[i];
ItemData id = TileData.ItemTable[t.ID & 0x3FFF]; ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
if ( IsStaticFloor( t.ID ) && (canFit||CanFit( map, x, y, t.Z + (id.Surface ? id.CalcHeight : 0) )) ) if ( IsStaticFloor( t.ID ) && (canFit||CanFit( map, x, y, t.Z + (id.Surface ? id.CalcHeight : 0) )) )
return true; return true;
@ -98,23 +98,19 @@ namespace Server
private static bool IsFloor( int itemID ) private static bool IsFloor( int itemID )
{ {
itemID &= 0x3FFF; itemID &= TileData.MaxLandValue;
return ( itemID >= 0x406 && itemID <= 0x51A ); return ( itemID >= 0x406 && itemID <= 0x51A );
} }
private static bool IsStaticFloor( int itemID ) private static bool IsStaticFloor( int itemID )
{ {
itemID &= 0x3FFF;
return ( itemID >= 0x495 && itemID <= 0x514 ) return ( itemID >= 0x495 && itemID <= 0x514 )
|| ( itemID >= 0x519 && itemID <= 0x53A ); || ( itemID >= 0x519 && itemID <= 0x53A );
} }
private static bool IsDisplayCase( int itemID ) private static bool IsDisplayCase( int itemID )
{ {
itemID &= 0x3FFF;
return ( itemID >= 0xB00 && itemID <= 0xB02 ) return ( itemID >= 0xB00 && itemID <= 0xB02 )
|| ( itemID >= 0xB06 && itemID <= 0xB0A ) || ( itemID >= 0xB06 && itemID <= 0xB0A )
|| ( itemID >= 0xB0D && itemID <= 0xB17 ); || ( itemID >= 0xB0D && itemID <= 0xB17 );
@ -261,7 +257,7 @@ namespace Server
private static void CheckFloor( Map map, int x, int y ) private static void CheckFloor( Map map, int x, int y )
{ {
Tile[] tiles = map.Tiles.GetStaticTiles( x, y ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
@ -371,7 +367,7 @@ namespace Server
private static ShopFlags ProcessDisplayedItem( int itemID ) private static ShopFlags ProcessDisplayedItem( int itemID )
{ {
itemID &= 0x3FFF; itemID &= TileData.MaxItemValue;
ShopFlags res = ShopFlags.None; ShopFlags res = ShopFlags.None;
@ -411,7 +407,7 @@ namespace Server
return res; return res;
} }
private static void ProcessDisplayCase( Map map, Tile[] tiles, int x, int y ) private static void ProcessDisplayCase( Map map, StaticTile[] tiles, int x, int y )
{ {
ShopFlags flags = ShopFlags.None; ShopFlags flags = ShopFlags.None;
@ -460,18 +456,18 @@ namespace Server
{ {
bool hasSurface = false; bool hasSurface = false;
Tile lt = map.Tiles.GetLandTile( x, y ); LandTile lt = map.Tiles.GetLandTile( x, y );
int lowZ = 0, avgZ = 0, topZ = 0; int lowZ = 0, avgZ = 0, topZ = 0;
map.GetAverageZ( x, y, ref lowZ, ref avgZ, ref topZ ); map.GetAverageZ( x, y, ref lowZ, ref avgZ, ref topZ );
TileFlag landFlags = TileData.LandTable[lt.ID & 0x3FFF].Flags; TileFlag landFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
if ( (landFlags & TileFlag.Impassable) != 0 && topZ > z && (z + 16) > lowZ ) if ( (landFlags & TileFlag.Impassable) != 0 && topZ > z && (z + 16) > lowZ )
return false; return false;
else if ( (landFlags & TileFlag.Impassable) == 0 && z == avgZ && !lt.Ignored ) else if ( (landFlags & TileFlag.Impassable) == 0 && z == avgZ && !lt.Ignored )
hasSurface = true; hasSurface = true;
Tile[] staticTiles = map.Tiles.GetStaticTiles( x, y ); StaticTile[] staticTiles = map.Tiles.GetStaticTiles( x, y );
bool surface, impassable; bool surface, impassable;
@ -480,7 +476,7 @@ namespace Server
if ( IsDisplayCase( staticTiles[i].ID ) ) if ( IsDisplayCase( staticTiles[i].ID ) )
continue; continue;
ItemData id = TileData.ItemTable[staticTiles[i].ID & 0x3FFF]; ItemData id = TileData.ItemTable[staticTiles[i].ID & TileData.MaxItemValue];
surface = id.Surface; surface = id.Surface;
impassable = id.Impassable; impassable = id.Impassable;

View file

@ -256,7 +256,7 @@ namespace Server.Mobiles
m_Args = args; m_Args = args;
if ( name == null ) if ( name == null )
m_Name = (1020000 + (itemID & 0x3FFF)).ToString(); m_Name = itemID < 0x4000 ? (1020000 + itemID).ToString() : (1078872 + itemID).ToString();
else else
m_Name = name; m_Name = name;
} }

View file

@ -1052,12 +1052,12 @@ namespace Server.Multis
if ( this is HouseFoundation && y < (mcl.Height-1) && p.Z >= this.Z ) if ( this is HouseFoundation && y < (mcl.Height-1) && p.Z >= this.Z )
return true; return true;
Tile[] tiles = mcl.Tiles[x][y]; StaticTile[] tiles = mcl.Tiles[x][y];
for ( int j = 0; j < tiles.Length; ++j ) for ( int j = 0; j < tiles.Length; ++j )
{ {
Tile tile = tiles[j]; StaticTile tile = tiles[j];
int id = tile.ID & 0x3FFF; int id = tile.ID & TileData.MaxItemValue;
ItemData data = TileData.ItemTable[id]; ItemData data = TileData.ItemTable[id];
// Slanted roofs do not count; they overhang blocking south and east sides of the multi // Slanted roofs do not count; they overhang blocking south and east sides of the multi
@ -1095,7 +1095,7 @@ namespace Server.Multis
private static List<BaseHouse> m_AllHouses = new List<BaseHouse>(); private static List<BaseHouse> m_AllHouses = new List<BaseHouse>();
public BaseHouse( int multiID, Mobile owner, int MaxLockDown, int MaxSecure ) : base( multiID | 0x4000 ) public BaseHouse( int multiID, Mobile owner, int MaxLockDown, int MaxSecure ) : base( multiID )
{ {
m_AllHouses.Add( this ); m_AllHouses.Add( this );

View file

@ -149,7 +149,7 @@ namespace Server.Multis
public static List<BaseBoat> Boats{ get{ return m_Instances; } } public static List<BaseBoat> Boats{ get{ return m_Instances; } }
public BaseBoat() : base( 0x4000 ) public BaseBoat() : base( 0x0 )
{ {
m_DecayTime = DateTime.Now + BoatDecayDelay; m_DecayTime = DateTime.Now + BoatDecayDelay;
@ -1184,8 +1184,8 @@ namespace Server.Multis
if ( newComponents.Tiles[x][y].Length == 0 || Contains( tx, ty ) ) if ( newComponents.Tiles[x][y].Length == 0 || Contains( tx, ty ) )
continue; continue;
Tile landTile = map.Tiles.GetLandTile( tx, ty ); LandTile landTile = map.Tiles.GetLandTile( tx, ty );
Tile[] tiles = map.Tiles.GetStaticTiles( tx, ty, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( tx, ty, true );
bool hasWater = false; bool hasWater = false;
@ -1203,8 +1203,8 @@ namespace Server.Multis
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
bool isWater = ( tile.ID >= 0x5796 && tile.ID <= 0x57B2 ); bool isWater = ( tile.ID >= 0x1796 && tile.ID <= 0x17B2 );
if ( tile.Z == p.Z && isWater ) if ( tile.Z == p.Z && isWater )
hasWater = true; hasWater = true;
@ -1221,7 +1221,7 @@ namespace Server.Multis
foreach ( Item item in eable ) foreach ( Item item in eable )
{ {
if ( item.ItemID >= 0x4000 || item.Z < p.Z || !item.Visible ) if ( item is BaseMulti || item.Z < p.Z || !item.Visible )
continue; continue;
int x = item.X - p.X + newComponents.Min.X; int x = item.X - p.X + newComponents.Min.X;

View file

@ -25,7 +25,7 @@ namespace Server.Multis
if ( !Core.AOS ) if ( !Core.AOS )
LootType = LootType.Newbied; LootType = LootType.Newbied;
m_MultiID = id & 0x3FFF; m_MultiID = id;
m_Offset = offset; m_Offset = offset;
} }

View file

@ -26,7 +26,7 @@ namespace Server.Multis
Weight = 1.0; Weight = 1.0;
LootType = LootType.Blessed; LootType = LootType.Blessed;
m_MultiID = id & 0x3FFF; m_MultiID = id;
m_Offset = offset; m_Offset = offset;
m_ShipName = boat.ShipName; m_ShipName = boat.ShipName;

View file

@ -6,10 +6,10 @@ namespace Server.Multis
{ {
public class LargeBoat : BaseBoat public class LargeBoat : BaseBoat
{ {
public override int NorthID{ get{ return 0x4010; } } public override int NorthID{ get{ return 0x10; } }
public override int EastID{ get{ return 0x4011; } } public override int EastID{ get{ return 0x11; } }
public override int SouthID{ get{ return 0x4012; } } public override int SouthID{ get{ return 0x12; } }
public override int WestID{ get{ return 0x4013; } } public override int WestID{ get{ return 0x13; } }
public override int HoldDistance{ get{ return 5; } } public override int HoldDistance{ get{ return 5; } }
public override int TillerManDistance{ get{ return -5; } } public override int TillerManDistance{ get{ return -5; } }
@ -51,7 +51,7 @@ namespace Server.Multis
public override BaseBoat Boat{ get{ return new LargeBoat(); } } public override BaseBoat Boat{ get{ return new LargeBoat(); } }
[Constructable] [Constructable]
public LargeBoatDeed() : base( 0x4010, new Point3D( 0, -1, 0 ) ) public LargeBoatDeed() : base( 0x10, new Point3D( 0, -1, 0 ) )
{ {
} }
@ -78,7 +78,7 @@ namespace Server.Multis
{ {
public override BaseBoat Boat{ get{ return new LargeBoat(); } } public override BaseBoat Boat{ get{ return new LargeBoat(); } }
public LargeDockedBoat( BaseBoat boat ) : base( 0x4010, new Point3D( 0, -1, 0 ), boat ) public LargeDockedBoat( BaseBoat boat ) : base( 0x10, new Point3D( 0, -1, 0 ), boat )
{ {
} }

View file

@ -6,10 +6,10 @@ namespace Server.Multis
{ {
public class LargeDragonBoat : BaseBoat public class LargeDragonBoat : BaseBoat
{ {
public override int NorthID{ get{ return 0x4014; } } public override int NorthID{ get{ return 0x14; } }
public override int EastID{ get{ return 0x4015; } } public override int EastID{ get{ return 0x15; } }
public override int SouthID{ get{ return 0x4016; } } public override int SouthID{ get{ return 0x16; } }
public override int WestID{ get{ return 0x4017; } } public override int WestID{ get{ return 0x17; } }
public override int HoldDistance{ get{ return 5; } } public override int HoldDistance{ get{ return 5; } }
public override int TillerManDistance{ get{ return -5; } } public override int TillerManDistance{ get{ return -5; } }
@ -51,7 +51,7 @@ namespace Server.Multis
public override BaseBoat Boat{ get{ return new LargeDragonBoat(); } } public override BaseBoat Boat{ get{ return new LargeDragonBoat(); } }
[Constructable] [Constructable]
public LargeDragonBoatDeed() : base( 0x4014, new Point3D( 0, -1, 0 ) ) public LargeDragonBoatDeed() : base( 0x14, new Point3D( 0, -1, 0 ) )
{ {
} }
@ -78,7 +78,7 @@ namespace Server.Multis
{ {
public override BaseBoat Boat{ get{ return new LargeDragonBoat(); } } public override BaseBoat Boat{ get{ return new LargeDragonBoat(); } }
public LargeDockedDragonBoat( BaseBoat boat ) : base( 0x4014, new Point3D( 0, -1, 0 ), boat ) public LargeDockedDragonBoat( BaseBoat boat ) : base( 0x14, new Point3D( 0, -1, 0 ), boat )
{ {
} }

View file

@ -6,10 +6,10 @@ namespace Server.Multis
{ {
public class MediumBoat : BaseBoat public class MediumBoat : BaseBoat
{ {
public override int NorthID{ get{ return 0x4008; } } public override int NorthID{ get{ return 0x8; } }
public override int EastID{ get{ return 0x4009; } } public override int EastID{ get{ return 0x9; } }
public override int SouthID{ get{ return 0x400A; } } public override int SouthID{ get{ return 0xA; } }
public override int WestID{ get{ return 0x400B; } } public override int WestID{ get{ return 0xB; } }
public override int HoldDistance{ get{ return 4; } } public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -5; } } public override int TillerManDistance{ get{ return -5; } }
@ -51,7 +51,7 @@ namespace Server.Multis
public override BaseBoat Boat{ get{ return new MediumBoat(); } } public override BaseBoat Boat{ get{ return new MediumBoat(); } }
[Constructable] [Constructable]
public MediumBoatDeed() : base( 0x4008, Point3D.Zero ) public MediumBoatDeed() : base( 0x8, Point3D.Zero )
{ {
} }
@ -78,7 +78,7 @@ namespace Server.Multis
{ {
public override BaseBoat Boat{ get{ return new MediumBoat(); } } public override BaseBoat Boat{ get{ return new MediumBoat(); } }
public MediumDockedBoat( BaseBoat boat ) : base( 0x4008, Point3D.Zero, boat ) public MediumDockedBoat( BaseBoat boat ) : base( 0x8, Point3D.Zero, boat )
{ {
} }

View file

@ -6,10 +6,10 @@ namespace Server.Multis
{ {
public class MediumDragonBoat : BaseBoat public class MediumDragonBoat : BaseBoat
{ {
public override int NorthID{ get{ return 0x400C; } } public override int NorthID{ get{ return 0xC; } }
public override int EastID{ get{ return 0x400D; } } public override int EastID{ get{ return 0xD; } }
public override int SouthID{ get{ return 0x400E; } } public override int SouthID{ get{ return 0xE; } }
public override int WestID{ get{ return 0x400F; } } public override int WestID{ get{ return 0xF; } }
public override int HoldDistance{ get{ return 4; } } public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -5; } } public override int TillerManDistance{ get{ return -5; } }
@ -51,7 +51,7 @@ namespace Server.Multis
public override BaseBoat Boat{ get{ return new MediumDragonBoat(); } } public override BaseBoat Boat{ get{ return new MediumDragonBoat(); } }
[Constructable] [Constructable]
public MediumDragonBoatDeed() : base( 0x400C, Point3D.Zero ) public MediumDragonBoatDeed() : base( 0xC, Point3D.Zero )
{ {
} }
@ -78,7 +78,7 @@ namespace Server.Multis
{ {
public override BaseBoat Boat{ get{ return new MediumDragonBoat(); } } public override BaseBoat Boat{ get{ return new MediumDragonBoat(); } }
public MediumDockedDragonBoat( BaseBoat boat ) : base( 0x400C, Point3D.Zero, boat ) public MediumDockedDragonBoat( BaseBoat boat ) : base( 0xC, Point3D.Zero, boat )
{ {
} }

View file

@ -6,10 +6,10 @@ namespace Server.Multis
{ {
public class SmallBoat : BaseBoat public class SmallBoat : BaseBoat
{ {
public override int NorthID{ get{ return 0x4000; } } public override int NorthID{ get{ return 0x0; } }
public override int EastID{ get{ return 0x4001; } } public override int EastID{ get{ return 0x1; } }
public override int SouthID{ get{ return 0x4002; } } public override int SouthID{ get{ return 0x2; } }
public override int WestID{ get{ return 0x4003; } } public override int WestID{ get{ return 0x3; } }
public override int HoldDistance{ get{ return 4; } } public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -4; } } public override int TillerManDistance{ get{ return -4; } }
@ -51,7 +51,7 @@ namespace Server.Multis
public override BaseBoat Boat{ get{ return new SmallBoat(); } } public override BaseBoat Boat{ get{ return new SmallBoat(); } }
[Constructable] [Constructable]
public SmallBoatDeed() : base( 0x4000, Point3D.Zero ) public SmallBoatDeed() : base( 0x0, Point3D.Zero )
{ {
} }
@ -78,7 +78,7 @@ namespace Server.Multis
{ {
public override BaseBoat Boat{ get{ return new SmallBoat(); } } public override BaseBoat Boat{ get{ return new SmallBoat(); } }
public SmallDockedBoat( BaseBoat boat ) : base( 0x4000, Point3D.Zero, boat ) public SmallDockedBoat( BaseBoat boat ) : base( 0x0, Point3D.Zero, boat )
{ {
} }

View file

@ -6,10 +6,10 @@ namespace Server.Multis
{ {
public class SmallDragonBoat : BaseBoat public class SmallDragonBoat : BaseBoat
{ {
public override int NorthID{ get{ return 0x4004; } } public override int NorthID{ get{ return 0x4; } }
public override int EastID{ get{ return 0x4005; } } public override int EastID{ get{ return 0x5; } }
public override int SouthID{ get{ return 0x4006; } } public override int SouthID{ get{ return 0x6; } }
public override int WestID{ get{ return 0x4007; } } public override int WestID{ get{ return 0x7; } }
public override int HoldDistance{ get{ return 4; } } public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -4; } } public override int TillerManDistance{ get{ return -4; } }
@ -51,7 +51,7 @@ namespace Server.Multis
public override BaseBoat Boat{ get{ return new SmallDragonBoat(); } } public override BaseBoat Boat{ get{ return new SmallDragonBoat(); } }
[Constructable] [Constructable]
public SmallDragonBoatDeed() : base( 0x4004, Point3D.Zero ) public SmallDragonBoatDeed() : base( 0x4, Point3D.Zero )
{ {
} }
@ -78,7 +78,7 @@ namespace Server.Multis
{ {
public override BaseBoat Boat{ get{ return new SmallDragonBoat(); } } public override BaseBoat Boat{ get{ return new SmallDragonBoat(); } }
public SmallDockedDragonBoat( BaseBoat boat ) : base( 0x4004, Point3D.Zero, boat ) public SmallDockedDragonBoat( BaseBoat boat ) : base( 0x4, Point3D.Zero, boat )
{ {
} }

View file

@ -103,13 +103,15 @@ namespace Server.Misc
object surface = map.GetTopSurface( from.Location ); object surface = map.GetTopSurface( from.Location );
if ( surface is Tile ) if ( surface is LandTile ) {
{ int id = ((LandTile)surface).ID;
int id = ((Tile)surface).ID;
return (id >= 168 && id <= 171) return (id >= 168 && id <= 171)
|| (id >= 310 && id <= 311) || (id >= 310 && id <= 311);
|| (id >= 0x5796 && id <= 0x57B2); } else if ( surface is StaticTile ) {
int id = ((StaticTile)surface).ID;
return (id >= 0x1796 && id <= 0x17B2);
} }
return false; return false;

View file

@ -30,7 +30,7 @@ namespace Server.Multis
} }
} }
public BaseCamp( int multiID ) : base( multiID | 0x4000 ) public BaseCamp( int multiID ) : base( multiID )
{ {
m_Items = new List<Item>(); m_Items = new List<Item>();
m_Mobiles = new List<Mobile>(); m_Mobiles = new List<Mobile>();
@ -40,16 +40,6 @@ namespace Server.Multis
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( CheckAddComponents ) ); Timer.DelayCall( TimeSpan.Zero, new TimerCallback( CheckAddComponents ) );
} }
public BaseCamp( int multiID, int mode ) : base( multiID | 0x4000*mode )
{
m_Items = new List<Item>();
m_Mobiles = new List<Mobile>();
m_DecayDelay = TimeSpan.FromMinutes(30.0);
RefreshDecay(true);
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( CheckAddComponents ) );
}
public void CheckAddComponents() public void CheckAddComponents()
{ {
if ( Deleted ) if ( Deleted )

View file

@ -12,7 +12,7 @@ namespace Server.Multis
private Mobile m_Prisoner; private Mobile m_Prisoner;
[Constructable] [Constructable]
public BrigandCamp() : base( 0x10ee, 0 ) // dummy garbage at center public BrigandCamp() : base( 0x10EE ) // dummy garbage at center
{ {
} }

View file

@ -11,7 +11,7 @@ namespace Server.Multis
private Mobile m_Prisoner; private Mobile m_Prisoner;
[Constructable] [Constructable]
public LizardmenCamp() : base( 0x10ee , 0 ) // dummy garbage at center public LizardmenCamp() : base( 0x10EE ) // dummy garbage at center
{ {
} }

View file

@ -11,7 +11,7 @@ namespace Server.Multis
private Mobile m_Prisoner; private Mobile m_Prisoner;
[Constructable] [Constructable]
public OrcCamp() : base( 0x10ee, 0 ) // dummy garbage at center public OrcCamp() : base( 0x10EE ) // dummy garbage at center
{ {
} }

View file

@ -11,7 +11,7 @@ namespace Server.Multis
private Mobile m_Prisoner; private Mobile m_Prisoner;
[Constructable] [Constructable]
public RatCamp() : base( 0x10ee, 0 ) // dummy garbage at center public RatCamp() : base( 0x10EE ) // dummy garbage at center
{ {
} }

View file

@ -75,7 +75,7 @@ namespace Server.Multis.Deeds
Weight = 1.0; Weight = 1.0;
LootType = LootType.Newbied; LootType = LootType.Newbied;
m_MultiID = id & 0x3FFF; m_MultiID = id;
m_Offset = offset; m_Offset = offset;
} }

View file

@ -553,11 +553,11 @@ namespace Server.Multis
if( x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height ) if( x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height )
{ {
Tile[] tiles = mcl.Tiles[x][y]; StaticTile[] tiles = mcl.Tiles[x][y];
for( int i = 0; i < tiles.Length; ++i ) for( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
if( tile.Z == 7 && tile.Height == 20 ) if( tile.Z == 7 && tile.Height == 20 )
return true; return true;
@ -1061,11 +1061,11 @@ namespace Server.Multis
public static bool ValidPiece( int itemID, bool roof ) public static bool ValidPiece( int itemID, bool roof )
{ {
itemID &= 0x3FFF; itemID &= TileData.MaxItemValue;
if ( !roof && ( TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.Roof ) != 0 ) if ( !roof && ( TileData.ItemTable[itemID].Flags & TileFlag.Roof ) != 0 )
return false; return false;
else if ( roof && ( TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.Roof ) == 0 ) else if ( roof && ( TileData.ItemTable[itemID].Flags & TileFlag.Roof ) == 0 )
return false; return false;
return Verification.IsItemValid( itemID ); return Verification.IsItemValid( itemID );
@ -1141,11 +1141,11 @@ namespace Server.Multis
if( IsStairBlock( id ) ) if( IsStairBlock( id ) )
{ {
Tile[] tiles = mcl.Tiles[ax][ay]; StaticTile[] tiles = mcl.Tiles[ax][ay];
for( int i = 0; i < tiles.Length; ++i ) for( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
if( tile.Z == (z + 5) ) if( tile.Z == (z + 5) )
{ {
@ -1220,12 +1220,12 @@ namespace Server.Multis
if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 ) if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 )
{ {
Tile[] tiles = mcl.Tiles[ax][ay]; StaticTile[] tiles = mcl.Tiles[ax][ay];
bool hasBaseFloor = false; bool hasBaseFloor = false;
for( int j = 0; !hasBaseFloor && j < tiles.Length; ++j ) for( int j = 0; !hasBaseFloor && j < tiles.Length; ++j )
hasBaseFloor = (tiles[j].Z == 7 && (tiles[j].ID & 0x3FFF) != 1); hasBaseFloor = (tiles[j].Z == 7 && tiles[j].ID != 1);
if( !hasBaseFloor ) if( !hasBaseFloor )
mcl.Add( 0x31F4, x, y, 7 ); mcl.Add( 0x31F4, x, y, 7 );
@ -1284,12 +1284,12 @@ namespace Server.Multis
// If needed, replace removed component with a dirt tile // If needed, replace removed component with a dirt tile
if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 ) if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 )
{ {
Tile[] tiles = mcl.Tiles[ax][ay]; StaticTile[] tiles = mcl.Tiles[ax][ay];
bool hasBaseFloor = false; bool hasBaseFloor = false;
for( int i = 0; !hasBaseFloor && i < tiles.Length; ++i ) for( int i = 0; !hasBaseFloor && i < tiles.Length; ++i )
hasBaseFloor = (tiles[i].Z == 7 && (tiles[i].ID & 0x3FFF) != 1); hasBaseFloor = (tiles[i].Z == 7 && tiles[i].ID != 1);
if( !hasBaseFloor ) if( !hasBaseFloor )
{ {
@ -1641,7 +1641,7 @@ namespace Server.Multis
{ {
MultiTileEntry mte = list[i]; MultiTileEntry mte = list[i];
if( mte.m_OffsetX == x && mte.m_OffsetY == y && GetZLevel( mte.m_OffsetZ, context.Foundation ) == context.Level && (TileData.ItemTable[mte.m_ItemID & 0x3FFF].Flags & TileFlag.Roof) != 0 ) if( mte.m_OffsetX == x && mte.m_OffsetY == y && GetZLevel( mte.m_OffsetZ, context.Foundation ) == context.Level && (TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Flags & TileFlag.Roof) != 0 )
mcl.Remove( mte.m_ItemID, x, y, mte.m_OffsetZ ); mcl.Remove( mte.m_ItemID, x, y, mte.m_OffsetZ );
} }
@ -1669,7 +1669,7 @@ namespace Server.Multis
DesignState design = context.Foundation.DesignState; DesignState design = context.Foundation.DesignState;
MultiComponentList mcl = design.Components; MultiComponentList mcl = design.Components;
if( (TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.Roof) == 0 ) if( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.Roof) == 0 )
{ {
design.SendDetailedInfoTo( state ); design.SendDetailedInfoTo( state );
return; return;
@ -1748,7 +1748,7 @@ namespace Server.Multis
for( int i = 0; i < length; ++i ) for( int i = 0; i < length; ++i )
{ {
m_Fixtures[i].m_ItemID = reader.ReadShort(); m_Fixtures[i].m_ItemID = reader.ReadUShort();
m_Fixtures[i].m_OffsetX = reader.ReadShort(); m_Fixtures[i].m_OffsetX = reader.ReadShort();
m_Fixtures[i].m_OffsetY = reader.ReadShort(); m_Fixtures[i].m_OffsetY = reader.ReadShort();
m_Fixtures[i].m_OffsetZ = reader.ReadShort(); m_Fixtures[i].m_OffsetZ = reader.ReadShort();
@ -1774,7 +1774,7 @@ namespace Server.Multis
{ {
MultiTileEntry ent = m_Fixtures[i]; MultiTileEntry ent = m_Fixtures[i];
writer.Write( (short)ent.m_ItemID ); writer.Write( (ushort)ent.m_ItemID );
writer.Write( (short)ent.m_OffsetX ); writer.Write( (short)ent.m_OffsetX );
writer.Write( (short)ent.m_OffsetY ); writer.Write( (short)ent.m_OffsetY );
writer.Write( (short)ent.m_OffsetZ ); writer.Write( (short)ent.m_OffsetZ );
@ -2229,7 +2229,7 @@ namespace Server.Multis
int x = mte.m_OffsetX - xMin; int x = mte.m_OffsetX - xMin;
int y = mte.m_OffsetY - yMin; int y = mte.m_OffsetY - yMin;
int z = mte.m_OffsetZ; int z = mte.m_OffsetZ;
bool floor = (TileData.ItemTable[mte.m_ItemID & 0x3FFF].Height <= 0); bool floor = (TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Height <= 0);
int plane, size; int plane, size;
switch( z ) switch( z )

View file

@ -97,7 +97,7 @@ namespace Server.Multis
int tileX = start.X + x; int tileX = start.X + x;
int tileY = start.Y + y; int tileY = start.Y + y;
Tile[] addTiles = mcl.Tiles[x][y]; StaticTile[] addTiles = mcl.Tiles[x][y];
if ( addTiles.Length == 0 ) if ( addTiles.Length == 0 )
continue; // There are no tiles here, continue checking somewhere else continue; // There are no tiles here, continue checking somewhere else
@ -117,10 +117,10 @@ namespace Server.Multis
return HousePlacementResult.BadRegion; return HousePlacementResult.BadRegion;
} }
Tile landTile = map.Tiles.GetLandTile( tileX, tileY ); LandTile landTile = map.Tiles.GetLandTile( tileX, tileY );
int landID = landTile.ID & 0x3FFF; int landID = landTile.ID & TileData.MaxLandValue;
Tile[] oldTiles = map.Tiles.GetStaticTiles( tileX, tileY, true ); StaticTile[] oldTiles = map.Tiles.GetStaticTiles( tileX, tileY, true );
Sector sector = map.GetSector( tileX, tileY ); Sector sector = map.GetSector( tileX, tileY );
@ -152,12 +152,12 @@ namespace Server.Multis
for ( int i = 0; i < addTiles.Length; ++i ) for ( int i = 0; i < addTiles.Length; ++i )
{ {
Tile addTile = addTiles[i]; StaticTile addTile = addTiles[i];
if ( addTile.ID == 0x4001 ) // Nodraw if ( addTile.ID == 0x1 ) // Nodraw
continue; continue;
TileFlag addTileFlags = TileData.ItemTable[addTile.ID & 0x3FFF].Flags; TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
bool isFoundation = ( addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0 ); bool isFoundation = ( addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0 );
bool hasSurface = false; bool hasSurface = false;
@ -174,13 +174,13 @@ namespace Server.Multis
if ( addTileTop > landStartZ && landAvgZ > addTileZ ) if ( addTileTop > landStartZ && landAvgZ > addTileZ )
return HousePlacementResult.BadLand; // Broke rule #2 return HousePlacementResult.BadLand; // Broke rule #2
if ( isFoundation && ((TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Impassable) == 0) && landAvgZ == center.Z ) if ( isFoundation && ((TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) == 0) && landAvgZ == center.Z )
hasSurface = true; hasSurface = true;
for ( int j = 0; j < oldTiles.Length; ++j ) for ( int j = 0; j < oldTiles.Length; ++j )
{ {
Tile oldTile = oldTiles[j]; StaticTile oldTile = oldTiles[j];
ItemData id = TileData.ItemTable[oldTile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[oldTile.ID & TileData.MaxItemValue];
if ( (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0)) && addTileTop > oldTile.Z && (oldTile.Z + id.CalcHeight) > addTileZ ) if ( (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0)) && addTileTop > oldTile.Z && (oldTile.Z + id.CalcHeight) > addTileZ )
return HousePlacementResult.BadStatic; // Broke rule #2 return HousePlacementResult.BadStatic; // Broke rule #2
@ -251,14 +251,14 @@ namespace Server.Multis
if ( vx >= 0 && vx < mcl.Width && vy >= 0 && vy < mcl.Height ) if ( vx >= 0 && vx < mcl.Width && vy >= 0 && vy < mcl.Height )
{ {
Tile[] breakTiles = mcl.Tiles[vx][vy]; StaticTile[] breakTiles = mcl.Tiles[vx][vy];
bool shouldBreak = false; bool shouldBreak = false;
for ( int i = 0; !shouldBreak && i < breakTiles.Length; ++i ) for ( int i = 0; !shouldBreak && i < breakTiles.Length; ++i )
{ {
Tile breakTile = breakTiles[i]; StaticTile breakTile = breakTiles[i];
if ( breakTile.Height == 0 && breakTile.Z <= 8 && TileData.ItemTable[breakTile.ID & 0x3FFF].Surface ) if ( breakTile.Height == 0 && breakTile.Z <= 8 && TileData.ItemTable[breakTile.ID & TileData.MaxItemValue].Surface )
shouldBreak = true; shouldBreak = true;
} }
@ -280,8 +280,8 @@ namespace Server.Multis
{ {
Point2D borderPoint = borders[i]; Point2D borderPoint = borders[i];
Tile landTile = map.Tiles.GetLandTile( borderPoint.X, borderPoint.Y ); LandTile landTile = map.Tiles.GetLandTile( borderPoint.X, borderPoint.Y );
int landID = landTile.ID & 0x3FFF; int landID = landTile.ID & TileData.MaxLandValue;
if ( (TileData.LandTable[landID].Flags & TileFlag.Impassable) != 0 ) if ( (TileData.LandTable[landID].Flags & TileFlag.Impassable) != 0 )
return HousePlacementResult.BadLand; return HousePlacementResult.BadLand;
@ -292,12 +292,12 @@ namespace Server.Multis
return HousePlacementResult.BadLand; // Broke rule #5 return HousePlacementResult.BadLand; // Broke rule #5
} }
Tile[] tiles = map.Tiles.GetStaticTiles( borderPoint.X, borderPoint.Y, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( borderPoint.X, borderPoint.Y, true );
for ( int j = 0; j < tiles.Length; ++j ) for ( int j = 0; j < tiles.Length; ++j )
{ {
Tile tile = tiles[j]; StaticTile tile = tiles[j];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
if ( id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 && (tile.Z + id.CalcHeight) > (center.Z + 2)) ) if ( id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 && (tile.Z + id.CalcHeight) > (center.Z + 2)) )
return HousePlacementResult.BadStatic; // Broke rule #1 return HousePlacementResult.BadStatic; // Broke rule #1
@ -353,11 +353,11 @@ namespace Server.Multis
IPooledEnumerable eable = map.GetMultiTilesAt( yardPoint.X, yardPoint.Y ); IPooledEnumerable eable = map.GetMultiTilesAt( yardPoint.X, yardPoint.Y );
foreach ( Tile[] tile in eable ) foreach ( StaticTile[] tile in eable )
{ {
for ( int j = 0; j < tile.Length; ++j ) for ( int j = 0; j < tile.Length; ++j )
{ {
if ( (TileData.ItemTable[tile[j].ID & 0x3FFF].Flags & (TileFlag.Impassable | TileFlag.Surface)) != 0 ) if ( (TileData.ItemTable[tile[j].ID & TileData.MaxItemValue].Flags & (TileFlag.Impassable | TileFlag.Surface)) != 0 )
{ {
eable.Free(); eable.Free();
return HousePlacementResult.BadStatic; // Broke rule #3 return HousePlacementResult.BadStatic; // Broke rule #3

View file

@ -32,7 +32,7 @@ namespace Server.Multis
public override HouseDeed GetDeed() public override HouseDeed GetDeed()
{ {
switch ( ItemID ^ 0x4000 ) switch ( ItemID )
{ {
case 0x64: return new StonePlasterHouseDeed(); case 0x64: return new StonePlasterHouseDeed();
case 0x66: return new FieldStoneHouseDeed(); case 0x66: return new FieldStoneHouseDeed();
@ -128,7 +128,7 @@ namespace Server.Multis
public override HouseDeed GetDeed() public override HouseDeed GetDeed()
{ {
switch( ItemID ^ 0x4000 ) switch( ItemID )
{ {
case 0x76: return new TwoStoryWoodPlasterHouseDeed(); case 0x76: return new TwoStoryWoodPlasterHouseDeed();
case 0x78: case 0x78:
@ -554,7 +554,7 @@ namespace Server.Multis
public override HouseDeed GetDeed() public override HouseDeed GetDeed()
{ {
switch ( ItemID ^ 0x4000 ) switch ( ItemID )
{ {
case 0xA0: return new StoneWorkshopDeed(); case 0xA0: return new StoneWorkshopDeed();
case 0xA2: case 0xA2:

View file

@ -11,7 +11,7 @@ namespace Server.Multis
private List<Item> m_Components; private List<Item> m_Components;
private Timer m_Timer; private Timer m_Timer;
public PreviewHouse( int multiID ) : base( multiID | 0x4000 ) public PreviewHouse( int multiID ) : base( multiID )
{ {
m_Components = new List<Item>(); m_Components = new List<Item>();
@ -123,7 +123,7 @@ namespace Server.Multis
} }
} }
Delete(); Timer.DelayCall( TimeSpan.Zero, new TimerCallback( this.Delete ) );
} }
private class DecayTimer : Timer private class DecayTimer : Timer

View file

@ -269,12 +269,12 @@ namespace Server.Regions
if ( x < 0 || y < 0 || x >= map.Width || y >= map.Height ) if ( x < 0 || y < 0 || x >= map.Width || y >= map.Height )
continue; continue;
Tile lt = map.Tiles.GetLandTile( x, y ); LandTile lt = map.Tiles.GetLandTile( x, y );
int ltLowZ = 0, ltAvgZ = 0, ltTopZ = 0; int ltLowZ = 0, ltAvgZ = 0, ltTopZ = 0;
map.GetAverageZ( x, y, ref ltLowZ, ref ltAvgZ, ref ltTopZ ); map.GetAverageZ( x, y, ref ltLowZ, ref ltAvgZ, ref ltTopZ );
TileFlag ltFlags = TileData.LandTable[lt.ID & 0x3FFF].Flags; TileFlag ltFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
bool ltImpassable = ( (ltFlags & TileFlag.Impassable) != 0 ); bool ltImpassable = ( (ltFlags & TileFlag.Impassable) != 0 );
if ( !lt.Ignored && ltAvgZ >= minZ && ltAvgZ < maxZ ) if ( !lt.Ignored && ltAvgZ >= minZ && ltAvgZ < maxZ )
@ -285,12 +285,12 @@ namespace Server.Regions
else if ( land && !ltImpassable ) else if ( land && !ltImpassable )
m_SpawnBuffer1.Add( ltAvgZ ); m_SpawnBuffer1.Add( ltAvgZ );
Tile[] staticTiles = map.Tiles.GetStaticTiles( x, y, true ); StaticTile[] staticTiles = map.Tiles.GetStaticTiles( x, y, true );
for ( int j = 0; j < staticTiles.Length; j++ ) for ( int j = 0; j < staticTiles.Length; j++ )
{ {
Tile tile = staticTiles[j]; StaticTile tile = staticTiles[j];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
int tileZ = tile.Z + id.CalcHeight; int tileZ = tile.Z + id.CalcHeight;
if ( tileZ >= minZ && tileZ < maxZ ) if ( tileZ >= minZ && tileZ < maxZ )
@ -309,7 +309,7 @@ namespace Server.Regions
{ {
Item item = sector.Items[j]; Item item = sector.Items[j];
if ( item.ItemID < 0x4000 && item.AtWorldPoint( x, y ) ) if ( item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint( x, y ) )
{ {
m_SpawnBuffer2.Add( item ); m_SpawnBuffer2.Add( item );
@ -411,8 +411,8 @@ namespace Server.Regions
for ( int j = 0; j < staticTiles.Length; j++ ) for ( int j = 0; j < staticTiles.Length; j++ )
{ {
Tile tile = staticTiles[j]; StaticTile tile = staticTiles[j];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
if ( ( id.Surface || id.Impassable ) && tile.Z + id.CalcHeight > z && tile.Z < top ) if ( ( id.Surface || id.Impassable ) && tile.Z + id.CalcHeight > z && tile.Z < top )
{ {

View file

@ -270,7 +270,7 @@ namespace Server.Regions
protected override void Init() protected override void Init()
{ {
m_Height = TileData.ItemTable[m_ItemID & 0x3FFF].Height; m_Height = TileData.ItemTable[m_ItemID & TileData.MaxItemValue].Height;
} }
protected override Item CreateItem() protected override Item CreateItem()

View file

@ -195,7 +195,7 @@ namespace Server.Spells
int z = t.Z; int z = t.Z;
if( (t.Flags & TileFlag.Surface) == 0 ) if( (t.Flags & TileFlag.Surface) == 0 )
z -= TileData.ItemTable[t.ItemID & 0x3FFF].CalcHeight; z -= TileData.ItemTable[t.ItemID & TileData.MaxItemValue].CalcHeight;
p = new Point3D( t.X, t.Y, z ); p = new Point3D( t.X, t.Y, z );
} }

View file

@ -66,19 +66,18 @@ namespace Server.Spells.Spellweaving
private static bool IsValidLocation( Point3D location, Map map ) private static bool IsValidLocation( Point3D location, Map map )
{ {
Tile lt = map.Tiles.GetLandTile( location.X, location.Y ); // Land Tiles LandTile lt = map.Tiles.GetLandTile( location.X, location.Y ); // Land Tiles
if( IsValidTile( lt.ID ) && lt.Z == location.Z ) if( IsValidTile( lt.ID ) && lt.Z == location.Z )
return true; return true;
Tile[] tiles = map.Tiles.GetStaticTiles( location.X, location.Y ); // Static Tiles StaticTile[] tiles = map.Tiles.GetStaticTiles( location.X, location.Y ); // Static Tiles
for( int i = 0; i < tiles.Length; ++i ) for( int i = 0; i < tiles.Length; ++i )
{ {
Tile t = tiles[i]; StaticTile t = tiles[i];
ItemData id = TileData.ItemTable[t.ID & 0x3FFF];
int tand = t.ID & 0x3FFF; int tand = t.ID;
if( t.Z != location.Z ) if( t.Z != location.Z )
continue; continue;

View file

@ -603,6 +603,7 @@ namespace Server
#region Packet caches #region Packet caches
private Packet m_WorldPacket; private Packet m_WorldPacket;
private Packet m_WorldPacketSA; private Packet m_WorldPacketSA;
private Packet m_WorldPacketHS;
private Packet m_RemovePacket; private Packet m_RemovePacket;
private Packet m_OPLPacket; private Packet m_OPLPacket;
@ -1747,10 +1748,33 @@ namespace Server
} }
} }
public Packet WorldPacketHS
{
get
{
// This needs to be invalidated when any of the following changes:
// - ItemID
// - Amount
// - Location
// - Hue
// - Packet Flags
// - Direction
if ( m_WorldPacketHS == null )
{
m_WorldPacketHS = new WorldItemHS( this );
m_WorldPacketHS.SetStatic();
}
return m_WorldPacketHS;
}
}
public void ReleaseWorldPackets() public void ReleaseWorldPackets()
{ {
Packet.Release( ref m_WorldPacket ); Packet.Release( ref m_WorldPacket );
Packet.Release( ref m_WorldPacketSA ); Packet.Release( ref m_WorldPacketSA );
Packet.Release( ref m_WorldPacketHS );
} }
[CommandProperty( AccessLevel.GameMaster )] [CommandProperty( AccessLevel.GameMaster )]
@ -2675,7 +2699,12 @@ namespace Server
} }
protected virtual Packet GetWorldPacketFor( NetState state ) { protected virtual Packet GetWorldPacketFor( NetState state ) {
return this.WorldPacket; if ( state.HighSeas )
return this.WorldPacketHS;
else if ( state.StygianAbyss )
return this.WorldPacketSA;
else
return this.WorldPacket;
} }
public virtual bool IsVirtualItem{ get{ return false; } } public virtual bool IsVirtualItem{ get{ return false; } }
@ -2706,7 +2735,10 @@ namespace Server
{ {
get get
{ {
return 1020000 + (m_ItemID & 0x3FFF); if ( m_ItemID < 0x4000 )
return 1020000 + m_ItemID;
else
return 1078872 + m_ItemID;
} }
} }
@ -2732,7 +2764,7 @@ namespace Server
{ {
get get
{ {
if ( m_ItemID < 0 || m_ItemID >= 0x4000 ) if ( m_ItemID < 0 || m_ItemID > TileData.MaxItemValue || this is BaseMulti )
return 0; return 0;
int weight = TileData.ItemTable[m_ItemID].Weight; int weight = TileData.ItemTable[m_ItemID].Weight;
@ -2791,7 +2823,7 @@ namespace Server
{ {
get get
{ {
return ( m_ItemID & 0x3FFF ); return m_ItemID;
} }
} }
@ -3859,8 +3891,8 @@ namespace Server
int maxZ = from.Z + 16; int maxZ = from.Z + 16;
Tile landTile = map.Tiles.GetLandTile( x, y ); LandTile landTile = map.Tiles.GetLandTile( x, y );
TileFlag landFlags = TileData.LandTable[landTile.ID & 0x3FFF].Flags; TileFlag landFlags = TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags;
int landZ = 0, landAvg = 0, landTop = 0; int landZ = 0, landAvg = 0, landTop = 0;
map.GetAverageZ( x, y, ref landZ, ref landAvg, ref landTop ); map.GetAverageZ( x, y, ref landZ, ref landAvg, ref landTop );
@ -3871,12 +3903,12 @@ namespace Server
z = landAvg; z = landAvg;
} }
Tile[] tiles = map.Tiles.GetStaticTiles( x, y, true ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, true );
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
if ( !id.Surface ) if ( !id.Surface )
continue; continue;
@ -3895,7 +3927,7 @@ namespace Server
foreach ( Item item in eable ) foreach ( Item item in eable )
{ {
if ( item.ItemID >= 0x4000 ) if ( item is BaseMulti )
continue; continue;
items.Add( item ); items.Add( item );
@ -3927,8 +3959,8 @@ namespace Server
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
int checkZ = tile.Z; int checkZ = tile.Z;
int checkTop = checkZ + id.CalcHeight; int checkTop = checkZ + id.CalcHeight;
@ -4021,8 +4053,8 @@ namespace Server
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
int checkZ = tile.Z; int checkZ = tile.Z;
int checkTop = checkZ + id.CalcHeight; int checkTop = checkZ + id.CalcHeight;
@ -4323,7 +4355,7 @@ namespace Server
{ {
get get
{ {
return TileData.ItemTable[m_ItemID & 0x3FFF]; return TileData.ItemTable[m_ItemID & TileData.MaxItemValue];
} }
} }

View file

@ -75,8 +75,14 @@ namespace Server.Items
{ {
MultiComponentList mcl = this.Components; MultiComponentList mcl = this.Components;
if ( mcl.List.Length > 0 ) if ( mcl.List.Length > 0 ) {
return 1020000 + (mcl.List[0].m_ItemID & 0x3FFF); int id = mcl.List[0].m_ItemID;
if ( id < 0x4000 )
return 1020000 + id;
else
return 1078872 + id;
}
return base.LabelNumber; return base.LabelNumber;
} }
@ -149,7 +155,7 @@ namespace Server.Items
{ {
base.Serialize( writer ); base.Serialize( writer );
writer.Write( (int) 0 ); // version writer.Write( (int) 1 ); // version
} }
public override void Deserialize( GenericReader reader ) public override void Deserialize( GenericReader reader )
@ -157,6 +163,12 @@ namespace Server.Items
base.Deserialize( reader ); base.Deserialize( reader );
int version = reader.ReadInt(); int version = reader.ReadInt();
if ( version == 0 ) {
if ( ItemID >= 0x4000 ) {
ItemID -= 0x4000;
}
}
} }
} }
} }

View file

@ -360,24 +360,24 @@ namespace Server
bool hasSurface = false; bool hasSurface = false;
Tile lt = Tiles.GetLandTile( x, y ); LandTile lt = Tiles.GetLandTile( x, y );
int lowZ = 0, avgZ = 0, topZ = 0; int lowZ = 0, avgZ = 0, topZ = 0;
GetAverageZ( x, y, ref lowZ, ref avgZ, ref topZ ); GetAverageZ( x, y, ref lowZ, ref avgZ, ref topZ );
TileFlag landFlags = TileData.LandTable[lt.ID & 0x3FFF].Flags; TileFlag landFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
if ( ( landFlags & TileFlag.Impassable ) != 0 && avgZ > z && ( z + height ) > lowZ ) if ( ( landFlags & TileFlag.Impassable ) != 0 && avgZ > z && ( z + height ) > lowZ )
return false; return false;
else if ( ( landFlags & TileFlag.Impassable ) == 0 && z == avgZ && !lt.Ignored ) else if ( ( landFlags & TileFlag.Impassable ) == 0 && z == avgZ && !lt.Ignored )
hasSurface = true; hasSurface = true;
Tile[] staticTiles = Tiles.GetStaticTiles( x, y, true ); StaticTile[] staticTiles = Tiles.GetStaticTiles( x, y, true );
bool surface, impassable; bool surface, impassable;
for ( int i = 0; i < staticTiles.Length; ++i ) for ( int i = 0; i < staticTiles.Length; ++i )
{ {
ItemData id = TileData.ItemTable[staticTiles[i].ID & 0x3FFF]; ItemData id = TileData.ItemTable[staticTiles[i].ID & TileData.MaxItemValue];
surface = id.Surface; surface = id.Surface;
impassable = id.Impassable; impassable = id.Impassable;
@ -395,7 +395,7 @@ namespace Server
{ {
Item item = items[i]; Item item = items[i];
if ( item.ItemID < 0x4000 && item.AtWorldPoint( x, y ) ) if ( !(item is BaseMulti) && item.AtWorldPoint( x, y ) )
{ {
ItemData id = item.ItemData; ItemData id = item.ItemData;
surface = id.Surface; surface = id.Surface;
@ -457,12 +457,12 @@ namespace Server
public void FixColumn( int x, int y ) public void FixColumn( int x, int y )
{ {
Tile landTile = Tiles.GetLandTile( x, y ); LandTile landTile = Tiles.GetLandTile( x, y );
int landZ = 0, landAvg = 0, landTop = 0; int landZ = 0, landAvg = 0, landTop = 0;
GetAverageZ( x, y, ref landZ, ref landAvg, ref landTop ); GetAverageZ( x, y, ref landZ, ref landAvg, ref landTop );
Tile[] tiles = Tiles.GetStaticTiles( x, y, true ); StaticTile[] tiles = Tiles.GetStaticTiles( x, y, true );
List<Item> items = new List<Item>(); List<Item> items = new List<Item>();
@ -470,7 +470,7 @@ namespace Server
foreach ( Item item in eable ) foreach ( Item item in eable )
{ {
if ( item.ItemID < 0x4000 ) if ( !(item is BaseMulti) )
{ {
items.Add( item ); items.Add( item );
@ -501,8 +501,8 @@ namespace Server
for ( int j = 0; j < tiles.Length; ++j ) for ( int j = 0; j < tiles.Length; ++j )
{ {
Tile tile = tiles[j]; StaticTile tile = tiles[j];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
int checkZ = tile.Z; int checkZ = tile.Z;
int checkTop = checkZ + id.CalcHeight; int checkTop = checkZ + id.CalcHeight;
@ -537,6 +537,7 @@ namespace Server
} }
} }
/* This could be probably be re-implemented if necessary (perhaps via an ITile interface?).
public List<Tile> GetTilesAt( Point2D p, bool items, bool land, bool statics ) public List<Tile> GetTilesAt( Point2D p, bool items, bool land, bool statics )
{ {
List<Tile> list = new List<Tile>(); List<Tile> list = new List<Tile>();
@ -556,11 +557,12 @@ namespace Server
foreach ( Item item in sector.Items ) foreach ( Item item in sector.Items )
if ( item.AtWorldPoint( p.m_X, p.m_Y ) ) if ( item.AtWorldPoint( p.m_X, p.m_Y ) )
list.Add( new Tile( (short) ( ( item.ItemID & 0x3FFF ) + 0x4000 ), (sbyte) item.Z ) ); list.Add( new StaticTile( (ushort)item.ItemID, (sbyte) item.Z ) );
} }
return list; return list;
} }
*/
/// <summary> /// <summary>
/// Gets the highest surface that is lower than <paramref name="p"/>. /// Gets the highest surface that is lower than <paramref name="p"/>.
@ -576,7 +578,7 @@ namespace Server
int surfaceZ = int.MinValue; int surfaceZ = int.MinValue;
Tile lt = Tiles.GetLandTile( p.X, p.Y ); LandTile lt = Tiles.GetLandTile( p.X, p.Y );
if ( !lt.Ignored ) if ( !lt.Ignored )
{ {
@ -593,12 +595,12 @@ namespace Server
} }
Tile[] staticTiles = Tiles.GetStaticTiles( p.X, p.Y, true ); StaticTile[] staticTiles = Tiles.GetStaticTiles( p.X, p.Y, true );
for ( int i = 0; i < staticTiles.Length; i++ ) for ( int i = 0; i < staticTiles.Length; i++ )
{ {
Tile tile = staticTiles[i]; StaticTile tile = staticTiles[i];
ItemData id = TileData.ItemTable[tile.ID & 0x3FFF]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
if ( id.Surface || ( id.Flags & TileFlag.Wet ) != 0 ) if ( id.Surface || ( id.Flags & TileFlag.Wet ) != 0 )
{ {
@ -622,7 +624,7 @@ namespace Server
{ {
Item item = sector.Items[i]; Item item = sector.Items[i];
if ( item.ItemID < 0x4000 && item.AtWorldPoint( p.X, p.Y ) && !item.Movable ) if ( !(item is BaseMulti) && item.AtWorldPoint( p.X, p.Y ) && !item.Movable )
{ {
ItemData id = item.ItemData; ItemData id = item.ItemData;
@ -1385,12 +1387,12 @@ namespace Server
if ( xOffset >= 0 && xOffset < list.Width && yOffset >= 0 && yOffset < list.Height ) if ( xOffset >= 0 && xOffset < list.Width && yOffset >= 0 && yOffset < list.Height )
{ {
Tile[] tiles = list.Tiles[xOffset][yOffset]; StaticTile[] tiles = list.Tiles[xOffset][yOffset];
if ( tiles.Length > 0 ) if ( tiles.Length > 0 )
{ {
// TODO: How to avoid this copy? // TODO: How to avoid this copy?
Tile[] copy = new Tile[tiles.Length]; StaticTile[] copy = new StaticTile[tiles.Length];
for ( int i = 0; i < copy.Length; ++i ) for ( int i = 0; i < copy.Length; ++i )
{ {
@ -1779,7 +1781,7 @@ namespace Server
else if( o is StaticTarget ) else if( o is StaticTarget )
{ {
StaticTarget st = (StaticTarget)o; StaticTarget st = (StaticTarget)o;
ItemData id = TileData.ItemTable[st.ItemID & 0x3FFF]; ItemData id = TileData.ItemTable[st.ItemID & TileData.MaxItemValue];
p = new Point3D( st.X, st.Y, st.Z - id.CalcHeight + (id.Height / 2) + 1 ); p = new Point3D( st.X, st.Y, st.Z - id.CalcHeight + (id.Height / 2) + 1 );
} }
@ -1894,7 +1896,7 @@ namespace Server
{ {
Point3D point = path[i]; Point3D point = path[i];
Tile landTile = Tiles.GetLandTile( point.X, point.Y ); LandTile landTile = Tiles.GetLandTile( point.X, point.Y );
int landZ = 0, landAvg = 0, landTop = 0; int landZ = 0, landAvg = 0, landTop = 0;
GetAverageZ( point.m_X, point.m_Y, ref landZ, ref landAvg, ref landTop ); GetAverageZ( point.m_X, point.m_Y, ref landZ, ref landAvg, ref landTop );
@ -1902,12 +1904,12 @@ namespace Server
return false; return false;
/* --Do land tiles need to be checked? There is never land between two people, always statics.-- /* --Do land tiles need to be checked? There is never land between two people, always statics.--
Tile landTile = Tiles.GetLandTile( point.X, point.Y ); LandTile landTile = Tiles.GetLandTile( point.X, point.Y );
if ( landTile.Z-1 >= point.Z && landTile.Z+1 <= point.Z && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Impassable) != 0 ) if ( landTile.Z-1 >= point.Z && landTile.Z+1 <= point.Z && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) != 0 )
return false; return false;
*/ */
Tile[] statics = Tiles.GetStaticTiles( point.m_X, point.m_Y, true ); StaticTile[] statics = Tiles.GetStaticTiles( point.m_X, point.m_Y, true );
bool contains = false; bool contains = false;
int ltID = landTile.ID; int ltID = landTile.ID;
@ -1936,9 +1938,9 @@ namespace Server
for( int j = 0; j < statics.Length; ++j ) for( int j = 0; j < statics.Length; ++j )
{ {
Tile t = statics[j]; StaticTile t = statics[j];
ItemData id = TileData.ItemTable[t.ID & 0x3FFF]; ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
flags = id.Flags; flags = id.Flags;
height = id.CalcHeight; height = id.CalcHeight;
@ -1954,7 +1956,7 @@ namespace Server
/*if ( t.Z <= point.Z && t.Z+height >= point.Z && (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0 /*if ( t.Z <= point.Z && t.Z+height >= point.Z && (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0
&& ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )*/ && ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )*/
/*{ /*{
//Console.WriteLine( "LoS: Blocked by Static \"{0}\" Z:{1} T:{3} P:{2} F:x{4:X}", TileData.ItemTable[t.ID&0x3FFF].Name, t.Z, point, t.Z+height, flags ); //Console.WriteLine( "LoS: Blocked by Static \"{0}\" Z:{1} T:{3} P:{2} F:x{4:X}", TileData.ItemTable[t.ID&TileData.MaxItemValue].Name, t.Z, point, t.Z+height, flags );
//Console.WriteLine( "if ( {0} && {1} && {2} && ( {3} || {4} || {5} || ({6} && {7} && {8}) ) )", t.Z <= point.Z, t.Z+height >= point.Z, (flags&TileFlag.Window)==0, (flags&TileFlag.Impassable)!=0, (flags&TileFlag.Wall)!=0, (flags&TileFlag.Roof)!=0, (flags&TileFlag.Surface)!=0, t.Z != dest.Z, zd != 0 ) ; //Console.WriteLine( "if ( {0} && {1} && {2} && ( {3} || {4} || {5} || ({6} && {7} && {8}) ) )", t.Z <= point.Z, t.Z+height >= point.Z, (flags&TileFlag.Window)==0, (flags&TileFlag.Impassable)!=0, (flags&TileFlag.Wall)!=0, (flags&TileFlag.Roof)!=0, (flags&TileFlag.Surface)!=0, t.Z != dest.Z, zd != 0 ) ;
return false; return false;
}*/ }*/
@ -1970,7 +1972,7 @@ namespace Server
if( !i.Visible ) if( !i.Visible )
continue; continue;
if( i.ItemID >= 0x4000 ) if( i is BaseMulti || i.ItemID > TileData.MaxItemValue )
continue; continue;
ItemData id = i.ItemData; ItemData id = i.ItemData;
@ -2010,11 +2012,11 @@ namespace Server
/*if ( (flags & (TileFlag.Impassable | TileFlag.Surface | TileFlag.Roof)) != 0 ) /*if ( (flags & (TileFlag.Impassable | TileFlag.Surface | TileFlag.Roof)) != 0 )
//flags = TileData.ItemTable[i.ItemID&0x3FFF].Flags; //flags = TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Flags;
//if ( (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0 && ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) ) //if ( (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0 && ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )
{ {
//height = TileData.ItemTable[i.ItemID&0x3FFF].Height; //height = TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Height;
//Console.WriteLine( "LoS: Blocked by ITEM \"{0}\" P:{1} T:{2} F:x{3:X}", TileData.ItemTable[i.ItemID&0x3FFF].Name, i.Location, i.Location.Z+height, flags ); //Console.WriteLine( "LoS: Blocked by ITEM \"{0}\" P:{1} T:{2} F:x{3:X}", TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Name, i.Location, i.Location.Z+height, flags );
area.Free(); area.Free();
return false; return false;
}*/ }*/

View file

@ -35,8 +35,6 @@ namespace Server
{ {
MultiComponentList mcl; MultiComponentList mcl;
multiID &= 0x3FFF;
if ( multiID >= 0 && multiID < m_Components.Length ) if ( multiID >= 0 && multiID < m_Components.Length )
{ {
mcl = m_Components[multiID]; mcl = m_Components[multiID];
@ -132,11 +130,11 @@ namespace Server
public struct MultiTileEntry public struct MultiTileEntry
{ {
public short m_ItemID; public ushort m_ItemID;
public short m_OffsetX, m_OffsetY, m_OffsetZ; public short m_OffsetX, m_OffsetY, m_OffsetZ;
public int m_Flags; public int m_Flags;
public MultiTileEntry( short itemID, short xOffset, short yOffset, short zOffset, int flags ) public MultiTileEntry( ushort itemID, short xOffset, short yOffset, short zOffset, int flags )
{ {
m_ItemID = itemID; m_ItemID = itemID;
m_OffsetX = xOffset; m_OffsetX = xOffset;
@ -157,7 +155,7 @@ namespace Server
private Point2D m_Min, m_Max, m_Center; private Point2D m_Min, m_Max, m_Center;
private int m_Width, m_Height; private int m_Width, m_Height;
private Tile[][][] m_Tiles; private StaticTile[][][] m_Tiles;
private MultiTileEntry[] m_List; private MultiTileEntry[] m_List;
public static readonly MultiComponentList Empty = new MultiComponentList(); public static readonly MultiComponentList Empty = new MultiComponentList();
@ -170,29 +168,26 @@ namespace Server
public int Width{ get{ return m_Width; } } public int Width{ get{ return m_Width; } }
public int Height{ get{ return m_Height; } } public int Height{ get{ return m_Height; } }
public Tile[][][] Tiles{ get{ return m_Tiles; } } public StaticTile[][][] Tiles{ get{ return m_Tiles; } }
public MultiTileEntry[] List{ get{ return m_List; } } public MultiTileEntry[] List{ get{ return m_List; } }
public void Add( int itemID, int x, int y, int z ) public void Add( int itemID, int x, int y, int z )
{ {
itemID &= 0x3FFF;
itemID |= 0x4000;
int vx = x + m_Center.m_X; int vx = x + m_Center.m_X;
int vy = y + m_Center.m_Y; int vy = y + m_Center.m_Y;
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height ) if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{ {
Tile[] oldTiles = m_Tiles[vx][vy]; StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = oldTiles.Length - 1; i >= 0; --i ) for ( int i = oldTiles.Length - 1; i >= 0; --i )
{ {
ItemData data = TileData.ItemTable[itemID & 0x3FFF]; ItemData data = TileData.ItemTable[itemID & TileData.MaxItemValue];
if ( oldTiles[i].Z == z && (oldTiles[i].Height > 0 == data.Height > 0 ) ) if ( oldTiles[i].Z == z && (oldTiles[i].Height > 0 == data.Height > 0 ) )
{ {
bool newIsRoof = ( data.Flags & TileFlag.Roof) != 0; bool newIsRoof = ( data.Flags & TileFlag.Roof) != 0;
bool oldIsRoof = (TileData.ItemTable[oldTiles[i].ID & 0x3FFF].Flags & TileFlag.Roof ) != 0; bool oldIsRoof = (TileData.ItemTable[oldTiles[i].ID & TileData.MaxItemValue].Flags & TileFlag.Roof ) != 0;
if ( newIsRoof == oldIsRoof ) if ( newIsRoof == oldIsRoof )
Remove( oldTiles[i].ID, x, y, z ); Remove( oldTiles[i].ID, x, y, z );
@ -201,12 +196,12 @@ namespace Server
oldTiles = m_Tiles[vx][vy]; oldTiles = m_Tiles[vx][vy];
Tile[] newTiles = new Tile[oldTiles.Length + 1]; StaticTile[] newTiles = new StaticTile[oldTiles.Length + 1];
for ( int i = 0; i < oldTiles.Length; ++i ) for ( int i = 0; i < oldTiles.Length; ++i )
newTiles[i] = oldTiles[i]; newTiles[i] = oldTiles[i];
newTiles[oldTiles.Length] = new Tile( (short)itemID, (sbyte)z ); newTiles[oldTiles.Length] = new StaticTile( (ushort)itemID, (sbyte)z );
m_Tiles[vx][vy] = newTiles; m_Tiles[vx][vy] = newTiles;
@ -216,7 +211,7 @@ namespace Server
for ( int i = 0; i < oldList.Length; ++i ) for ( int i = 0; i < oldList.Length; ++i )
newList[i] = oldList[i]; newList[i] = oldList[i];
newList[oldList.Length] = new MultiTileEntry( (short)itemID, (short)x, (short)y, (short)z, 1 ); newList[oldList.Length] = new MultiTileEntry( (ushort)itemID, (short)x, (short)y, (short)z, 1 );
m_List = newList; m_List = newList;
@ -241,15 +236,15 @@ namespace Server
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height ) if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{ {
Tile[] oldTiles = m_Tiles[vx][vy]; StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = 0; i < oldTiles.Length; ++i ) for ( int i = 0; i < oldTiles.Length; ++i )
{ {
Tile tile = oldTiles[i]; StaticTile tile = oldTiles[i];
if ( tile.Z == z && tile.Height >= minHeight ) if ( tile.Z == z && tile.Height >= minHeight )
{ {
Tile[] newTiles = new Tile[oldTiles.Length - 1]; StaticTile[] newTiles = new StaticTile[oldTiles.Length - 1];
for ( int j = 0; j < i; ++j ) for ( int j = 0; j < i; ++j )
newTiles[j] = oldTiles[j]; newTiles[j] = oldTiles[j];
@ -269,7 +264,7 @@ namespace Server
{ {
MultiTileEntry tile = oldList[i]; MultiTileEntry tile = oldList[i];
if ( tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z && TileData.ItemTable[tile.m_ItemID & 0x3FFF].Height >= minHeight ) if ( tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z && TileData.ItemTable[tile.m_ItemID & TileData.MaxItemValue].Height >= minHeight )
{ {
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1]; MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1];
@ -294,15 +289,15 @@ namespace Server
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height ) if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{ {
Tile[] oldTiles = m_Tiles[vx][vy]; StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = 0; i < oldTiles.Length; ++i ) for ( int i = 0; i < oldTiles.Length; ++i )
{ {
Tile tile = oldTiles[i]; StaticTile tile = oldTiles[i];
if ( (tile.ID & 0x3FFF) == (itemID & 0x3FFF) && tile.Z == z ) if ( tile.ID == itemID && tile.Z == z )
{ {
Tile[] newTiles = new Tile[oldTiles.Length - 1]; StaticTile[] newTiles = new StaticTile[oldTiles.Length - 1];
for ( int j = 0; j < i; ++j ) for ( int j = 0; j < i; ++j )
newTiles[j] = oldTiles[j]; newTiles[j] = oldTiles[j];
@ -322,7 +317,7 @@ namespace Server
{ {
MultiTileEntry tile = oldList[i]; MultiTileEntry tile = oldList[i];
if ( (tile.m_ItemID & 0x3FFF) == (short)(itemID & 0x3FFF) && tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z ) if ( tile.m_ItemID == itemID && tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z )
{ {
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1]; MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1];
@ -343,22 +338,22 @@ namespace Server
public void Resize( int newWidth, int newHeight ) public void Resize( int newWidth, int newHeight )
{ {
int oldWidth = m_Width, oldHeight = m_Height; int oldWidth = m_Width, oldHeight = m_Height;
Tile[][][] oldTiles = m_Tiles; StaticTile[][][] oldTiles = m_Tiles;
int totalLength = 0; int totalLength = 0;
Tile[][][] newTiles = new Tile[newWidth][][]; StaticTile[][][] newTiles = new StaticTile[newWidth][][];
for ( int x = 0; x < newWidth; ++x ) for ( int x = 0; x < newWidth; ++x )
{ {
newTiles[x] = new Tile[newHeight][]; newTiles[x] = new StaticTile[newHeight][];
for ( int y = 0; y < newHeight; ++y ) for ( int y = 0; y < newHeight; ++y )
{ {
if ( x < oldWidth && y < oldHeight ) if ( x < oldWidth && y < oldHeight )
newTiles[x][y] = oldTiles[x][y]; newTiles[x][y] = oldTiles[x][y];
else else
newTiles[x][y] = new Tile[0]; newTiles[x][y] = new StaticTile[0];
totalLength += newTiles[x][y].Length; totalLength += newTiles[x][y].Length;
} }
@ -378,11 +373,11 @@ namespace Server
{ {
for ( int y = 0; y < newHeight; ++y ) for ( int y = 0; y < newHeight; ++y )
{ {
Tile[] tiles = newTiles[x][y]; StaticTile[] tiles = newTiles[x][y];
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
int vx = x - m_Center.X; int vx = x - m_Center.X;
int vy = y - m_Center.Y; int vy = y - m_Center.Y;
@ -399,7 +394,7 @@ namespace Server
if ( vy > m_Max.m_Y ) if ( vy > m_Max.m_Y )
m_Max.m_Y = vy; m_Max.m_Y = vy;
m_List[index++] = new MultiTileEntry( (short)tile.ID, (short)vx, (short)vy, (short)tile.Z, 1 ); m_List[index++] = new MultiTileEntry( (ushort)tile.ID, (short)vx, (short)vy, (short)tile.Z, 1 );
} }
} }
} }
@ -415,15 +410,15 @@ namespace Server
m_Width = toCopy.m_Width; m_Width = toCopy.m_Width;
m_Height = toCopy.m_Height; m_Height = toCopy.m_Height;
m_Tiles = new Tile[m_Width][][]; m_Tiles = new StaticTile[m_Width][][];
for ( int x = 0; x < m_Width; ++x ) for ( int x = 0; x < m_Width; ++x )
{ {
m_Tiles[x] = new Tile[m_Height][]; m_Tiles[x] = new StaticTile[m_Height][];
for ( int y = 0; y < m_Height; ++y ) for ( int y = 0; y < m_Height; ++y )
{ {
m_Tiles[x][y] = new Tile[toCopy.m_Tiles[x][y].Length]; m_Tiles[x][y] = new StaticTile[toCopy.m_Tiles[x][y].Length];
for ( int i = 0; i < m_Tiles[x][y].Length; ++i ) for ( int i = 0; i < m_Tiles[x][y].Length; ++i )
m_Tiles[x][y][i] = toCopy.m_Tiles[x][y][i]; m_Tiles[x][y][i] = toCopy.m_Tiles[x][y][i];
@ -453,7 +448,7 @@ namespace Server
{ {
MultiTileEntry ent = m_List[i]; MultiTileEntry ent = m_List[i];
writer.Write( (short) ent.m_ItemID ); writer.Write( (ushort) ent.m_ItemID );
writer.Write( (short) ent.m_OffsetX ); writer.Write( (short) ent.m_OffsetX );
writer.Write( (short) ent.m_OffsetY ); writer.Write( (short) ent.m_OffsetY );
writer.Write( (short) ent.m_OffsetZ ); writer.Write( (short) ent.m_OffsetZ );
@ -481,7 +476,7 @@ namespace Server
for ( int i = 0; i < length; ++i ) for ( int i = 0; i < length; ++i )
{ {
allTiles[i].m_ItemID = reader.ReadShort(); allTiles[i].m_ItemID = reader.ReadUShort();
allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort();
@ -489,12 +484,12 @@ namespace Server
} }
TileList[][] tiles = new TileList[m_Width][]; TileList[][] tiles = new TileList[m_Width][];
m_Tiles = new Tile[m_Width][][]; m_Tiles = new StaticTile[m_Width][][];
for ( int x = 0; x < m_Width; ++x ) for ( int x = 0; x < m_Width; ++x )
{ {
tiles[x] = new TileList[m_Height]; tiles[x] = new TileList[m_Height];
m_Tiles[x] = new Tile[m_Height][]; m_Tiles[x] = new StaticTile[m_Height][];
for ( int y = 0; y < m_Height; ++y ) for ( int y = 0; y < m_Height; ++y )
tiles[x][y] = new TileList(); tiles[x][y] = new TileList();
@ -507,7 +502,7 @@ namespace Server
int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
tiles[xOffset][yOffset].Add( (short)((allTiles[i].m_ItemID & 0x3FFF) | 0x4000), (sbyte)allTiles[i].m_OffsetZ ); tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ );
} }
} }
@ -526,7 +521,7 @@ namespace Server
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
allTiles[i].m_ItemID = reader.ReadInt16(); allTiles[i].m_ItemID = reader.ReadUInt16();
allTiles[i].m_OffsetX = reader.ReadInt16(); allTiles[i].m_OffsetX = reader.ReadInt16();
allTiles[i].m_OffsetY = reader.ReadInt16(); allTiles[i].m_OffsetY = reader.ReadInt16();
allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_OffsetZ = reader.ReadInt16();
@ -558,12 +553,12 @@ namespace Server
m_Height = (m_Max.m_Y - m_Min.m_Y) + 1; m_Height = (m_Max.m_Y - m_Min.m_Y) + 1;
TileList[][] tiles = new TileList[m_Width][]; TileList[][] tiles = new TileList[m_Width][];
m_Tiles = new Tile[m_Width][][]; m_Tiles = new StaticTile[m_Width][][];
for ( int x = 0; x < m_Width; ++x ) for ( int x = 0; x < m_Width; ++x )
{ {
tiles[x] = new TileList[m_Height]; tiles[x] = new TileList[m_Height];
m_Tiles[x] = new Tile[m_Height][]; m_Tiles[x] = new StaticTile[m_Height][];
for ( int y = 0; y < m_Height; ++y ) for ( int y = 0; y < m_Height; ++y )
tiles[x][y] = new TileList(); tiles[x][y] = new TileList();
@ -576,7 +571,7 @@ namespace Server
int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
tiles[xOffset][yOffset].Add( (short)((allTiles[i].m_ItemID & 0x3FFF) | 0x4000), (sbyte)allTiles[i].m_OffsetZ ); tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ );
} }
} }
@ -587,7 +582,7 @@ namespace Server
private MultiComponentList() private MultiComponentList()
{ {
m_Tiles = new Tile[0][][]; m_Tiles = new StaticTile[0][][];
m_List = new MultiTileEntry[0]; m_List = new MultiTileEntry[0];
} }
} }

View file

@ -1056,7 +1056,7 @@ namespace Server.Network
int flags = pvSrc.ReadByte(); int flags = pvSrc.ReadByte();
Serial serial = pvSrc.ReadInt32(); Serial serial = pvSrc.ReadInt32();
int x = pvSrc.ReadInt16(), y = pvSrc.ReadInt16(), z = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(), y = pvSrc.ReadInt16(), z = pvSrc.ReadInt16();
int graphic = pvSrc.ReadInt16(); int graphic = pvSrc.ReadUInt16();
if ( targetID == unchecked( (int) 0xDEADBEEF ) ) if ( targetID == unchecked( (int) 0xDEADBEEF ) )
return; return;
@ -1100,13 +1100,17 @@ namespace Server.Network
} }
else else
{ {
Tile[] tiles = map.Tiles.GetStaticTiles( x, y, !t.DisallowMultis ); StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, !t.DisallowMultis );
bool valid = false; bool valid = false;
ItemData id = TileData.ItemTable[graphic&TileData.MaxItemValue];
if ( id.Surface )
z -= id.Height;
for ( int i = 0; !valid && i < tiles.Length; ++i ) for ( int i = 0; !valid && i < tiles.Length; ++i )
{ {
if ( tiles[i].Z == z && (tiles[i].ID & 0x3FFF) == (graphic & 0x3FFF) ) if ( tiles[i].Z == z && tiles[i].ID == graphic )
valid = true; valid = true;
} }

View file

@ -265,7 +265,7 @@ namespace Server.Network
BuyItemState bis = (BuyItemState)list[i]; BuyItemState bis = (BuyItemState)list[i];
m_Stream.Write( (int)bis.MySerial ); m_Stream.Write( (int)bis.MySerial );
m_Stream.Write( (ushort)(bis.ItemID & 0x3FFF) ); m_Stream.Write( (ushort)bis.ItemID );
m_Stream.Write( (byte)0 );//itemid offset m_Stream.Write( (byte)0 );//itemid offset
m_Stream.Write( (ushort)bis.Amount ); m_Stream.Write( (ushort)bis.Amount );
m_Stream.Write( (short)(i+1) );//x m_Stream.Write( (short)(i+1) );//x
@ -293,7 +293,7 @@ namespace Server.Network
BuyItemState bis = (BuyItemState)list[i]; BuyItemState bis = (BuyItemState)list[i];
m_Stream.Write( (int)bis.MySerial ); m_Stream.Write( (int)bis.MySerial );
m_Stream.Write( (ushort)(bis.ItemID & 0x3FFF) ); m_Stream.Write( (ushort)bis.ItemID );
m_Stream.Write( (byte)0 );//itemid offset m_Stream.Write( (byte)0 );//itemid offset
m_Stream.Write( (ushort)bis.Amount ); m_Stream.Write( (ushort)bis.Amount );
m_Stream.Write( (short)(i+1) );//x m_Stream.Write( (short)(i+1) );//x
@ -366,7 +366,7 @@ namespace Server.Network
foreach ( SellItemState state in table.Values ) foreach ( SellItemState state in table.Values )
{ {
m_Stream.Write( (int) state.Item.Serial ); m_Stream.Write( (int) state.Item.Serial );
m_Stream.Write( (ushort) (state.Item.ItemID & 0x3FFF) ); m_Stream.Write( (ushort) state.Item.ItemID );
m_Stream.Write( (ushort) state.Item.Hue ); m_Stream.Write( (ushort) state.Item.Hue );
m_Stream.Write( (ushort) state.Item.Amount ); m_Stream.Write( (ushort) state.Item.Amount );
m_Stream.Write( (ushort) state.Price ); m_Stream.Write( (ushort) state.Price );
@ -769,7 +769,7 @@ namespace Server.Network
{ {
ItemListEntry e = entries[i]; ItemListEntry e = entries[i];
m_Stream.Write( (short) (e.ItemID & 0x3FFF) ); m_Stream.Write( (ushort) e.ItemID );
m_Stream.Write( (short) e.Hue ); m_Stream.Write( (short) e.Hue );
string name = e.Name; string name = e.Name;
@ -1021,7 +1021,7 @@ namespace Server.Network
// +1 - Flags // +1 - Flags
uint serial = (uint)item.Serial.Value; uint serial = (uint)item.Serial.Value;
int itemID = item.ItemID; int itemID = item.ItemID & 0x3FFF;
int amount = item.Amount; int amount = item.Amount;
Point3D loc = item.Location; Point3D loc = item.Location;
int x = loc.m_X; int x = loc.m_X;
@ -1040,7 +1040,11 @@ namespace Server.Network
} }
m_Stream.Write( (uint) serial ); m_Stream.Write( (uint) serial );
m_Stream.Write( (short) (itemID & 0x7FFF) );
if ( item is BaseMulti )
m_Stream.Write( (short) (itemID | 0x4000) );
else
m_Stream.Write( (short) itemID );
if ( amount != 0 ) if ( amount != 0 )
{ {
@ -1135,12 +1139,12 @@ namespace Server.Network
itemID &= 0x3FFF; itemID &= 0x3FFF;
} else { } else {
m_Stream.Write( (byte) 0x00 ); m_Stream.Write( (byte) 0x00 );
itemID &= 0x7FFF; itemID &= 0xFFFF;
} }
m_Stream.Write( (int) item.Serial ); m_Stream.Write( (int) item.Serial );
m_Stream.Write( (short) itemID ); m_Stream.Write( (ushort) itemID );
m_Stream.Write( (byte) item.Direction ); m_Stream.Write( (byte) item.Direction );
@ -1701,13 +1705,8 @@ namespace Server.Network
parentSerial = Serial.Zero; parentSerial = Serial.Zero;
} }
ushort cid = (ushort) item.ItemID;
if ( cid > 0x3FFF )
cid = 0x9D7;
m_Stream.Write( (int) item.Serial ); m_Stream.Write( (int) item.Serial );
m_Stream.Write( (short) cid ); m_Stream.Write( (ushort) item.ItemID );
m_Stream.Write( (byte) 0 ); // signed, itemID offset m_Stream.Write( (byte) 0 ); // signed, itemID offset
m_Stream.Write( (ushort) item.Amount ); m_Stream.Write( (ushort) item.Amount );
m_Stream.Write( (short) item.X ); m_Stream.Write( (short) item.X );
@ -1733,13 +1732,8 @@ namespace Server.Network
parentSerial = Serial.Zero; parentSerial = Serial.Zero;
} }
ushort cid = (ushort) item.ItemID;
if ( cid > 0x3FFF )
cid = 0x9D7;
m_Stream.Write( (int) item.Serial ); m_Stream.Write( (int) item.Serial );
m_Stream.Write( (short) cid ); m_Stream.Write( (ushort) item.ItemID );
m_Stream.Write( (byte) 0 ); // signed, itemID offset m_Stream.Write( (byte) 0 ); // signed, itemID offset
m_Stream.Write( (ushort) item.Amount ); m_Stream.Write( (ushort) item.Amount );
m_Stream.Write( (short) item.X ); m_Stream.Write( (short) item.X );
@ -1773,13 +1767,8 @@ namespace Server.Network
{ {
Point3D loc = child.Location; Point3D loc = child.Location;
ushort cid = (ushort) child.ItemID;
if ( cid > 0x3FFF )
cid = 0x9D7;
m_Stream.Write( (int) child.Serial ); m_Stream.Write( (int) child.Serial );
m_Stream.Write( (ushort) cid ); m_Stream.Write( (ushort) child.ItemID );
m_Stream.Write( (byte) 0 ); // signed, itemID offset m_Stream.Write( (byte) 0 ); // signed, itemID offset
m_Stream.Write( (ushort) child.Amount ); m_Stream.Write( (ushort) child.Amount );
m_Stream.Write( (short) loc.m_X ); m_Stream.Write( (short) loc.m_X );
@ -1819,13 +1808,8 @@ namespace Server.Network
{ {
Point3D loc = child.Location; Point3D loc = child.Location;
ushort cid = (ushort) child.ItemID;
if ( cid > 0x3FFF )
cid = 0x9D7;
m_Stream.Write( (int) child.Serial ); m_Stream.Write( (int) child.Serial );
m_Stream.Write( (ushort) cid ); m_Stream.Write( (ushort) child.ItemID );
m_Stream.Write( (byte) 0 ); // signed, itemID offset m_Stream.Write( (byte) 0 ); // signed, itemID offset
m_Stream.Write( (ushort) child.Amount ); m_Stream.Write( (ushort) child.Amount );
m_Stream.Write( (short) loc.m_X ); m_Stream.Write( (short) loc.m_X );
@ -3185,14 +3169,14 @@ namespace Server.Network
if ( beheld.SolidHueOverride >= 0 ) if ( beheld.SolidHueOverride >= 0 )
hue = beheld.SolidHueOverride; hue = beheld.SolidHueOverride;
int itemID = item.ItemID & 0x3FFF; int itemID = item.ItemID & 0x7FFF;
bool writeHue = ( hue != 0 ); bool writeHue = ( hue != 0 );
if ( writeHue ) if ( writeHue )
itemID |= 0x8000; itemID |= 0x8000;
m_Stream.Write( (int) item.Serial ); m_Stream.Write( (int) item.Serial );
m_Stream.Write( (short) itemID ); m_Stream.Write( (ushort) itemID );
m_Stream.Write( (byte) layer ); m_Stream.Write( (byte) layer );
if ( writeHue ) if ( writeHue )
@ -3210,7 +3194,7 @@ namespace Server.Network
if( beheld.SolidHueOverride >= 0 ) if( beheld.SolidHueOverride >= 0 )
hue = beheld.SolidHueOverride; hue = beheld.SolidHueOverride;
int itemID = beheld.HairItemID & 0x3FFF; int itemID = beheld.HairItemID & 0x7FFF;
bool writeHue = (hue != 0); bool writeHue = (hue != 0);
@ -3218,7 +3202,7 @@ namespace Server.Network
itemID |= 0x8000; itemID |= 0x8000;
m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) ); m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) );
m_Stream.Write( (short)itemID ); m_Stream.Write( (ushort)itemID );
m_Stream.Write( (byte)Layer.Hair ); m_Stream.Write( (byte)Layer.Hair );
if( writeHue ) if( writeHue )
@ -3236,7 +3220,7 @@ namespace Server.Network
if( beheld.SolidHueOverride >= 0 ) if( beheld.SolidHueOverride >= 0 )
hue = beheld.SolidHueOverride; hue = beheld.SolidHueOverride;
int itemID = beheld.FacialHairItemID & 0x3FFF; int itemID = beheld.FacialHairItemID & 0x7FFF;
bool writeHue = (hue != 0); bool writeHue = (hue != 0);
@ -3244,7 +3228,7 @@ namespace Server.Network
itemID |= 0x8000; itemID |= 0x8000;
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) ); m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) );
m_Stream.Write( (short)itemID ); m_Stream.Write( (ushort)itemID );
m_Stream.Write( (byte)Layer.FacialHair ); m_Stream.Write( (byte)Layer.FacialHair );
if( writeHue ) if( writeHue )
@ -3309,14 +3293,14 @@ namespace Server.Network
if ( beheld.SolidHueOverride >= 0 ) if ( beheld.SolidHueOverride >= 0 )
hue = beheld.SolidHueOverride; hue = beheld.SolidHueOverride;
int itemID = item.ItemID & 0x3FFF; int itemID = item.ItemID & 0x7FFF;
bool writeHue = ( hue != 0 ); bool writeHue = ( hue != 0 );
if ( writeHue ) if ( writeHue )
itemID |= 0x8000; itemID |= 0x8000;
m_Stream.Write( (int) item.Serial ); m_Stream.Write( (int) item.Serial );
m_Stream.Write( (short) itemID ); m_Stream.Write( (ushort) itemID );
m_Stream.Write( (byte) layer ); m_Stream.Write( (byte) layer );
if ( writeHue ) if ( writeHue )
@ -3334,7 +3318,7 @@ namespace Server.Network
if( beheld.SolidHueOverride >= 0 ) if( beheld.SolidHueOverride >= 0 )
hue = beheld.SolidHueOverride; hue = beheld.SolidHueOverride;
int itemID = beheld.HairItemID & 0x3FFF; int itemID = beheld.HairItemID & 0x7FFF;
bool writeHue = (hue != 0); bool writeHue = (hue != 0);
@ -3342,7 +3326,7 @@ namespace Server.Network
itemID |= 0x8000; itemID |= 0x8000;
m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) ); m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) );
m_Stream.Write( (short)itemID ); m_Stream.Write( (ushort)itemID );
m_Stream.Write( (byte)Layer.Hair ); m_Stream.Write( (byte)Layer.Hair );
if( writeHue ) if( writeHue )
@ -3360,7 +3344,7 @@ namespace Server.Network
if( beheld.SolidHueOverride >= 0 ) if( beheld.SolidHueOverride >= 0 )
hue = beheld.SolidHueOverride; hue = beheld.SolidHueOverride;
int itemID = beheld.FacialHairItemID & 0x3FFF; int itemID = beheld.FacialHairItemID & 0x7FFF;
bool writeHue = (hue != 0); bool writeHue = (hue != 0);
@ -3368,7 +3352,7 @@ namespace Server.Network
itemID |= 0x8000; itemID |= 0x8000;
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) ); m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) );
m_Stream.Write( (short)itemID ); m_Stream.Write( (ushort)itemID );
m_Stream.Write( (byte)Layer.FacialHair ); m_Stream.Write( (byte)Layer.FacialHair );
if( writeHue ) if( writeHue )

View file

@ -34,7 +34,7 @@ namespace Server.Targeting
if ( map != null ) if ( map != null )
{ {
m_Location.Z = map.GetAverageZ( m_Location.X, m_Location.Y ); m_Location.Z = map.GetAverageZ( m_Location.X, m_Location.Y );
m_TileID = map.Tiles.GetLandTile( m_Location.X, m_Location.Y ).ID & 0x3FFF; m_TileID = map.Tiles.GetLandTile( m_Location.X, m_Location.Y ).ID & TileData.MaxLandValue;
} }
} }

View file

@ -30,7 +30,7 @@ namespace Server.Targeting
public StaticTarget( Point3D location, int itemID ) public StaticTarget( Point3D location, int itemID )
{ {
m_Location = location; m_Location = location;
m_ItemID = itemID & 0x3FFF; m_ItemID = itemID & TileData.MaxItemValue;
m_Location.Z += TileData.ItemTable[m_ItemID].CalcHeight; m_Location.Z += TileData.ItemTable[m_ItemID].CalcHeight;
} }

View file

@ -218,6 +218,17 @@ namespace Server
} }
} }
private static int m_MaxLandValue;
private static int m_MaxItemValue;
public static int MaxLandValue {
get { return m_MaxLandValue; }
}
public static int MaxItemValue {
get { return m_MaxItemValue; }
}
private static byte[] m_StringBuffer = new byte[20]; private static byte[] m_StringBuffer = new byte[20];
private static string ReadNameString( BinaryReader bin ) private static string ReadNameString( BinaryReader bin )
@ -344,6 +355,9 @@ namespace Server
} }
} }
} }
m_MaxLandValue = m_LandData.Length - 1;
m_MaxItemValue = m_ItemData.Length - 1;
} }
else else
{ {

View file

@ -24,12 +24,12 @@ namespace Server
{ {
public class TileList public class TileList
{ {
private Tile[] m_Tiles; private StaticTile[] m_Tiles;
private int m_Count; private int m_Count;
public TileList() public TileList()
{ {
m_Tiles = new Tile[8]; m_Tiles = new StaticTile[8];
m_Count = 0; m_Count = 0;
} }
@ -41,12 +41,12 @@ namespace Server
} }
} }
public void AddRange( Tile[] tiles ) public void AddRange( StaticTile[] tiles )
{ {
if ( (m_Count + tiles.Length) > m_Tiles.Length ) if ( (m_Count + tiles.Length) > m_Tiles.Length )
{ {
Tile[] old = m_Tiles; StaticTile[] old = m_Tiles;
m_Tiles = new Tile[(m_Count + tiles.Length) * 2]; m_Tiles = new StaticTile[(m_Count + tiles.Length) * 2];
for ( int i = 0; i < old.Length; ++i ) for ( int i = 0; i < old.Length; ++i )
m_Tiles[i] = old[i]; m_Tiles[i] = old[i];
@ -56,12 +56,12 @@ namespace Server
m_Tiles[m_Count++] = tiles[i]; m_Tiles[m_Count++] = tiles[i];
} }
public void Add( short id, sbyte z ) public void Add( ushort id, sbyte z )
{ {
if ( (m_Count + 1) > m_Tiles.Length ) if ( (m_Count + 1) > m_Tiles.Length )
{ {
Tile[] old = m_Tiles; StaticTile[] old = m_Tiles;
m_Tiles = new Tile[old.Length * 2]; m_Tiles = new StaticTile[old.Length * 2];
for ( int i = 0; i < old.Length; ++i ) for ( int i = 0; i < old.Length; ++i )
m_Tiles[i] = old[i]; m_Tiles[i] = old[i];
@ -72,14 +72,14 @@ namespace Server
++m_Count; ++m_Count;
} }
private static Tile[] m_EmptyTiles = new Tile[0]; private static StaticTile[] m_EmptyTiles = new StaticTile[0];
public Tile[] ToArray() public StaticTile[] ToArray()
{ {
if ( m_Count == 0 ) if ( m_Count == 0 )
return m_EmptyTiles; return m_EmptyTiles;
Tile[] tiles = new Tile[m_Count]; StaticTile[] tiles = new StaticTile[m_Count];
for ( int i = 0; i < m_Count; ++i ) for ( int i = 0; i < m_Count; ++i )
tiles[i] = m_Tiles[i]; tiles[i] = m_Tiles[i];

View file

@ -27,11 +27,11 @@ namespace Server
{ {
public class TileMatrix public class TileMatrix
{ {
private Tile[][][][][] m_StaticTiles; private StaticTile[][][][][] m_StaticTiles;
private Tile[][][] m_LandTiles; private LandTile[][][] m_LandTiles;
private Tile[] m_InvalidLandBlock; private LandTile[] m_InvalidLandBlock;
private Tile[][][] m_EmptyStaticBlock; private StaticTile[][][] m_EmptyStaticBlock;
private FileStream m_Map; private FileStream m_Map;
@ -173,27 +173,27 @@ namespace Server
m_Statics = new FileStream( staticsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ); m_Statics = new FileStream( staticsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
} }
m_EmptyStaticBlock = new Tile[8][][]; m_EmptyStaticBlock = new StaticTile[8][][];
for ( int i = 0; i < 8; ++i ) for ( int i = 0; i < 8; ++i )
{ {
m_EmptyStaticBlock[i] = new Tile[8][]; m_EmptyStaticBlock[i] = new StaticTile[8][];
for ( int j = 0; j < 8; ++j ) for ( int j = 0; j < 8; ++j )
m_EmptyStaticBlock[i][j] = new Tile[0]; m_EmptyStaticBlock[i][j] = new StaticTile[0];
} }
m_InvalidLandBlock = new Tile[196]; m_InvalidLandBlock = new LandTile[196];
m_LandTiles = new Tile[m_BlockWidth][][]; m_LandTiles = new LandTile[m_BlockWidth][][];
m_StaticTiles = new Tile[m_BlockWidth][][][][]; m_StaticTiles = new StaticTile[m_BlockWidth][][][][];
m_StaticPatches = new int[m_BlockWidth][]; m_StaticPatches = new int[m_BlockWidth][];
m_LandPatches = new int[m_BlockWidth][]; m_LandPatches = new int[m_BlockWidth][];
m_Patch = new TileMatrixPatch( this, mapID ); m_Patch = new TileMatrixPatch( this, mapID );
} }
public Tile[][][] EmptyStaticBlock public StaticTile[][][] EmptyStaticBlock
{ {
get get
{ {
@ -201,13 +201,13 @@ namespace Server
} }
} }
public void SetStaticBlock( int x, int y, Tile[][][] value ) public void SetStaticBlock( int x, int y, StaticTile[][][] value )
{ {
if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight ) if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight )
return; return;
if ( m_StaticTiles[x] == null ) if ( m_StaticTiles[x] == null )
m_StaticTiles[x] = new Tile[m_BlockHeight][][][]; m_StaticTiles[x] = new StaticTile[m_BlockHeight][][][];
m_StaticTiles[x][y] = value; m_StaticTiles[x][y] = value;
@ -217,15 +217,15 @@ namespace Server
m_StaticPatches[x][y >> 5] |= 1 << (y & 0x1F); m_StaticPatches[x][y >> 5] |= 1 << (y & 0x1F);
} }
public Tile[][][] GetStaticBlock( int x, int y ) public StaticTile[][][] GetStaticBlock( int x, int y )
{ {
if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight || m_Statics == null || m_Index == null ) if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight || m_Statics == null || m_Index == null )
return m_EmptyStaticBlock; return m_EmptyStaticBlock;
if ( m_StaticTiles[x] == null ) if ( m_StaticTiles[x] == null )
m_StaticTiles[x] = new Tile[m_BlockHeight][][][]; m_StaticTiles[x] = new StaticTile[m_BlockHeight][][][];
Tile[][][] tiles = m_StaticTiles[x][y]; StaticTile[][][] tiles = m_StaticTiles[x][y];
if ( tiles == null ) if ( tiles == null )
{ {
@ -235,7 +235,7 @@ namespace Server
if ( x >= 0 && x < shared.m_BlockWidth && y >= 0 && y < shared.m_BlockHeight ) if ( x >= 0 && x < shared.m_BlockWidth && y >= 0 && y < shared.m_BlockHeight )
{ {
Tile[][][][] theirTiles = shared.m_StaticTiles[x]; StaticTile[][][][] theirTiles = shared.m_StaticTiles[x];
if ( theirTiles != null ) if ( theirTiles != null )
tiles = theirTiles[y]; tiles = theirTiles[y];
@ -259,18 +259,18 @@ namespace Server
return tiles; return tiles;
} }
public Tile[] GetStaticTiles( int x, int y ) public StaticTile[] GetStaticTiles( int x, int y )
{ {
Tile[][][] tiles = GetStaticBlock( x >> 3, y >> 3 ); StaticTile[][][] tiles = GetStaticBlock( x >> 3, y >> 3 );
return tiles[x & 0x7][y & 0x7]; return tiles[x & 0x7][y & 0x7];
} }
private static TileList m_TilesList = new TileList(); private static TileList m_TilesList = new TileList();
public Tile[] GetStaticTiles( int x, int y, bool multis ) public StaticTile[] GetStaticTiles( int x, int y, bool multis )
{ {
Tile[][][] tiles = GetStaticBlock( x >> 3, y >> 3 ); StaticTile[][][] tiles = GetStaticBlock( x >> 3, y >> 3 );
if ( multis ) if ( multis )
{ {
@ -281,7 +281,7 @@ namespace Server
bool any = false; bool any = false;
foreach ( Tile[] multiTiles in eable ) foreach ( StaticTile[] multiTiles in eable )
{ {
if ( !any ) if ( !any )
any = true; any = true;
@ -304,13 +304,13 @@ namespace Server
} }
} }
public void SetLandBlock( int x, int y, Tile[] value ) public void SetLandBlock( int x, int y, LandTile[] value )
{ {
if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight ) if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight )
return; return;
if ( m_LandTiles[x] == null ) if ( m_LandTiles[x] == null )
m_LandTiles[x] = new Tile[m_BlockHeight][]; m_LandTiles[x] = new LandTile[m_BlockHeight][];
m_LandTiles[x][y] = value; m_LandTiles[x][y] = value;
@ -320,15 +320,15 @@ namespace Server
m_LandPatches[x][y >> 5] |= 1 << (y & 0x1F); m_LandPatches[x][y >> 5] |= 1 << (y & 0x1F);
} }
public Tile[] GetLandBlock( int x, int y ) public LandTile[] GetLandBlock( int x, int y )
{ {
if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight || m_Map == null ) if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight || m_Map == null )
return m_InvalidLandBlock; return m_InvalidLandBlock;
if ( m_LandTiles[x] == null ) if ( m_LandTiles[x] == null )
m_LandTiles[x] = new Tile[m_BlockHeight][]; m_LandTiles[x] = new LandTile[m_BlockHeight][];
Tile[] tiles = m_LandTiles[x][y]; LandTile[] tiles = m_LandTiles[x][y];
if ( tiles == null ) if ( tiles == null )
{ {
@ -338,7 +338,7 @@ namespace Server
if ( x >= 0 && x < shared.m_BlockWidth && y >= 0 && y < shared.m_BlockHeight ) if ( x >= 0 && x < shared.m_BlockWidth && y >= 0 && y < shared.m_BlockHeight )
{ {
Tile[][] theirTiles = shared.m_LandTiles[x]; LandTile[][] theirTiles = shared.m_LandTiles[x];
if ( theirTiles != null ) if ( theirTiles != null )
tiles = theirTiles[y]; tiles = theirTiles[y];
@ -362,9 +362,9 @@ namespace Server
return tiles; return tiles;
} }
public Tile GetLandTile( int x, int y ) public LandTile GetLandTile( int x, int y )
{ {
Tile[] tiles = GetLandBlock( x >> 3, y >> 3 ); LandTile[] tiles = GetLandBlock( x >> 3, y >> 3 );
return tiles[((y & 0x7) << 3) + (x & 0x7)]; return tiles[((y & 0x7) << 3) + (x & 0x7)];
} }
@ -373,7 +373,7 @@ namespace Server
private static StaticTile[] m_TileBuffer = new StaticTile[128]; private static StaticTile[] m_TileBuffer = new StaticTile[128];
private unsafe Tile[][][] ReadStaticBlock( int x, int y ) private unsafe StaticTile[][][] ReadStaticBlock( int x, int y )
{ {
try try
{ {
@ -423,15 +423,15 @@ namespace Server
while ( pCur < pEnd ) while ( pCur < pEnd )
{ {
lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (short)((pCur->m_ID & 0x3FFF) + 0x4000), pCur->m_Z ); lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( pCur->m_ID, pCur->m_Z );
pCur = pCur + 1; pCur = pCur + 1;
} }
Tile[][][] tiles = new Tile[8][][]; StaticTile[][][] tiles = new StaticTile[8][][];
for ( int i = 0; i < 8; ++i ) for ( int i = 0; i < 8; ++i )
{ {
tiles[i] = new Tile[8][]; tiles[i] = new StaticTile[8][];
for ( int j = 0; j < 8; ++j ) for ( int j = 0; j < 8; ++j )
tiles[i][j] = lists[i][j].ToArray(); tiles[i][j] = lists[i][j].ToArray();
@ -462,15 +462,15 @@ namespace Server
throw new Exception(); throw new Exception();
} }
private unsafe Tile[] ReadLandBlock( int x, int y ) private unsafe LandTile[] ReadLandBlock( int x, int y )
{ {
try try
{ {
m_Map.Seek( ((x * m_BlockHeight) + y) * 196 + 4, SeekOrigin.Begin ); m_Map.Seek( ((x * m_BlockHeight) + y) * 196 + 4, SeekOrigin.Begin );
Tile[] tiles = new Tile[64]; LandTile[] tiles = new LandTile[64];
fixed ( Tile *pTiles = tiles ) fixed ( LandTile *pTiles = tiles )
{ {
#if !MONO #if !MONO
NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 ); NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
@ -507,65 +507,34 @@ namespace Server
} }
[System.Runtime.InteropServices.StructLayout( System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1 )] [System.Runtime.InteropServices.StructLayout( System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1 )]
public struct StaticTile public struct LandTile
{
public short m_ID;
public byte m_X;
public byte m_Y;
public sbyte m_Z;
public short m_Hue;
}
[System.Runtime.InteropServices.StructLayout( System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1 )]
public struct Tile
{ {
internal short m_ID; internal short m_ID;
internal sbyte m_Z; internal sbyte m_Z;
public int ID public int ID
{ {
get get { return m_ID; }
{
return m_ID;
}
} }
public int Z public int Z
{ {
get get { return m_Z; }
{ set { m_Z = (sbyte)value; }
return m_Z;
}
set
{
m_Z = (sbyte)value;
}
} }
public int Height public int Height
{ {
get get { return 0; }
{
if ( m_ID < 0x4000 )
{
return 0;
}
else
{
return TileData.ItemTable[m_ID & 0x3FFF].Height;
}
}
} }
public bool Ignored public bool Ignored
{ {
get get { return ( m_ID == 2 || m_ID == 0x1DB || ( m_ID >= 0x1AE && m_ID <= 0x1B5 ) ); }
{
return ( m_ID == 2 || m_ID == 0x1DB || ( m_ID >= 0x1AE && m_ID <= 0x1B5 ) );
}
} }
public Tile( short id, sbyte z ) public LandTile( short id, sbyte z )
{ {
m_ID = id; m_ID = id;
m_Z = z; m_Z = z;
@ -577,4 +546,82 @@ namespace Server
m_Z = z; m_Z = z;
} }
} }
[System.Runtime.InteropServices.StructLayout( System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1 )]
public struct StaticTile
{
internal ushort m_ID;
internal byte m_X;
internal byte m_Y;
internal sbyte m_Z;
internal short m_Hue;
public int ID
{
get { return m_ID; }
}
public int X
{
get { return m_X; }
set { m_X = (byte)value; }
}
public int Y
{
get { return m_Y; }
set { m_Y = (byte)value; }
}
public int Z
{
get { return m_Z; }
set { m_Z = (sbyte)value; }
}
public int Hue
{
get { return m_Hue; }
set { m_Hue = (short)value; }
}
public int Height
{
get { return TileData.ItemTable[m_ID & TileData.MaxItemValue].Height; }
}
public StaticTile( ushort id, sbyte z )
{
m_ID = id;
m_Z = z;
m_X = 0;
m_Y = 0;
m_Hue = 0;
}
public StaticTile( ushort id, byte x, byte y, sbyte z, short hue )
{
m_ID = id;
m_X = x;
m_Y = y;
m_Z = z;
m_Hue = hue;
}
public void Set( ushort id, sbyte z )
{
m_ID = id;
m_Z = z;
}
public void Set( ushort id, byte x, byte y, sbyte z, short hue )
{
m_ID = id;
m_X = x;
m_Y = y;
m_Z = z;
m_Hue = hue;
}
}
} }

View file

@ -95,9 +95,9 @@ namespace Server
fsData.Seek( 4, SeekOrigin.Current ); fsData.Seek( 4, SeekOrigin.Current );
Tile[] tiles = new Tile[64]; LandTile[] tiles = new LandTile[64];
fixed ( Tile *pTiles = tiles ) fixed ( LandTile *pTiles = tiles )
{ {
#if !MONO #if !MONO
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 ); NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
@ -177,15 +177,15 @@ namespace Server
while ( pCur < pEnd ) while ( pCur < pEnd )
{ {
lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (short)((pCur->m_ID & 0x3FFF) + 0x4000), pCur->m_Z ); lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (ushort)pCur->m_ID, pCur->m_Z );
pCur = pCur + 1; pCur = pCur + 1;
} }
Tile[][][] tiles = new Tile[8][][]; StaticTile[][][] tiles = new StaticTile[8][][];
for ( int x = 0; x < 8; ++x ) for ( int x = 0; x < 8; ++x )
{ {
tiles[x] = new Tile[8][]; tiles[x] = new StaticTile[8][];
for ( int y = 0; y < 8; ++y ) for ( int y = 0; y < 8; ++y )
tiles[x][y] = lists[x][y].ToArray(); tiles[x][y] = lists[x][y].ToArray();

View file

@ -684,16 +684,18 @@ namespace Server
} }
} }
public static bool CanMobileFit( int z, Tile[] tiles ) /* Should probably be rewritten to use an ITile interface
public static bool CanMobileFit( int z, StaticTile[] tiles )
{ {
int checkHeight = 15; int checkHeight = 15;
int checkZ = z; int checkZ = z;
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
if ( ((checkZ + checkHeight) > tile.Z && checkZ < (tile.Z + tile.Height))/* || (tile.Z < (checkZ + checkHeight) && (tile.Z + tile.Height) > checkZ)*/ ) if ( ((checkZ + checkHeight) > tile.Z && checkZ < (tile.Z + tile.Height))*//* || (tile.Z < (checkZ + checkHeight) && (tile.Z + tile.Height) > checkZ)*//* )
{ {
return false; return false;
} }
@ -706,16 +708,16 @@ namespace Server
return true; return true;
} }
public static bool IsInContact( Tile check, Tile[] tiles ) public static bool IsInContact( StaticTile check, StaticTile[] tiles )
{ {
int checkHeight = check.Height; int checkHeight = check.Height;
int checkZ = check.Z; int checkZ = check.Z;
for ( int i = 0; i < tiles.Length; ++i ) for ( int i = 0; i < tiles.Length; ++i )
{ {
Tile tile = tiles[i]; StaticTile tile = tiles[i];
if ( ((checkZ + checkHeight) > tile.Z && checkZ < (tile.Z + tile.Height))/* || (tile.Z < (checkZ + checkHeight) && (tile.Z + tile.Height) > checkZ)*/ ) if ( ((checkZ + checkHeight) > tile.Z && checkZ < (tile.Z + tile.Height))*//* || (tile.Z < (checkZ + checkHeight) && (tile.Z + tile.Height) > checkZ)*//* )
{ {
return true; return true;
} }
@ -727,6 +729,7 @@ namespace Server
return false; return false;
} }
*/
public static object GetArrayCap( Array array, int index ) public static object GetArrayCap( Array array, int index )
{ {