public static bool LoadDoor(DBDoor door) { IDoor mydoor = null; ushort zone = (ushort)(door.InternalID / 1000000); Zone currentZone = WorldMgr.GetZone(zone); if (currentZone == null) return false; //check if the door is a keep door foreach (AbstractArea area in currentZone.GetAreasOfSpot(door.X, door.Y, door.Z)) { if (area is KeepArea) { mydoor = new GameKeepDoor(); mydoor.LoadFromDatabase(door); break; } } //if the door is not a keep door, create a standard door if (mydoor == null) { mydoor = new GameDoor(); mydoor.LoadFromDatabase(door); } //add to the list of doors if (mydoor != null) { RegisterDoor(mydoor); } return true; }
public void AddingDoor(GamePlayer player, byte response) { if (response != 0x01) return; int doorType = m_handlerDoorID / 100000000; if (doorType == 7) { PositionMgr.CreateDoor(m_handlerDoorID, player); } else { var door = new DBDoor(); door.ObjectId = null; door.InternalID = m_handlerDoorID; door.Name = "door"; door.Type = m_handlerDoorID / 100000000; door.Level = 20; door.Realm = 6; door.MaxHealth = 2545; door.Health = 2545; door.Locked = 0; door.X = player.X; door.Y = player.Y; door.Z = player.Z; door.Heading = player.Heading; GameServer.Database.AddObject(door); player.Out.SendMessage("Added door " + m_handlerDoorID + " to the database!", eChatType.CT_Important, eChatLoc.CL_SystemWindow); DoorMgr.Init(); } }
private void add(GameClient client, GameDoor targetDoor) { var DOOR = GameServer.Database.SelectObject<DBDoor>("InternalID = '" + DoorID + "'"); if (DOOR != null) { client.Out.SendMessage("The door is already in the database", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (DOOR == null) { if (doorType != 7 && doorType != 9) { var door = new DBDoor(); door.ObjectId = null; door.InternalID = DoorID; door.Name = "door"; door.Type = DoorID/100000000; door.Level = 20; door.Realm = 6; door.X = targetDoor.X; door.Y = targetDoor.Y; door.Z = targetDoor.Z; door.Heading = targetDoor.Heading; door.Health = 2545; GameServer.Database.AddObject(door); (targetDoor).AddToWorld(); client.Player.Out.SendMessage("Added door ID:" + DoorID + "to the database", eChatType.CT_Important, eChatLoc.CL_SystemWindow); //DoorMgr.Init( ); return; } } }
private void update(GameClient client, GameDoor targetDoor) { delete(client, targetDoor); if (targetDoor != null) { if (doorType != 7 && doorType != 9) { var door = new DBDoor(); door.ObjectId = null; door.InternalID = DoorID; door.Name = "door"; door.Type = DoorID/100000000; door.Level = targetDoor.Level; door.Realm = (byte) targetDoor.Realm; door.Health = targetDoor.Health; door.Locked = targetDoor.Locked; door.X = client.Player.X; door.Y = client.Player.Y; door.Z = client.Player.Z; door.Heading = client.Player.Heading; GameServer.Database.AddObject(door); (targetDoor).AddToWorld(); client.Player.Out.SendMessage("Added door " + DoorID + " to the database", eChatType.CT_Important, eChatLoc.CL_SystemWindow); return; } } }
/// <summary> /// save this door to a door table slot /// </summary> public override void SaveIntoDatabase() { DBDoor obj = null; if (InternalID != null) obj = GameServer.Database.FindObjectByKey<DBDoor>(InternalID); if (obj == null) obj = new DBDoor(); obj.Name = this.Name; obj.InternalID = this.DoorID; obj.Type = DoorID / 100000000; obj.Guild = this.GuildName; obj.Flags = this.Flag; obj.Realm = (byte)this.Realm; obj.Level = this.Level; obj.MaxHealth = this.MaxHealth; obj.Health = this.MaxHealth; obj.Locked = this.Locked; if (InternalID == null) { GameServer.Database.AddObject(obj); InternalID = obj.ObjectId; } else GameServer.Database.SaveObject(obj); }