• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Keeps.GameKeepComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DOL.GS.Keeps.GameKeepComponent的典型用法代码示例。如果您正苦于以下问题:C# GameKeepComponent类的具体用法?C# GameKeepComponent怎么用?C# GameKeepComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GameKeepComponent类属于DOL.GS.Keeps命名空间,在下文中一共展示了GameKeepComponent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GameKeepHookPoint

		public GameKeepHookPoint(DBKeepHookPoint dbhookPoint, GameKeepComponent component)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			switch (component.ComponentHeading)
			{
				case 0:
					X = (int)(component.X + Math.Cos(angle) * dbhookPoint.X + Math.Sin(angle) * dbhookPoint.Y);
					Y = (int)(component.Y - Math.Cos(angle) * dbhookPoint.Y + Math.Sin(angle) * dbhookPoint.X);
					break;
				case 1:
					X = (int)(component.X + Math.Cos(angle) * dbhookPoint.Y - Math.Sin(angle) * dbhookPoint.X);
					Y = (int)(component.Y + Math.Cos(angle) * dbhookPoint.X + Math.Sin(angle) * dbhookPoint.Y);
					break;
				case 2:
					X = (int)(component.X - Math.Cos(angle) * dbhookPoint.X - Math.Sin(angle) * dbhookPoint.Y);
					Y = (int)(component.Y + Math.Cos(angle) * dbhookPoint.Y - Math.Sin(angle) * dbhookPoint.X);
					break;
				case 3:
					X = (int)(component.X - Math.Cos(angle) * dbhookPoint.Y + Math.Sin(angle) * dbhookPoint.X);
					Y = (int)(component.Y - Math.Cos(angle) * dbhookPoint.X - Math.Sin(angle) * dbhookPoint.Y);
					break;
			}
			this.Z = component.Z + dbhookPoint.Z;
			this.Heading = (ushort)(component.Heading + dbhookPoint.Heading);
			this.m_index = dbhookPoint.HookPointID;
			this.Component = component;
			m_hookpointTimer = new HookpointTimer(this, this.Component);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:28,代码来源:KeepHookPoint.cs


示例2: LoadFromPosition

		public void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component)
		{
			if (component.Keep.DBKeep.BaseLevel < 50)
				return;
			m_component = component;
			PositionMgr.LoadKeepItemPosition(pos, this);
			this.m_component.Keep.TeleportStone = this;
			this.AddToWorld();
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:9,代码来源:FrontiersPortalStone.cs


示例3: LoadXY

		/// <summary>
		/// Calculates X and Y based on component rotation and offset
		/// </summary>
		/// <param name="component">The assigned component object</param>
		/// <param name="inX">The argument X</param>
		/// <param name="inY">The argument Y</param>
		/// <param name="outX">The result X</param>
		/// <param name="outY">The result Y</param>
		public static void LoadXY(GameKeepComponent component, int inX, int inY, out int outX, out int outY)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			double C = Math.Cos(angle);
			double S = Math.Sin(angle);
			switch (component.ComponentHeading)
			{
				case 0:
					{
						outX = (int)(component.X + C * inX + S * inY);
						outY = (int)(component.Y - C * inY + S * inX);
						break;
					}
				case 1:
					{
						outX = (int)(component.X + C * inY - S * inX);
						outY = (int)(component.Y + C * inX + S * inY);
						break;
					}
				case 2:
					{
						outX = (int)(component.X - C * inX - S * inY);
						outY = (int)(component.Y + C * inY - S * inX);
						break;
					}
				case 3:
					{
						outX = (int)(component.X - C * inY + S * inX);
						outY = (int)(component.Y - C * inX - S * inY);
						break;
					}
				default:
					{
						outX = 0;
						outY = 0;
						break;
					}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:47,代码来源:Position+Manager.cs


示例4: SendKeepComponentInfo

        public override void SendKeepComponentInfo(GameKeepComponent keepComponent)
        {
            GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepComponentInfo));

            pak.WriteShort((ushort)keepComponent.Keep.KeepID);
            pak.WriteShort((ushort)keepComponent.ID);
            pak.WriteInt((uint)keepComponent.ObjectID);
            pak.WriteByte((byte)keepComponent.Skin);
            pak.WriteByte((byte)(keepComponent.ComponentX));//relative to keep
            pak.WriteByte((byte)(keepComponent.ComponentY));//relative to keep
            pak.WriteByte((byte)keepComponent.ComponentHeading);
            pak.WriteByte((byte)keepComponent.Height);
            pak.WriteByte(keepComponent.HealthPercent);
            byte flag = keepComponent.Status;
            if (keepComponent.IsRaized) // Only for towers
                flag |= 0x04;
            if (flag == 0x00 && keepComponent.Climbing)
                flag = 0x02;
            pak.WriteByte(flag);
            pak.WriteByte(0x00); //unk
            SendTCP(pak);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:22,代码来源:PacketLib170.cs


示例5: Load


//.........这里部分代码省略.........
                    {
                        if (dum.Skin >= 0 && dum.Skin <= 20) //these are the min/max ids for old keeps.
                            isOld = true;
                        if (dum.Skin > 20) //any skinID greater than this are ids for new keeps.
                            isNew = true;
                    }

                    //Now, consult server properties to decide our plan!

                    //Quote: ServerProperties.cs
                    //"use_new_keeps", "Keeps to load. 0 for Old Keeps, 1 for new keeps, 2 for both.", 2

                    if (ServerProperties.Properties.USE_NEW_KEEPS == 0 && isNew)
                        continue;

                    if (ServerProperties.Properties.USE_NEW_KEEPS == 1 && isOld)
                        continue;

                    //If we've got this far, we are permitted to load as per normal!

					AbstractGameKeep keep;
					if ((datakeep.KeepID >> 8) != 0)
					{
						keep = new GameKeepTower();
					}
					else
					{
						keep = new GameKeep();
					}

					keep.Load(datakeep);
					m_keeps.Add(datakeep.KeepID, keep);
				}

				// This adds owner keeps to towers / portal keeps
				foreach (AbstractGameKeep keep in m_keeps.Values)
				{
					GameKeepTower tower = keep as GameKeepTower;
					if (tower != null)
					{
						int index = tower.KeepID & 0xFF;
						GameKeep ownerKeep = getKeepByID(index) as GameKeep;
						if (ownerKeep != null)
						{
							ownerKeep.AddTower(tower);
						}
						tower.Keep = ownerKeep;
					}
				}

				bool missingKeeps = false;

				var keepcomponents = GameServer.Database.SelectAllObjects<DBKeepComponent>();
				foreach (DBKeepComponent component in keepcomponents)
				{
					// if use old keeps don't try to load new components
					if (ServerProperties.Properties.USE_NEW_KEEPS == 0 && IsNewKeepComponent(component.Skin))
						continue;
					
					// if use new keeps don't try and load old components
					if (ServerProperties.Properties.USE_NEW_KEEPS == 1 && !IsNewKeepComponent(component.Skin))
						continue;

					AbstractGameKeep keep = getKeepByID(component.KeepID);
					if (keep == null)
					{
						missingKeeps = true;
						continue;
					}
					GameKeepComponent gamecomponent = new GameKeepComponent();
					gamecomponent.LoadFromDatabase(component, keep);
					keep.KeepComponents.Add(gamecomponent);
				}

				if (missingKeeps && Logger.IsWarnEnabled)
				{
					Logger.WarnFormat("Some keeps not found while loading components, possibly old/new keeptype; see server properties");
				}

				if (m_keeps.Count != 0)
				{
					foreach (AbstractGameKeep keep in m_keeps.Values)
					{
						if (keep.KeepComponents.Count != 0)
							keep.KeepComponents.Sort();
					}
				}
				LoadHookPoints();

				Logger.Info("Loaded " + m_keeps.Count + " keeps successfully");
			}

			if (ServerProperties.Properties.USE_KEEP_BALANCING)
				UpdateBaseLevels();

			if (ServerProperties.Properties.USE_LIVE_KEEP_BONUSES)
				KeepBonusMgr.UpdateCounts();

			return true;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:KeepManager.cs


示例6: LoadFromPosition

        public virtual void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component)
        {
            m_templateID = pos.TemplateID;
            m_component = component;

            PositionMgr.LoadKeepItemPosition(pos, this);
            component.Keep.Doors[m_templateID] = this;

            m_oldMaxHealth = MaxHealth;
            m_health = MaxHealth;
            m_name = "Keep Door";
            m_oldHealthPercent = HealthPercent;
            m_doorID = GenerateDoorID();
            this.m_model = 0xFFFF;
            m_state = eDoorState.Closed;
            this.AddToWorld();
            StartHealthRegeneration();
            DoorMgr.RegisterDoor(this);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:19,代码来源:GameKeepDoor.cs


示例7: SendKeepComponentInfo

		public virtual void SendKeepComponentInfo(GameKeepComponent keepComponent)
		{
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:3,代码来源:PacketLib168.cs


示例8: LoadFromPosition

		/// <summary>
		/// Load the guard from a position
		/// </summary>
		/// <param name="pos">The position for the guard</param>
		/// <param name="component">The component it is being spawned on</param>
		public void LoadFromPosition(DBKeepPosition pos, GameKeepComponent component)
		{
			m_templateID = pos.TemplateID;
			m_component = component;
			component.AbstractKeep.Guards[m_templateID] = this;
			PositionMgr.LoadGuardPosition(pos, this);
			if (Component != null && Component.AbstractKeep != null)
			{
				Component.AbstractKeep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { this });
			}
			else
			{
				TemplateMgr.RefreshTemplate(this);
			}
			this.AddToWorld();
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:21,代码来源:GameKeepGuard.cs


示例9: IsEnemy

		/// <summary>
		/// Checks if a keep component is an enemy of the player
		/// </summary>
		/// <param name="checker">The component checker</param>
		/// <param name="target">The player target</param>
		/// <returns>true if the player is an enemy of the component</returns>
		public virtual bool IsEnemy(GameKeepComponent checker, GamePlayer target)
		{
			return IsEnemy(checker.AbstractKeep, target);
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:10,代码来源:KeepManager.cs


示例10: SendKeepComponentHookPoint

		public override void SendKeepComponentHookPoint(GameKeepComponent component, int selectedHookPointIndex)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepComponentHookpointUpdate));
			pak.WriteShort((ushort)component.Keep.KeepID);
			pak.WriteShort((ushort)component.ID);
			ArrayList freeHookpoints = new ArrayList();
			foreach (GameKeepHookPoint hookPt in component.HookPoints.Values)
			{
				if (hookPt.IsFree) freeHookpoints.Add(hookPt);
			}
			pak.WriteByte((byte)freeHookpoints.Count);
			pak.WriteByte((byte)selectedHookPointIndex);
			foreach (GameKeepHookPoint hookPt in freeHookpoints)//have to sort by index?
			{
				pak.WriteByte((byte)hookPt.ID);
			}
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:18,代码来源:PacketLib170.cs


示例11: HookpointTimer

		public HookpointTimer(GameKeepHookPoint hookpoint, GameKeepComponent component)
			: base(component)
		{
			m_hookpoint = hookpoint;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:5,代码来源:KeepHookPoint.cs


示例12: CreatePosition

		/// <summary>
		/// Creates a position
		/// </summary>
		/// <param name="templateID">The template ID</param>
		/// <param name="component">The component object</param>
		/// <param name="player">The creating player object</param>
		/// <returns>The position object</returns>
		public static DBKeepPosition CreatePosition(string templateID, GameKeepComponent component, GamePlayer player)
		{
			DBKeepPosition pos = new DBKeepPosition();
			pos.ComponentSkin = component.Skin;
			pos.ComponentRotation = component.ComponentHeading;
			pos.TemplateID = templateID;
			int x, y;

			SaveXY(component, player.X, player.Y, out x, out y);
			pos.XOff = x;
			pos.YOff = y;

			pos.ZOff = player.Z - component.Z;

			pos.HOff = player.Heading - component.Heading;
			return pos;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:24,代码来源:Position+Manager.cs


示例13: CreatePatrolPosition

		/// <summary>
		/// Creates a guard patrol position
		/// </summary>
		/// <param name="guardID">The guard ID</param>
		/// <param name="component">The component object</param>
		/// <param name="player">The player object</param>
		/// <returns>The position object</returns>
		public static DBKeepPosition CreatePatrolPosition(string guardID, GameKeepComponent component, GamePlayer player, AbstractGameKeep.eKeepType keepType)
		{
			DBKeepPosition pos = CreatePosition(guardID, component, player);
			pos.Height = 0;
			pos.ClassType = "DOL.GS.Keeps.Patrol";
			pos.KeepType = (int)keepType;
			GameServer.Database.AddObject(pos);
			return pos;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:16,代码来源:Position+Manager.cs


示例14: SaveXY

		/// <summary>
		/// Saves X and Y offsets
		/// </summary>
		/// <param name="component">The assigned component object</param>
		/// <param name="inX">The argument X</param>
		/// <param name="inY">The argument Y</param>
		/// <param name="outX">The result X</param>
		/// <param name="outY">The result Y</param>
		public static void SaveXY(GameKeepComponent component, int inX, int inY, out int outX, out int outY)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			int gx = inX - component.X;
			int gy = inY - component.Y;
			double C = Math.Cos(angle);
			double S = Math.Sin(angle);
			switch (component.ComponentHeading)
			{
				case 0:
					{
						outX = (int)(gx * C + gy * S);
						outY = (int)(gx * S - gy * C);
						break;
					}
				case 1:
					{
						outX = (int)(gy * C - gx * S);
						outY = (int)(gx * C + gy * S);
						break;
					}
				case 2:
					{
						outX = (int)((gx * C + gy * S) / (-C * C - S * S));
						outY = (int)(gy * C - gx * S);
						break;
					}
				case 3:
					{
						outX = (int)(gx * S - gy * C);
						outY = (int)((gx * C + gy * S) / (-C * C - S * S));
						break;
					}
				default:
					{
						outX = 0;
						outY = 0;
						break;
					}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:49,代码来源:Position+Manager.cs


示例15: SendClearKeepComponentHookPoint

		public virtual void SendClearKeepComponentHookPoint(GameKeepComponent component, int selectedHookPointIndex)
		{
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:3,代码来源:PacketLib168.cs


示例16: SendKeepComponentInteract

		public virtual void SendKeepComponentInteract(GameKeepComponent component)
		{
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:3,代码来源:PacketLib168.cs


示例17: SendKeepComponentDetailUpdate

		public virtual void SendKeepComponentDetailUpdate(GameKeepComponent keepComponent)
		{
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:3,代码来源:PacketLib168.cs


示例18: IsEnemy

		/// <summary>
		/// Checks if a keep component is an enemy of the player
		/// </summary>
		/// <param name="checker">The component checker</param>
		/// <param name="target">The player target</param>
		/// <returns>true if the player is an enemy of the component</returns>
		public static bool IsEnemy(GameKeepComponent checker, GamePlayer target)
		{
			return IsEnemy(checker.Keep, target);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:10,代码来源:KeepManager.cs


示例19: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (args.Length == 1)
			{
				DisplaySyntax(client);
				return;
			}

			AbstractGameKeep myKeep = (AbstractGameKeep)client.Player.TempProperties.getProperty<object>(TEMP_KEEP_LAST, null);
			if (myKeep == null) myKeep = GameServer.KeepManager.GetKeepCloseToSpot(client.Player.CurrentRegionID, client.Player, 10000);
			
			switch (args[1])
			{
				#region FastCreate
				case "fastcreate":
					{
						#region DisplayTemplates
						if (args.Length < 5)
						{
							DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Keep.FastCreate.TypeOfKeep"));
							int i = 1;
							foreach (string str in Enum.GetNames(typeof(eKeepTypes)))
							{
								DisplayMessage(client, "#" + i + ": " + str);
								i++;
							}
							return;
						}
						#endregion DisplayTemplates

						int keepType = 0;
						int keepID = 0;
						string keepName = "New Keep";

						try
						{
							keepType = Convert.ToInt32(args[2]);
							keepID = Convert.ToInt32(args[3]);
							keepName = String.Join(" ", args, 4, args.Length - 4);
						}
						catch
						{
							DisplayMessage(client, "Invalid parameter for Keep Type, Keep ID, or Keep Name");
							return;
						}

						if ((keepID >> 8) != 0 || GameServer.KeepManager.Keeps[keepID] != null)
						{
							DisplayMessage(client, "KeepID must be unused and less than 256.");
							return;
						}

						string createInfo = client.Player.Name + ";" + string.Format("/keep fastcreate {0} {1} {2}", keepType, keepID, keepName);

						GameKeep keep = new GameKeep();
						keep.DBKeep = new DBKeep(createInfo);
						keep.Name = keepName;
						keep.KeepID = keepID;
						keep.Level = (byte)ServerProperties.Properties.STARTING_KEEP_LEVEL;
						keep.BaseLevel = 50;
						keep.Realm = client.Player.Realm;
						keep.Region = client.Player.CurrentRegionID;
						keep.X = client.Player.X;
						keep.Y = client.Player.Y;
						keep.Z = client.Player.Z;
						keep.Heading = client.Player.Heading;

						if ((int)keepType < 8)
						{
							keep.KeepType = (AbstractGameKeep.eKeepType)keepType;
						}
						else
						{
							keep.KeepType = 0;
						}

						log.Debug("Keep creation: starting");

						// TODO: Add keep component to list in keep class

						// SQL to grab current keep components from a DB that works.  Replace keepID with the one you want to edit here.
						// Values below taken from Storm with working old style keeps
						// select concat(ID, ', ', skin, ', ', x, ', ', y, ', ', heading, ', ', height, ', ', health) as keepcomponent from keepcomponent where keepid = ### order by id;


						GameKeepComponent keepComp = null;
						
						switch ((eKeepTypes)keepType)
						{
								#region DunCrauchonBledmeerFasteCaerBenowyc
							case eKeepTypes.DunCrauchonBledmeerFasteCaerBenowyc:
								{
									keepComp = new GameKeepComponent();
									keepComp.LoadFromDatabase(new DBKeepComponent(0, 0, 254, 250, 0, 0, 3200, keep.KeepID, createInfo), keep);
									keep.KeepComponents.Add(keepComp);
									keepComp = new GameKeepComponent();
									keepComp.LoadFromDatabase(new DBKeepComponent(1, 2, 251, 250, 0, 0, 3200, keep.KeepID, createInfo), keep);
									keep.KeepComponents.Add(keepComp);
									keepComp = new GameKeepComponent();
									keepComp.LoadFromDatabase(new DBKeepComponent(2, 1, 4, 250, 0, 0, 3200, keep.KeepID, createInfo), keep);
//.........这里部分代码省略.........
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:101,代码来源:keep.cs


示例20: LoadPatrolPath

		/// <summary>
		/// Method to retrieve the Patrol Path from the Patrol ID and Component
		/// 
		/// We need this because we store this all using our offset system
		/// </summary>
		/// <param name="pathID">The path ID, which is the Patrol ID</param>
		/// <param name="component">The Component object</param>
		/// <returns>The Patrol path</returns>
		public static PathPoint LoadPatrolPath(string pathID, GameKeepComponent component)
		{
			SortedList sorted = new SortedList();
			pathID.Replace('\'', '/'); // we must replace the ', found no other way yet
			DBPath dbpath = GameServer.Database.SelectObject<DBPath>("PathID='" + GameServer.Database.Escape(pathID) + "'");
			IList<DBPathPoint> pathpoints = null;
			ePathType pathType = ePathType.Once;

			if (dbpath != null)
			{
				pathType = (ePathType)dbpath.PathType;
			}
			if (pathpoints == null)
			{
				pathpoints = GameServer.Database.SelectObjects<DBPathPoint>("PathID='" + GameServer.Database.Escape(pathID) + "'");
			}

			foreach (DBPathPoint point in pathpoints)
			{
				sorted.Add(point.Step, point);
			}
			PathPoint prev = null;
			PathPoint first = null;
			for (int i = 0; i < sorted.Count; i++)
			{
				DBPathPoint pp = (DBPathPoint)sorted.GetByIndex(i);
				PathPoint p = new PathPoint(pp.X, pp.Y, pp.Z, pp.MaxSpeed, pathType);

				int x, y;
				LoadXY(component, pp.X, pp.Y, out x, out y);
				p.X = x;
				p.Y = y;
				p.Z = component.AbstractKeep.Z + p.Z;

				p.WaitTime = pp.WaitTime;

				if (first == null)
				{
					first = p;
				}
				p.Prev = prev;
				if (prev != null)
				{
					prev.Next = p;
				}
				prev = p;
			}
			return first;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:57,代码来源:Position+Manager.cs



注:本文中的DOL.GS.Keeps.GameKeepComponent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PacketHandler.GSTCPPacketOut类代码示例发布时间:2022-05-24
下一篇:
C# Keeps.AbstractGameKeep类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap