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> /// Remove a keep from the database /// </summary> /// <param name="area"></param> public virtual void Remove(KeepArea area) { Dictionary <string, GameKeepGuard> guards = new Dictionary <string, GameKeepGuard>(Guards); // Use a shallow copy foreach (GameKeepGuard guard in guards.Values) { guard.Delete(); guard.DeleteFromDatabase(); } Dictionary <string, GameKeepBanner> banners = new Dictionary <string, GameKeepBanner>(Banners); // Use a shallow copy foreach (GameKeepBanner banner in banners.Values) { banner.Delete(); banner.DeleteFromDatabase(); } Dictionary <string, GameKeepDoor> doors = new Dictionary <string, GameKeepDoor>(Doors); // Use a shallow copy foreach (GameKeepDoor door in doors.Values) { door.Delete(); GameDoor d = new GameDoor(); d.CurrentRegionID = door.CurrentRegionID; d.DoorID = door.DoorID; d.Heading = door.Heading; d.Level = door.Level; d.Model = door.Model; d.Name = "door"; d.Realm = door.Realm; d.State = eDoorState.Closed; d.X = door.X; d.Y = door.Y; d.Z = door.Z; DoorMgr.RegisterDoor(door); d.AddToWorld(); } UnloadTimers(); GameEventMgr.RemoveHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit)); if (area != null) { CurrentRegion.RemoveArea(area); } RemoveFromDatabase(); GameServer.KeepManager.Keeps[KeepID] = null; }
private void add(GameClient client, GameDoor targetDoor) { var DOOR = GameServer.Database.SelectObjects <DBDoor>("`InternalID` = @InternalID", new QueryParameter("@InternalID", DoorID)).FirstOrDefault(); 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; } } }
/// <summary> /// Remove a keep from the database /// </summary> /// <param name="area"></param> public virtual void Remove(KeepArea area) { foreach (GameKeepGuard guard in (m_guards.Clone() as Hashtable).Values) { guard.Delete(); guard.DeleteFromDatabase(); } foreach (GameKeepBanner banner in (m_banners.Clone() as Hashtable).Values) { banner.Delete(); banner.DeleteFromDatabase(); } foreach (GameKeepDoor door in (m_doors.Clone() as Hashtable).Values) { door.Delete(); GameDoor d = new GameDoor(); d.CurrentRegionID = door.CurrentRegionID; d.DoorID = door.DoorID; d.Heading = door.Heading; d.Level = door.Level; d.Model = door.Model; d.Name = "door"; d.Realm = door.Realm; d.State = eDoorState.Closed; d.X = door.X; d.Y = door.Y; d.Z = door.Z; DoorMgr.RegisterDoor(door); d.AddToWorld(); } UnloadTimers(); GameEventMgr.RemoveHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit)); if (area != null) { CurrentRegion.RemoveArea(area); } RemoveFromDatabase(); GameServer.KeepManager.Keeps[KeepID] = null; }