Example #1
0
            public override void LoadFromDatabase(DBArea area)
            {
                base.LoadFromDatabase(area);

                m_dbBindPoint = new BindPoint();
                m_dbBindPoint.Radius = (ushort)area.Radius;
                m_dbBindPoint.X = area.X;
                m_dbBindPoint.Y = area.Y;
                m_dbBindPoint.Z = area.Z;
                m_dbBindPoint.Region = area.Region;
            }
Example #2
0
		public void ChangeRadius(int newRadius)
		{
			GameServer.KeepManager.Log.Debug("ChangeRadius called for " + Keep.Name + " currently is " + m_Radius + " changing to " + newRadius);

			//setting radius to default
			if (newRadius == 0 && m_Radius != 0)
			{
				if (m_dbArea != null)
					GameServer.Database.DeleteObject(m_dbArea);
				m_Radius = Keep is GameKeep ? (Keep.IsPortalKeep ? PK_RADIUS : KEEP_RADIUS) : TOWER_RADIUS;
				return;
			}

			//setting different radius when radius was already something
			if (newRadius > 0 && m_Radius >= 0)
			{
				m_Radius = newRadius;
				if (m_dbArea != null)
				{
					m_dbArea.Radius = m_Radius;
					GameServer.Database.SaveObject(m_dbArea);
				}
				else
				{
					m_dbArea = new DBArea();
					m_dbArea.CanBroadcast = this.CanBroadcast;
					m_dbArea.CheckLOS = this.CheckLOS;
					m_dbArea.ClassType = this.GetType().ToString();
					m_dbArea.Description = this.Description;
					m_dbArea.Radius = this.Radius;
					m_dbArea.Region = (ushort)this.Keep.Region;
					m_dbArea.Sound = this.Sound;
					m_dbArea.X = this.X;
					m_dbArea.Y = this.Y;
					m_dbArea.Z = this.Z;

					GameServer.Database.AddObject(m_dbArea);
				}
			}
		}
Example #3
0
 public abstract void LoadFromDatabase(DBArea area);
Example #4
0
 public override void LoadFromDatabase(DBArea area)
 {
     m_translationId = area.TranslationId;
     m_Description = area.Description;
     m_X = area.X;
     m_Y = area.Y;
     m_Radius = area.Radius;
     StringPoints = area.Points;
 }
Example #5
0
 public override void LoadFromDatabase(DBArea area)
 {
     m_translationId = area.TranslationId;
     m_Description = area.Description;
     m_X = area.X;
     m_Y = area.Y;
     m_Z = area.Z;
     m_Radius = area.Radius;
     m_RadiusRadius = area.Radius * area.Radius;
 }
Example #6
0
 public override void LoadFromDatabase(DBArea area)
 {
     m_dbArea = area;
     m_translationId = area.TranslationId;
     m_Description = area.Description;
     m_X = area.X;
     m_Y = area.Y;
     m_Width = area.Radius;
     m_Height = area.Radius;
 }
Example #7
0
		public override void LoadFromDatabase(DBArea area)
		{
			base.LoadFromDatabase(area);
			GameServer.KeepManager.Log.Debug("KeepArea " + area.Description + " LoadFromDatabase called");
			GameServer.KeepManager.Log.Debug("X: " + area.X + "(" + m_X + ") Y: " + area.Y + "(" + m_Y + ") Region:" + area.Region + " Radius: " + m_Radius);
		}
Example #8
0
		public void OnCommand(GameClient client, string[] args)
		{
			if (args.Length == 1)
			{
				DisplaySyntax(client);
				return;
			}

			switch (args[1].ToLower())
			{
				#region Create
				case "create":
					{
						if (args.Length != 7)
						{
							DisplaySyntax(client);
							return;
						}

						DBArea area = new DBArea();
						area.Description = args[2];

						switch (args[3].ToLower())
						{
							case "circle": area.ClassType = "DOL.GS.Area+Circle"; break;
							case "square": area.ClassType = "DOL.GS.Area+Square"; break;
							case "safe":
							case "safearea": area.ClassType = "DOL.GS.Area+SafeArea"; break;
							case "bind":
							case "bindarea": area.ClassType = "DOL.GS.Area+BindArea"; break;
							default:
								{
									DisplaySyntax(client);
									return;
								}
						}

						area.Radius = Convert.ToInt16(args[4]);
						switch (args[5].ToLower())
						{
							case "y": { area.CanBroadcast = true; break; }
							case "n": { area.CanBroadcast = false; break; }
							default: { DisplaySyntax(client); return; }
						}
						area.Sound = byte.Parse(args[6]);
						area.Region = client.Player.CurrentRegionID;
						area.X = client.Player.X;
						area.Y = client.Player.Y;
						area.Z = client.Player.Z;

						Assembly gasm = Assembly.GetAssembly(typeof(GameServer));
						AbstractArea newArea = (AbstractArea)gasm.CreateInstance(area.ClassType, false);
						newArea.LoadFromDatabase(area);

						newArea.Sound = area.Sound;
						newArea.CanBroadcast = area.CanBroadcast;
						WorldMgr.GetRegion(client.Player.CurrentRegionID).AddArea(newArea);
						GameServer.Database.AddObject(area);
						DisplayMessage(client, LanguageMgr.GetTranslation(client, "GMCommands.Area.AreaCreated", area.Description, area.X, area.Z, area.Radius, area.CanBroadcast.ToString(), area.Sound));
						break;
					}
				#endregion Create
				#region Default
				default:
					{
						DisplaySyntax(client);
						break;
					}
				#endregion Default
			}
		}