public void AddFixtures( Mobile from, MultiTileEntry[] list ) { if( m_Fixtures == null ) m_Fixtures = new List<Item>(); uint keyValue = 0; for( int i = 0; i < list.Length; ++i ) { MultiTileEntry mte = list[i]; int itemID = mte.m_ItemID; if( itemID >= 0x181D && itemID < 0x1829 ) { HouseTeleporter tp = new HouseTeleporter( itemID ); AddFixture( tp, mte ); } else { BaseDoor door = null; if( itemID >= 0x675 && itemID < 0x6F5 ) { int type = (itemID - 0x675) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8); switch( type ) { case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break; case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break; case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break; case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break; case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break; case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break; case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break; case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break; } } else if( itemID >= 0x314 && itemID < 0x364 ) { int type = (itemID - 0x314) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8); door = new GenericHouseDoor( facing, 0x314 + ( type * 16 ), 0xED, 0xF4 ); } else if( itemID >= 0x824 && itemID < 0x834 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8); door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 ); } else if( itemID >= 0x839 && itemID < 0x849 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8); door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 ); } else if( itemID >= 0x84C && itemID < 0x85C ) { DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8); door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 ); } else if( itemID >= 0x866 && itemID < 0x876 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8); door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 ); } else if( itemID >= 0xE8 && itemID < 0xF8 ) { DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8); door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 ); } else if( itemID >= 0x1FED && itemID < 0x1FFD ) { DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8); door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 ); } else if( itemID >= 0x241F && itemID < 0x2421 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 ); } else if( itemID >= 0x2423 && itemID < 0x2425 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); //This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 ); } else if( itemID >= 0x2A05 && itemID < 0x2A1D ) { DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8); int sound = (itemID >= 0x2A0D && itemID < 0x2a15) ? 0x539 : -1; door = new GenericHouseDoor( facing, 0x29F5 + (8 * ((itemID - 0x2A05) / 8)), sound, sound ); } else if( itemID == 0x2D46 ) { door = new GenericHouseDoor( DoorFacing.NorthCW, 0x2D46, 0xEA, 0xF1, false ); } else if( itemID == 0x2D48 || itemID == 0x2FE2 ) { door = new GenericHouseDoor( DoorFacing.SouthCCW, itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x2D63 && itemID < 0x2D70 ) { int mod = (itemID - 0x2D63)/2%2; DoorFacing facing = ( ( mod == 0 ) ? DoorFacing.SouthCCW : DoorFacing.WestCCW ); int type = (itemID - 0x2D63) / 4; door = new GenericHouseDoor( facing, 0x2D63 + 4*type + mod*2, 0xEA, 0xF1, false ); } else if( itemID == 0x2FE4 || itemID == 0x31AE ) { door = new GenericHouseDoor( DoorFacing.WestCCW, itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x319C && itemID < 0x31AE ) { //special case for 0x31aa <-> 0x31a8 (a9) int mod = (itemID - 0x319C) / 2 % 2; bool specialCase = (itemID == 0x31AA || itemID == 0x31A8); DoorFacing facing; if ( itemID == 0x31AA || itemID == 0x31A8 ) facing = ((mod == 0) ? DoorFacing.NorthCW : DoorFacing.EastCW); else facing = ((mod == 0) ? DoorFacing.EastCW : DoorFacing.NorthCW); int type = (itemID - 0x319C) / 4; door = new GenericHouseDoor( facing, 0x319C + 4 * type + mod * 2, 0xEA, 0xF1, false ); } else if( itemID >= 0x367B && itemID < 0x369B ) { int type = (itemID - 0x367B) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x367B) / 2) % 8); switch( type ) { case 0: door = new GenericHouseDoor( facing, 0x367B, 0xED, 0xF4 ); break; //crystal case 1: door = new GenericHouseDoor( facing, 0x368B, 0xEC, 0x3E7 ); break; //shadow } } else if( itemID >= 0x409B && itemID < 0x40A3 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x409B ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x410C && itemID < 0x4114 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x410C ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x41C2 && itemID < 0x41CA ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x41C2 ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x41CF && itemID < 0x41D7 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x41CF ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x436E && itemID < 0x437E ) { /* These ones had to be different... * Offset 0 2 4 6 8 10 12 14 * DoorFacing 2 3 2 3 6 7 6 7 */ int offset = itemID - 0x436E; DoorFacing facing = (DoorFacing)( ( offset / 2 + 2 * ( ( 1 + offset / 4 ) % 2 ) ) % 8 ); door = new GenericHouseDoor( facing, itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x46DD && itemID < 0x46E5 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x46DD ), itemID, 0xEB, 0xF2, false ); } else if( itemID >= 0x4D22 && itemID < 0x4D2A ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x4D22 ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x50C8 && itemID < 0x50D0 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x50C8 ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x50D0 && itemID < 0x50D8 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x50D0 ), itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x5142 && itemID < 0x514A ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x5142 ), itemID, 0xF0, 0xEF, false ); } if( door != null ) { if( keyValue == 0 ) keyValue = CreateKeys( from ); door.Locked = true; door.KeyValue = keyValue; AddDoor( door, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); m_Fixtures.Add( door ); } } } for( int i = 0; i < m_Fixtures.Count; ++i ) { Item fixture = m_Fixtures[i]; if( fixture is HouseTeleporter ) { HouseTeleporter tp = (HouseTeleporter)fixture; for( int j = 1; j <= m_Fixtures.Count; ++j ) { HouseTeleporter check = m_Fixtures[(i + j) % m_Fixtures.Count] as HouseTeleporter; if( check != null && check.ItemID == tp.ItemID ) { tp.Target = check; break; } } } else if( fixture is BaseHouseDoor ) { BaseHouseDoor door = (BaseHouseDoor)fixture; if( door.Link != null ) continue; DoorFacing linkFacing; int xOffset, yOffset; switch( door.Facing ) { default: case DoorFacing.WestCW: linkFacing = DoorFacing.EastCCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCCW: linkFacing = DoorFacing.WestCW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestCCW: linkFacing = DoorFacing.EastCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCW: linkFacing = DoorFacing.WestCCW; xOffset = -1; yOffset = 0; break; case DoorFacing.SouthCW: linkFacing = DoorFacing.NorthCCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCCW: linkFacing = DoorFacing.SouthCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthCCW: linkFacing = DoorFacing.NorthCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCW: linkFacing = DoorFacing.SouthCCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthSW: linkFacing = DoorFacing.SouthSE; xOffset = 1; yOffset = 0; break; case DoorFacing.SouthSE: linkFacing = DoorFacing.SouthSW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestSN: linkFacing = DoorFacing.WestSS; xOffset = 0; yOffset = 1; break; case DoorFacing.WestSS: linkFacing = DoorFacing.WestSN; xOffset = 0; yOffset = -1; break; } for( int j = i + 1; j < m_Fixtures.Count; ++j ) { BaseHouseDoor check = m_Fixtures[j] as BaseHouseDoor; if( check != null && check.Link == null && check.Facing == linkFacing && (check.X - door.X) == xOffset && (check.Y - door.Y) == yOffset && (check.Z == door.Z) ) { check.Link = door; door.Link = check; break; } } } } }
public void AddFixtures( Mobile from, MultiTileEntry[] list ) { if ( m_Fixtures == null ) m_Fixtures = new ArrayList(); uint keyValue = 0; for ( int i = 0; i < list.Length; ++i ) { MultiTileEntry mte = list[i]; int itemID = mte.m_ItemID & 0x3FFF; if ( itemID >= 0x181D && itemID < 0x1829 ) { HouseTeleporter tp = new HouseTeleporter( itemID ); AddFixture( tp, mte ); } else { BaseDoor door = null; if ( itemID >= 0x675 && itemID < 0x6F5 ) { int type = (itemID - 0x675) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8); switch ( type ) { case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break; case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break; case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break; case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break; case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break; case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break; case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break; case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break; } } else if ( itemID >= 0x314 && itemID < 0x364 ) { int type = (itemID - 0x314) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8); switch ( type ) { case 0: door = new GenericHouseDoor( facing, 0x314, 0xED, 0xF4 ); break; case 1: door = new GenericHouseDoor( facing, 0x324, 0xED, 0xF4 ); break; case 2: door = new GenericHouseDoor( facing, 0x334, 0xED, 0xF4 ); break; case 3: door = new GenericHouseDoor( facing, 0x344, 0xED, 0xF4 ); break; case 4: door = new GenericHouseDoor( facing, 0x354, 0xED, 0xF4 ); break; } } else if ( itemID >= 0x824 && itemID < 0x834 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8); door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 ); } else if ( itemID >= 0x839 && itemID < 0x849 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8); door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 ); } else if ( itemID >= 0x84C && itemID < 0x85C ) { DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8); door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 ); } else if ( itemID >= 0x866 && itemID < 0x876 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8); door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 ); } else if ( itemID >= 0xE8 && itemID < 0xF8 ) { DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8); door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 ); } else if ( itemID >= 0x1FED && itemID < 0x1FFD ) { DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8); door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 ); } else if ( itemID >= 0x241F && itemID < 0x2421 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 ); } else if ( itemID >= 0x2423 && itemID < 0x2425 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); //This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 ); } else if ( itemID >= 0x2A05 && itemID < 0x2A1D ) { DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8); int sound = ( itemID >= 0x2A0D && itemID < 0x2a15 ) ? 0x539 : -1; door = new GenericHouseDoor( facing, 0x29F5 + (8 * ((itemID - 0x2A05) / 8)), sound, sound ); } if ( door != null ) { if ( keyValue == 0 ) keyValue = CreateKeys( from ); door.Locked = true; door.KeyValue = keyValue; AddDoor( door, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); m_Fixtures.Add( door ); } } } for ( int i = 0; i < m_Fixtures.Count; ++i ) { Item fixture = (Item)m_Fixtures[i]; if ( fixture is HouseTeleporter ) { HouseTeleporter tp = (HouseTeleporter)fixture; for ( int j = 1; j <= m_Fixtures.Count; ++j ) { HouseTeleporter check = m_Fixtures[(i + j) % m_Fixtures.Count] as HouseTeleporter; if ( check != null && check.ItemID == tp.ItemID ) { tp.Target = check; break; } } } else if ( fixture is BaseHouseDoor ) { BaseHouseDoor door = (BaseHouseDoor)fixture; if ( door.Link != null ) continue; DoorFacing linkFacing; int xOffset, yOffset; switch ( door.Facing ) { default: case DoorFacing.WestCW: linkFacing = DoorFacing.EastCCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCCW: linkFacing = DoorFacing.WestCW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestCCW: linkFacing = DoorFacing.EastCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCW: linkFacing = DoorFacing.WestCCW; xOffset = -1; yOffset = 0; break; case DoorFacing.SouthCW: linkFacing = DoorFacing.NorthCCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCCW: linkFacing = DoorFacing.SouthCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthCCW: linkFacing = DoorFacing.NorthCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCW: linkFacing = DoorFacing.SouthCCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthSW: linkFacing = DoorFacing.SouthSE; xOffset = 1; yOffset = 0; break; case DoorFacing.SouthSE: linkFacing = DoorFacing.SouthSW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestSN: linkFacing = DoorFacing.WestSS; xOffset = 0; yOffset = 1; break; case DoorFacing.WestSS: linkFacing = DoorFacing.WestSN; xOffset = 0; yOffset = -1; break; } for ( int j = i + 1; j < m_Fixtures.Count; ++j ) { BaseHouseDoor check = m_Fixtures[j] as BaseHouseDoor; if ( check != null && check.Link == null && check.Facing == linkFacing && (check.X - door.X) == xOffset && (check.Y - door.Y) == yOffset && (check.Z == door.Z) ) { check.Link = door; door.Link = check; break; } } } } }
protected void ConvertDoor(BaseDoor door) { if (!Owned) { return; } if (door is ISecurable) { door.Locked = false; c_House.Doors.Add(door); return; } door.Open = false; var newdoor = new GenericHouseDoor(0, door.ClosedID, door.OpenedSound, door.ClosedSound) { Offset = door.Offset, ClosedID = door.ClosedID, OpenedID = door.OpenedID, Location = door.Location, Map = door.Map }; door.Delete(); foreach ( Item inneritem in newdoor.GetItemsInRange(1) .Where(inneritem => inneritem is BaseDoor && inneritem != newdoor && inneritem.Z == newdoor.Z)) { ((BaseDoor) inneritem).Link = newdoor; newdoor.Link = (BaseDoor) inneritem; } c_House.Doors.Add(newdoor); }
public void AddFixtures( Mobile from, MultiTileEntry[] list ) { if (m_Fixtures == null) m_Fixtures = new List<Item>(); uint keyValue = 0; for ( int i = 0; i < list.Length; ++i ) { MultiTileEntry mte = list[i]; int itemID = mte.m_ItemID & TileData.MaxItemValue; if ( itemID >= 0x181D && itemID < 0x1829 ) { HouseTeleporter tp = new HouseTeleporter( itemID ); AddFixture( tp, mte ); } else { BaseDoor door = null; if ( itemID >= 0x675 && itemID < 0x6F5 ) { int type = ( itemID - 0x675 ) / 16; DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x675 ) / 2 ) % 8 ); switch ( type ) { case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break; case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break; case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break; case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break; case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break; case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break; case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break; case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break; } } else if ( itemID >= 0x314 && itemID < 0x364 ) { int type = ( itemID - 0x314 ) / 16; DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x314 ) / 2 ) % 8 ); switch ( type ) { case 0: door = new GenericHouseDoor( facing, 0x314, 0xED, 0xF4 ); break; case 1: door = new GenericHouseDoor( facing, 0x324, 0xED, 0xF4 ); break; case 2: door = new GenericHouseDoor( facing, 0x334, 0xED, 0xF4 ); break; case 3: door = new GenericHouseDoor( facing, 0x344, 0xED, 0xF4 ); break; case 4: door = new GenericHouseDoor( facing, 0x354, 0xED, 0xF4 ); break; } } else if ( itemID >= 0x824 && itemID < 0x834 ) { DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x824 ) / 2 ) % 8 ); door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 ); } else if ( itemID >= 0x839 && itemID < 0x849 ) { DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x839 ) / 2 ) % 8 ); door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 ); } else if ( itemID >= 0x84C && itemID < 0x85C ) { DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x84C ) / 2 ) % 8 ); door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 ); } else if ( itemID >= 0x866 && itemID < 0x876 ) { DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x866 ) / 2 ) % 8 ); door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 ); } else if ( itemID >= 0xE8 && itemID < 0xF8 ) { DoorFacing facing = (DoorFacing) ( ( ( itemID - 0xE8 ) / 2 ) % 8 ); door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 ); } else if ( itemID >= 0x1FED && itemID < 0x1FFD ) { DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x1FED ) / 2 ) % 8 ); door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 ); } else if ( itemID >= 0x241F && itemID < 0x2421 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 ); } else if ( itemID >= 0x2423 && itemID < 0x2425 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); //This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 ); } else if ( itemID >= 0x2A05 && itemID < 0x2A1D ) { DoorFacing facing = (DoorFacing) ( ( ( ( itemID - 0x2A05 ) / 2 ) % 4 ) + 8 ); int sound = ( itemID >= 0x2A0D && itemID < 0x2a15 ) ? 0x539 : -1; door = new GenericHouseDoor( facing, 0x29F5 + ( 8 * ( ( itemID - 0x2A05 ) / 8 ) ), sound, sound ); } // Mondain's Legacy else if ( itemID == 0x31AE ) door = new GenericHouseDoor( DoorFacing.WestCCW, 0x31AE - ( 2 * (int) DoorFacing.WestCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31AC ) door = new GenericHouseDoor( DoorFacing.EastCW, 0x31AC - ( 2 * (int) DoorFacing.EastCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D48 ) door = new GenericHouseDoor( DoorFacing.SouthCCW, 0x2D48 - ( 2 * (int) DoorFacing.SouthCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D46 ) door = new GenericHouseDoor( DoorFacing.NorthCW, 0x2D46 - ( 2 * (int) DoorFacing.NorthCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D65 ) door = new GenericHouseDoor( DoorFacing.WestCCW, 0x2D65 - ( 2 * (int) DoorFacing.WestCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31A0 ) door = new GenericHouseDoor( DoorFacing.EastCW, 0x31A0 - ( 2 * (int) DoorFacing.EastCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D63 ) door = new GenericHouseDoor( DoorFacing.SouthCCW, 0x2D63 - ( 2 * (int) DoorFacing.SouthCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31A2 ) door = new GenericHouseDoor( DoorFacing.NorthCW, 0x31A2 - ( 2 * (int) DoorFacing.NorthCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D69 ) door = new GenericHouseDoor( DoorFacing.WestCCW, 0x2D69 - ( 2 * (int) DoorFacing.WestCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31A4 ) door = new GenericHouseDoor( DoorFacing.EastCW, 0x31A4 - ( 2 * (int) DoorFacing.EastCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D67 ) door = new GenericHouseDoor( DoorFacing.SouthCCW, 0x2D67 - ( 2 * (int) DoorFacing.SouthCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31A6 ) door = new GenericHouseDoor( DoorFacing.NorthCW, 0x31A6 - ( 2 * (int) DoorFacing.NorthCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D6D ) door = new GenericHouseDoor( DoorFacing.WestCCW, 0x2D6D - ( 2 * (int) DoorFacing.WestCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31AA ) door = new GenericHouseDoor( DoorFacing.EastCW, 0x31AA - ( 2 * (int) DoorFacing.EastCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2D6B ) door = new GenericHouseDoor( DoorFacing.SouthCCW, 0x2D6B - ( 2 * (int) DoorFacing.SouthCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x31A8 ) door = new GenericHouseDoor( DoorFacing.NorthCW, 0x31A8 - ( 2 * (int) DoorFacing.NorthCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2FE4 ) door = new GenericHouseDoor( DoorFacing.WestCCW, 0x2FE4 - ( 2 * (int) DoorFacing.WestCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x319C ) door = new GenericHouseDoor( DoorFacing.EastCW, 0x319C - ( 2 * (int) DoorFacing.EastCW ), 0xEA, 0xF1 ); else if ( itemID == 0x2FE2 ) door = new GenericHouseDoor( DoorFacing.SouthCCW, 0x2FE2 - ( 2 * (int) DoorFacing.SouthCCW ), 0xEA, 0xF1 ); else if ( itemID == 0x319E ) door = new GenericHouseDoor( DoorFacing.NorthCW, 0x319E - ( 2 * (int) DoorFacing.NorthCW ), 0xEA, 0xF1 ); // 9th Anniversary else if ( itemID >= 0x367B && itemID < 0x369B ) { int type = ( itemID - 0x367B ) / 16; DoorFacing facing = (DoorFacing) ( ( ( itemID - 0x367B ) / 2 ) % 8 ); switch ( type ) { case 0: door = new GenericHouseDoor( facing, 0x367B, 0xED, 0xF4 ); break; case 1: door = new GenericHouseDoor( facing, 0x368B, 0xED, 0xF4 ); break; } } // Stygian Abyss else if ( itemID >= 0x409B && itemID <= 0x5148 ) { int baseId = -1; for ( int j = m_SADoorIds.Length - 1; j >= 0; j-- ) { baseId = m_SADoorIds[j]; if ( itemID >= baseId ) break; } int facing = ( ( itemID - baseId ) / 2 ) % 8; if ( itemID >= 0x50C8 && itemID <= 0x50D6 ) // special case { facing = ( facing % 2 ) + ( ( ( facing / 2 ) % 2 != 0 ) ? 6 : 2 ); } else { if ( ( facing / 2 ) % 2 == 0 ) facing += 2; } door = new GenericHouseDoor( (DoorFacing) facing, itemID - ( 2 * facing ), 0xEA, 0xF1 ); } if ( door != null ) { if ( keyValue == 0 ) keyValue = CreateKeys( from ); door.Locked = true; door.KeyValue = keyValue; AddDoor( door, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); m_Fixtures.Add( door ); } } } for ( int i = 0; i < m_Fixtures.Count; ++i ) { Item fixture = (Item) m_Fixtures[i]; if ( fixture is HouseTeleporter ) { HouseTeleporter tp = (HouseTeleporter) fixture; for ( int j = 1; j <= m_Fixtures.Count; ++j ) { HouseTeleporter check = m_Fixtures[( i + j ) % m_Fixtures.Count] as HouseTeleporter; if ( check != null && check.ItemID == tp.ItemID ) { tp.Target = check; break; } } } else if ( fixture is BaseHouseDoor ) { BaseHouseDoor door = (BaseHouseDoor) fixture; if ( door.Link != null ) continue; DoorFacing linkFacing; int xOffset, yOffset; switch ( door.Facing ) { default: case DoorFacing.WestCW: linkFacing = DoorFacing.EastCCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCCW: linkFacing = DoorFacing.WestCW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestCCW: linkFacing = DoorFacing.EastCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCW: linkFacing = DoorFacing.WestCCW; xOffset = -1; yOffset = 0; break; case DoorFacing.SouthCW: linkFacing = DoorFacing.NorthCCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCCW: linkFacing = DoorFacing.SouthCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthCCW: linkFacing = DoorFacing.NorthCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCW: linkFacing = DoorFacing.SouthCCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthSW: linkFacing = DoorFacing.SouthSE; xOffset = 1; yOffset = 0; break; case DoorFacing.SouthSE: linkFacing = DoorFacing.SouthSW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestSN: linkFacing = DoorFacing.WestSS; xOffset = 0; yOffset = 1; break; case DoorFacing.WestSS: linkFacing = DoorFacing.WestSN; xOffset = 0; yOffset = -1; break; } for ( int j = i + 1; j < m_Fixtures.Count; ++j ) { BaseHouseDoor check = m_Fixtures[j] as BaseHouseDoor; if ( check != null && check.Link == null && check.Facing == linkFacing && ( check.X - door.X ) == xOffset && ( check.Y - door.Y ) == yOffset && ( check.Z == door.Z ) ) { check.Link = door; door.Link = check; break; } } } } }
protected void ConvertDoor( BaseDoor door ) { if ( !Owned ) return; if ( door is Server.Gumps.ISecurable ) { Console.WriteLine("Convert Door 1"); door.Locked = false; c_House.Doors.Add( door ); return; } door.Open = false; GenericHouseDoor newdoor = new GenericHouseDoor( (DoorFacing)0, door.ClosedID, door.OpenedSound, door.ClosedSound ); newdoor.Offset = door.Offset; newdoor.ClosedID = door.ClosedID; newdoor.OpenedID = door.OpenedID; newdoor.Location = door.Location; newdoor.Map = door.Map; door.Delete(); foreach( Item inneritem in newdoor.GetItemsInRange( 1 ) ) if ( inneritem is BaseDoor && inneritem != newdoor && inneritem.Z == newdoor.Z ) { ((BaseDoor)inneritem).Link = newdoor; newdoor.Link = (BaseDoor)inneritem; } Console.WriteLine("Convert Door 2"); c_House.Doors.Add(newdoor); }
public void AddFixtures( Mobile from, MultiTileEntry[] list ) { if( m_Fixtures == null ) m_Fixtures = new ArrayList(); uint keyValue = 0; for( int i = 0; i < list.Length; ++i ) { MultiTileEntry mte = list[i]; int itemID = mte.m_ItemID & 0x3FFF; if( itemID >= 0x181D && itemID < 0x1829 ) { HouseTeleporter tp = new HouseTeleporter( itemID ); AddFixture( tp, mte ); } else { BaseDoor door = null; if( itemID >= 0x675 && itemID < 0x6F5 ) { int type = (itemID - 0x675) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8); switch( type ) { case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break; case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break; case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break; case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break; case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break; case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break; case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break; case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break; } } else if( itemID >= 0x314 && itemID < 0x364 ) { int type = (itemID - 0x314) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8); //TODO: Change this to just do a 0x314 + type*16 switch( type ) { case 0: door = new GenericHouseDoor( facing, 0x314, 0xED, 0xF4 ); break; case 1: door = new GenericHouseDoor( facing, 0x324, 0xED, 0xF4 ); break; case 2: door = new GenericHouseDoor( facing, 0x334, 0xED, 0xF4 ); break; case 3: door = new GenericHouseDoor( facing, 0x344, 0xED, 0xF4 ); break; case 4: door = new GenericHouseDoor( facing, 0x354, 0xED, 0xF4 ); break; } } else if( itemID >= 0x824 && itemID < 0x834 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8); door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 ); } else if( itemID >= 0x839 && itemID < 0x849 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8); door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 ); } else if( itemID >= 0x84C && itemID < 0x85C ) { DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8); door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 ); } else if( itemID >= 0x866 && itemID < 0x876 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8); door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 ); } else if( itemID >= 0xE8 && itemID < 0xF8 ) { DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8); door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 ); } else if( itemID >= 0x1FED && itemID < 0x1FFD ) { DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8); door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 ); } else if( itemID >= 0x241F && itemID < 0x2421 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 ); } else if( itemID >= 0x2423 && itemID < 0x2425 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); //This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 ); } else if( itemID >= 0x2A05 && itemID < 0x2A1D ) { DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8); int sound = (itemID >= 0x2A0D && itemID < 0x2a15) ? 0x539 : -1; door = new GenericHouseDoor( facing, 0x29F5 + (8 * ((itemID - 0x2A05) / 8)), sound, sound ); } else if( itemID == 0x2D46 ) { door = new GenericHouseDoor( DoorFacing.NorthCW, 0x2D46, 0xEA, 0xF1, false ); } else if( itemID == 0x2D48 || itemID == 0x2FE2 ) { door = new GenericHouseDoor( DoorFacing.SouthCCW, itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x2D63 && itemID < 0x2D70 ) { int mod = (itemID - 0x2D63)/2%2; DoorFacing facing = ( ( mod == 0 ) ? DoorFacing.SouthCCW : DoorFacing.WestCCW ); int type = (itemID - 0x2D63) / 4; door = new GenericHouseDoor( facing, 0x2D63 + 4*type + mod*2, 0xEA, 0xF1, false ); } else if( itemID == 0x2FE4 || itemID == 0x31AE ) { door = new GenericHouseDoor( DoorFacing.WestCCW, itemID, 0xEA, 0xF1, false ); } else if( itemID >= 0x319C && itemID < 0x31AE ) { //special case for 0x31aa <-> 0x31a8 (a9) int mod = (itemID - 0x319C) / 2 % 2; bool specialCase = (itemID == 0x31AA || itemID == 0x31A8); DoorFacing facing; if ( itemID == 0x31AA || itemID == 0x31A8 ) facing = ((mod == 0) ? DoorFacing.NorthCW : DoorFacing.EastCW); else facing = ((mod == 0) ? DoorFacing.EastCW : DoorFacing.NorthCW); int type = (itemID - 0x319C) / 4; door = new GenericHouseDoor( facing, 0x319C + 4 * type + mod * 2, 0xEA, 0xF1, false ); } /* * ASayre HATE doors. ASayre SMASH WestCCW EastCW SoutCCW NorthCW 0x31AE* 0x31AC 0x2D48* 0x2D46* Elvan Wood Door 0x2d65* 0x31a0 0x2d63* 0x31a2 Elvan White Wooden Door 1 0x2d69* 0x31a4 0x2d67* 0x31a6 Elvan Ornate Door 0x2d6d* 0x31aa 0x2d6b* 0x31a8 Elvan Kia Wood Door 2 0x2fe4* 0x319c 0x2fe2* 0x319e Elvan Moon Door * * */ if( door != null ) { if( keyValue == 0 ) keyValue = CreateKeys( from ); door.Locked = true; door.KeyValue = keyValue; AddDoor( door, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); m_Fixtures.Add( door ); } } } for( int i = 0; i < m_Fixtures.Count; ++i ) { Item fixture = (Item)m_Fixtures[i]; if( fixture is HouseTeleporter ) { HouseTeleporter tp = (HouseTeleporter)fixture; for( int j = 1; j <= m_Fixtures.Count; ++j ) { HouseTeleporter check = m_Fixtures[(i + j) % m_Fixtures.Count] as HouseTeleporter; if( check != null && check.ItemID == tp.ItemID ) { tp.Target = check; break; } } } else if( fixture is BaseHouseDoor ) { BaseHouseDoor door = (BaseHouseDoor)fixture; if( door.Link != null ) continue; DoorFacing linkFacing; int xOffset, yOffset; switch( door.Facing ) { default: case DoorFacing.WestCW: linkFacing = DoorFacing.EastCCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCCW: linkFacing = DoorFacing.WestCW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestCCW: linkFacing = DoorFacing.EastCW; xOffset = 1; yOffset = 0; break; case DoorFacing.EastCW: linkFacing = DoorFacing.WestCCW; xOffset = -1; yOffset = 0; break; case DoorFacing.SouthCW: linkFacing = DoorFacing.NorthCCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCCW: linkFacing = DoorFacing.SouthCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthCCW: linkFacing = DoorFacing.NorthCW; xOffset = 0; yOffset = -1; break; case DoorFacing.NorthCW: linkFacing = DoorFacing.SouthCCW; xOffset = 0; yOffset = 1; break; case DoorFacing.SouthSW: linkFacing = DoorFacing.SouthSE; xOffset = 1; yOffset = 0; break; case DoorFacing.SouthSE: linkFacing = DoorFacing.SouthSW; xOffset = -1; yOffset = 0; break; case DoorFacing.WestSN: linkFacing = DoorFacing.WestSS; xOffset = 0; yOffset = 1; break; case DoorFacing.WestSS: linkFacing = DoorFacing.WestSN; xOffset = 0; yOffset = -1; break; } for( int j = i + 1; j < m_Fixtures.Count; ++j ) { BaseHouseDoor check = m_Fixtures[j] as BaseHouseDoor; if( check != null && check.Link == null && check.Facing == linkFacing && (check.X - door.X) == xOffset && (check.Y - door.Y) == yOffset && (check.Z == door.Z) ) { check.Link = door; door.Link = check; break; } } } } }
private Item GetFixtureItem(int dItemID) { int itemID = (dItemID & 0x3FFF); if (itemID >= 0x181D && itemID < 0x1829) { //Ignore teleporters! //HouseTeleporter tp = new HouseTeleporter(itemID); //AddFixture(tp, mte); } else { BaseDoor door = null; if (itemID >= 0x675 && itemID < 0x6F5) { int type = (itemID - 0x675) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8); switch (type) { case 0: door = new GenericHouseDoor(facing, 0x675, 0xEC, 0xF3); break; case 1: door = new GenericHouseDoor(facing, 0x685, 0xEC, 0xF3); break; case 2: door = new GenericHouseDoor(facing, 0x695, 0xEB, 0xF2); break; case 3: door = new GenericHouseDoor(facing, 0x6A5, 0xEA, 0xF1); break; case 4: door = new GenericHouseDoor(facing, 0x6B5, 0xEA, 0xF1); break; case 5: door = new GenericHouseDoor(facing, 0x6C5, 0xEC, 0xF3); break; case 6: door = new GenericHouseDoor(facing, 0x6D5, 0xEA, 0xF1); break; case 7: door = new GenericHouseDoor(facing, 0x6E5, 0xEA, 0xF1); break; } } else if (itemID >= 0x314 && itemID < 0x364) { int type = (itemID - 0x314) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8); switch (type) { case 0: door = new GenericHouseDoor(facing, 0x314, 0xED, 0xF4); break; case 1: door = new GenericHouseDoor(facing, 0x324, 0xED, 0xF4); break; case 2: door = new GenericHouseDoor(facing, 0x334, 0xED, 0xF4); break; case 3: door = new GenericHouseDoor(facing, 0x344, 0xED, 0xF4); break; case 4: door = new GenericHouseDoor(facing, 0x354, 0xED, 0xF4); break; } } else if (itemID >= 0x824 && itemID < 0x834) { DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8); door = new GenericHouseDoor(facing, 0x824, 0xEC, 0xF3); } else if (itemID >= 0x839 && itemID < 0x849) { DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8); door = new GenericHouseDoor(facing, 0x839, 0xEB, 0xF2); } else if (itemID >= 0x84C && itemID < 0x85C) { DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8); door = new GenericHouseDoor(facing, 0x84C, 0xEC, 0xF3); } else if (itemID >= 0x866 && itemID < 0x876) { DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8); door = new GenericHouseDoor(facing, 0x866, 0xEB, 0xF2); } else if (itemID >= 0xE8 && itemID < 0xF8) { DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8); door = new GenericHouseDoor(facing, 0xE8, 0xED, 0xF4); } else if (itemID >= 0x1FED && itemID < 0x1FFD) { DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8); door = new GenericHouseDoor(facing, 0x1FED, 0xEC, 0xF3); } if (door != null) { return door; } } return null; }//end of GetFixtureItem