当前位置: 首页>>代码示例>>C#>>正文


C# GamePlayer.MoveTo方法代码示例

本文整理汇总了C#中GamePlayer.MoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.MoveTo方法的具体用法?C# GamePlayer.MoveTo怎么用?C# GamePlayer.MoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GamePlayer的用法示例。


在下文中一共展示了GamePlayer.MoveTo方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTeleport

 /// <summary>
 /// Teleport the player to the designated coordinates. 
 /// </summary>
 /// <param name="player"></param>
 /// <param name="destination"></param>
 protected void OnTeleport(GamePlayer player, Teleport destination)
 {
     if (player.InCombat == false && GameRelic.IsPlayerCarryingRelic(player) == false)
     {
         player.LeaveHouse();
         GameLocation currentLocation = new GameLocation("TeleportStart", player.CurrentRegionID, player.X, player.Y, player.Z);
         player.MoveTo((ushort)destination.RegionID, destination.X, destination.Y, destination.Z, (ushort)destination.Heading);
         GameServer.ServerRules.OnPlayerTeleport(player, currentLocation, destination);
     }
 }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:15,代码来源:TeleportArea.cs

示例2: TeleportToDOLTopia

 //This callback function is called when the user responds to our custom
 //"Do you want to be teleported ..."
 public static void TeleportToDOLTopia(GamePlayer player, byte response)
 {
     //If your response is NOT "ok" we just return and don't do anything
     if (response != 0x01)
         return;
     //The player clicked on "OK" so we teleport him!
     player.MoveTo(1, 531405, 479515, 0, 2790);
 }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:10,代码来源:DOLTestServer.cs

示例3: Interact

		/// <summary>
		/// This function is called from the ObjectInteractRequestHandler
		/// It teleport player in the keep if player and keep have the same realm
		/// </summary>
		/// <param name="player">GamePlayer that interacts with this object</param>
		/// <returns>false if interaction is prevented</returns>
		public override bool Interact(GamePlayer player)
		{
			if (!base.Interact(player))
				return false;

			if (player.IsMezzed)
			{
				player.Out.SendMessage("You are mesmerized!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}

			if (player.IsStunned)
			{
				player.Out.SendMessage("You are stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}


			if (GameServer.ServerRules.IsSameRealm(player, this, true) || player.Client.Account.PrivLevel != 1)
			{
                Point2D point;
				//calculate x y
                if ( IsObjectInFront( player, 180, false ) )
                    point = this.GetPointFromHeading( this.Heading, -500 );
                else
                    point = this.GetPointFromHeading( this.Heading, 500 );

				//move player
				player.MoveTo(CurrentRegionID, point.X, point.Y, player.Z, player.Heading);
			}
			return base.Interact(player);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:38,代码来源:GameRelicDoor.cs

示例4: RiderMount

		/// <summary>
		/// This function is called when a rider mounts this npc
		/// Since only players can ride NPC's you should use the
		/// GamePlayer.MountSteed function instead to make sure all
		/// callbacks are called correctly
		/// </summary>
		/// <param name="rider">GamePlayer that is the rider</param>
		/// <param name="forced">if true, mounting can't be prevented by handlers</param>
		/// <returns>true if mounted successfully</returns>
		public virtual bool RiderMount(GamePlayer rider, bool forced)
		{
			int exists = RiderArrayLocation(rider);
			if (exists != -1)
				return false;

			rider.MoveTo(CurrentRegionID, X, Y, Z, Heading);

			Notify(GameNPCEvent.RiderMount, this, new RiderMountEventArgs(rider, this));
			int slot = GetFreeArrayLocation();
			Riders[slot] = rider;
			rider.Steed = this;
			return true;
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:23,代码来源:GameNPC.cs

示例5: ExitBattleground

		public virtual void ExitBattleground(GamePlayer player)
		{
			string location = "";
			switch (player.Realm)
			{
				case eRealm.Albion: location = "Castle Sauvage"; break;
				case eRealm.Midgard: location = "Svasudheim Faste"; break;
				case eRealm.Hibernia: location = "Druim Ligen"; break;
			}

			if (location != "")
			{
				Teleport t = GameServer.Database.SelectObjects<Teleport>("`TeleportID` = @TeleportID", new QueryParameter("@TeleportID", location)).FirstOrDefault();
				if (t != null)
					player.MoveTo((ushort)t.RegionID, t.X, t.Y, t.Z, (ushort)t.Heading);
			}
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:17,代码来源:KeepManager.cs

示例6: Exit

		/// <summary>
		/// Used to leave a house
		/// </summary>
		/// <param name="player">the player who wants to get in</param>
		/// <param name="silent">text or not</param>
		public void Exit(GamePlayer player, bool silent)
		{
			player.MoveTo(OutdoorJumpPoint);

			if (!silent)
			{
				ChatUtil.SendSystemMessage(player, "House.Exit.LeftHouse", HouseNumber);
			}

			player.Out.SendExitHouse(this);

			IList<GamePlayer> list = GetAllPlayersInHouse();
			if (list.Count == 0)
			{
				foreach (GamePlayer pl in player.GetPlayersInRadius(HousingConstants.HouseViewingDistance))
				{
					pl.Out.SendHouseOccupied(this, false);
				}
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:25,代码来源:House.cs

示例7: Enter

		/// <summary>
		/// Used to get into a house
		/// </summary>
		/// <param name="player">the player who wants to get in</param>
		public void Enter(GamePlayer player)
		{
			IList<GamePlayer> list = GetAllPlayersInHouse();
			if (list.Count == 0)
			{
				foreach (GamePlayer pl in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					pl.Out.SendHouseOccupied(this, true);
				}
			}

			ChatUtil.SendSystemMessage(player, "House.Enter.EnteringHouse", HouseNumber);
			player.Out.SendEnterHouse(this);
			player.Out.SendFurniture(this);

			player.InHouse = true;
			player.CurrentHouse = this;

			ushort heading = 0;

			switch (Model)
			{
					//thx to sp4m
				default:
					player.MoveTo(RegionID, X, Y, 25022, heading);
					break;

				case 1:
					player.MoveTo(RegionID, X + 80, Y + 100, ((25025)), heading);
					break;

				case 2:
					player.MoveTo(RegionID, X - 260, Y + 100, ((24910)), heading);
					break;

				case 3:
					player.MoveTo(RegionID, X - 200, Y + 100, ((24800)), heading);
					break;

				case 4:
					player.MoveTo(RegionID, X - 350, Y - 30, ((24660)), heading);
					break;

				case 5:
					player.MoveTo(RegionID, X + 230, Y - 480, ((25100)), heading);
					break;

				case 6:
					player.MoveTo(RegionID, X - 80, Y - 660, ((24700)), heading);
					break;

				case 7:
					player.MoveTo(RegionID, X - 80, Y - 660, ((24700)), heading);
					break;

				case 8:
					player.MoveTo(RegionID, X - 90, Y - 625, ((24670)), heading);
					break;

				case 9:
					player.MoveTo(RegionID, X + 400, Y - 160, ((25150)), heading);
					break;

				case 10:
					player.MoveTo(RegionID, X + 400, Y - 80, ((25060)), heading);
					break;

				case 11:
					player.MoveTo(RegionID, X + 400, Y - 60, ((24900)), heading);
					break;

				case 12:
					player.MoveTo(RegionID, X, Y - 620, ((24595)), heading);
					break;
			}

			ChatUtil.SendSystemMessage(player, "House.Enter.EnteredHouse", HouseNumber);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:82,代码来源:House.cs

示例8: ExitBattleground

		public static void ExitBattleground(GamePlayer player)
		{
			string location = "";
			switch (player.Realm)
			{
				case eRealm.Albion: location = "Castle Sauvage"; break;
				case eRealm.Midgard: location = "Svasudheim Faste"; break;
				case eRealm.Hibernia: location = "Druim Ligen"; break;
			}

			if (location != "")
			{
				Teleport t = GameServer.Database.SelectObject<Teleport>("`TeleportID` = '" + location + "'");
				if (t != null)
					player.MoveTo((ushort)t.RegionID, t.X, t.Y, t.Z, (ushort)t.Heading);
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:17,代码来源:KeepManager.cs

示例9: Interact

        /// <summary>
        /// This function is called from the ObjectInteractRequestHandler
        /// It teleport player in the keep if player and keep have the same realm
        /// </summary>
        /// <param name="player">GamePlayer that interacts with this object</param>
        /// <returns>false if interaction is prevented</returns>
        public override bool Interact(GamePlayer player)
        {
            if (!base.Interact(player))
                return false;

            if (player.IsMezzed)
            {
                player.Out.SendMessage("You are mesmerized!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return false;
            }

            if (player.IsStunned)
            {
                player.Out.SendMessage("You are stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return false;
            }

            if (!GameServer.KeepManager.IsEnemy(this, player) || player.Client.Account.PrivLevel != 1)
            {
                int keepz = Z, distance = 0;

                //calculate distance
                //normal door
                if (DoorIndex == 1)
                    distance = 150;
                //side or internal door
                else
                    distance = 100;

                //calculate Z
                if (this.Component.Keep is GameKeepTower && !this.Component.Keep.IsPortalKeep)
                {
                    //when entering a tower, we need to raise Z
                    //portal keeps are considered towers too, so we check component count
                    if (IsObjectInFront(player, 180, false) && DoorIndex == 1)
                    {
                        keepz = Z + 83;
                    }
                }
                else
                {
                    //when entering a keeps inner door, we need to raise Z
                    if (IsObjectInFront(player, 180, false))
                    {
                        //To find out if a door is the keeps inner door, we compare the distance between
                        //the component for the keep and the component for the gate
                        int keepdistance = int.MaxValue;
                        int gatedistance = int.MaxValue;
                        foreach (GameKeepComponent c in this.Component.Keep.KeepComponents)
                        {
                            if ((GameKeepComponent.eComponentSkin)c.Skin == GameKeepComponent.eComponentSkin.Keep)
                            {
                                keepdistance = GetDistanceTo(c);
                            }
                            if ((GameKeepComponent.eComponentSkin)c.Skin == GameKeepComponent.eComponentSkin.Gate)
                            {
                                gatedistance = GetDistanceTo(c);
                            }
                            //when these are filled we can stop the search
                            if (keepdistance != int.MaxValue && gatedistance != int.MaxValue)
                                break;
                        }
                        if (DoorIndex == 1 && keepdistance < gatedistance)
                            keepz = Z + 92;//checked in game with lvl 1 keep
                    }
                }

                Point2D keepPoint;
                //calculate x y
                if (IsObjectInFront(player, 180, false))
                    keepPoint = GetPointFromHeading(this.Heading, -distance);
                else
                    keepPoint = GetPointFromHeading(this.Heading, distance);

                //move player
                player.MoveTo(CurrentRegionID, keepPoint.X, keepPoint.Y, keepz, player.Heading);
            }
            return base.Interact(player);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:85,代码来源:GameKeepDoor.cs

示例10: SendMessageAndMoveToSafeLocation

			private static void SendMessageAndMoveToSafeLocation(GamePlayer player)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "PlayerInitRequestHandler.SaferLocation"),
				                       eChatType.CT_System, eChatLoc.CL_SystemWindow);
				player.MoveTo((ushort) player.DBCharacter.BindRegion, player.DBCharacter.BindXpos,
				              player.DBCharacter.BindYpos, player.DBCharacter.BindZpos,
				              (ushort) player.DBCharacter.BindHeading);
			}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:8,代码来源:PlayerInitRequestHandler.cs

示例11: CheckBGLevelCapForPlayerAndMoveIfNecessary

			private static void CheckBGLevelCapForPlayerAndMoveIfNecessary(GamePlayer player)
			{
				if (player.Client.Account.PrivLevel == 1 && player.CurrentRegion.IsRvR && player.CurrentRegionID != 163)
				{
					ICollection<AbstractGameKeep> list = KeepMgr.GetKeepsOfRegion(player.CurrentRegionID);


					foreach (AbstractGameKeep k in list)
					{
						if (k.BaseLevel >= 50)
							continue;

						if (player.Level > k.BaseLevel)
						{
							player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "PlayerInitRequestHandler.LevelCap"),
							                       eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
							player.MoveTo((ushort) player.DBCharacter.BindRegion, player.DBCharacter.BindXpos,
							              player.DBCharacter.BindYpos, player.DBCharacter.BindZpos,
							              (ushort) player.DBCharacter.BindHeading);
							break;
						}
					}
				}
			}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:24,代码来源:PlayerInitRequestHandler.cs

示例12: ResurrectLiving

		public void ResurrectLiving(GamePlayer resurrectedPlayer, GameLiving rezzer)
		{
			if (rezzer.ObjectState != GameObject.eObjectState.Active)
				return;
			if (rezzer.CurrentRegionID != resurrectedPlayer.CurrentRegionID)
				return;
			resurrectedPlayer.Health = (int)(resurrectedPlayer.MaxHealth * m_resurrectValue / 100);
			resurrectedPlayer.Mana = (int)(resurrectedPlayer.MaxMana * m_resurrectValue / 100);
			resurrectedPlayer.Endurance = (int)(resurrectedPlayer.MaxEndurance * m_resurrectValue / 100); //no endurance after any rez
			resurrectedPlayer.MoveTo(rezzer.CurrentRegionID, rezzer.X, rezzer.Y, rezzer.Z, rezzer.Heading);

            GameLiving living = resurrectedPlayer as GameLiving;
            GameTimer resurrectExpiredTimer = null;
            lock (m_resTimersByLiving.SyncRoot)
            {
                resurrectExpiredTimer = (GameTimer)m_resTimersByLiving[living];
                m_resTimersByLiving.Remove(living);
            }
            if (resurrectExpiredTimer != null)
            {
                resurrectExpiredTimer.Stop();
            }

            resurrectedPlayer.StopReleaseTimer();
			resurrectedPlayer.Out.SendPlayerRevive(resurrectedPlayer);
			resurrectedPlayer.UpdatePlayerStatus();

			GameSpellEffect effect = SpellHandler.FindEffectOnTarget(resurrectedPlayer, GlobalSpells.PvERessurectionIllnessSpellType);
			if (effect != null)
				effect.Cancel(false);
			resurrectedPlayer.Out.SendMessage("You have been resurrected by " + rezzer.GetName(0, false) + "!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            //Lifeflight: this should make it so players who have been ressurected don't take damage for 5 seconds
            RezDmgImmunityEffect rezImmune = new RezDmgImmunityEffect();
            rezImmune.Start(resurrectedPlayer);

            //Lifeflight: We need to reward rez RPs
            GamePlayer casterPlayer = rezzer as GamePlayer;
            if (casterPlayer != null)
            {
                long rezRps = resurrectedPlayer.LastDeathRealmPoints * (m_resurrectValue + 50) / 1000;
                if (rezRps > 0)
                {
                    casterPlayer.GainRealmPoints(rezRps);
                }
                else
                {
                    casterPlayer.Out.SendMessage("The player you resurrected was not worth realm points on death.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                    casterPlayer.Out.SendMessage("You thus get no realm points for the resurrect.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
            }

        }
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:52,代码来源:PerfectRecoveryAbility.cs

示例13: OnTeleport

 /// <summary>
 /// Teleport the player to the designated coordinates.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="destination"></param>
 protected virtual void OnTeleport(GamePlayer player, Teleport destination)
 {
     if (player.InCombat == false && GameRelic.IsPlayerCarryingRelic(player) == false)
     {
         player.LeaveHouse();
         player.MoveTo((ushort)destination.RegionID, destination.X, destination.Y, destination.Z, (ushort)destination.Heading);
     }
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:13,代码来源:GameTeleporter.cs

示例14: IsAllowedToJump


//.........这里部分代码省略.........

                }

            }

               if(previousInstance == null)
               {
                // I have no instance to go to, create one !
                previousInstance = (AdventureWingInstance)WorldMgr.CreateInstance(targetPoint.TargetRegion, typeof(AdventureWingInstance));
                if(targetPoint.SourceRegion != 0 && targetPoint.SourceRegion == player.CurrentRegionID) {
                    //source loc seems legit...
                    previousInstance.SourceEntrance = new GameLocation("source", targetPoint.SourceRegion, targetPoint.SourceX, targetPoint.SourceY, targetPoint.SourceZ);
                }

                if(player.Group != null)
                {
                    previousInstance.Group = player.Group;
                    previousInstance.Player = player.Group.Leader;
                }
                else
                {
               			previousInstance.Group = null;
                    previousInstance.Player = player;
                }

                //get region data
                long mobs = 0;
                long merchants = 0;
                long items = 0;
                long bindpoints = 0;

                previousInstance.LoadFromDatabase(previousInstance.RegionData.Mobs, ref mobs, ref merchants, ref items, ref bindpoints);

                if (log.IsInfoEnabled)
                {
                    log.Info("Total Mobs: " + mobs);
                    log.Info("Total Merchants: " + merchants);
                    log.Info("Total Items: " + items);
                }

                //Attach Loot Generator
                LootMgr.RegisterLootGenerator(new LootGeneratorAurulite(), null, null, null, previousInstance.ID);

                // Player created new instance
                // Destroy all other instance that should be...
                List<Region> to_delete = new List<Region>();
                foreach(Region region in WorldMgr.GetAllRegions())
                {
                    if (region is AdventureWingInstance && (AdventureWingInstance)region != previousInstance)
                    {
                        AdventureWingInstance to_clean = (AdventureWingInstance)region;

               				// Won't clean up populated Instance
                        if(to_clean.NumPlayers == 0)
                        {

                            if(to_clean.Group != null && player.Group != null && to_clean.Group == player.Group)
                            {
                                // Got another instance for the same group... Destroy it !
                                to_delete.Add(to_clean);
                            }
                            else if(to_clean.Player != null && (to_clean.Player == player || (player.Group != null && player.Group.Leader == to_clean.Player)))
                            {
                                // Got another instance for the same player... Destroy it !
                                to_delete.Add(to_clean);
                            }
                            else if(to_clean.Group == null && to_clean.Player == null)
                            {
                                //nobody owns this instance anymore
                                to_delete.Add(to_clean);
                            }
                        }
                    }
                }

                //enumerate to_delete
                foreach(Region region in to_delete)
                {
                    log.Warn("Player : "+ player.Name +" has provoked an instance cleanup - " + region.Description + ", ID: " + region.ID + ", type=" + region.GetType().ToString() + ".");
                    WorldMgr.RemoveInstance((BaseInstance)region);
                }
               	}

            //get loc of instance
            if(previousInstance != null)
            {
                loc = new GameLocation(previousInstance.Description + " (instance)", previousInstance.ID, targetPoint.TargetX,  targetPoint.TargetY,  targetPoint.TargetZ,  targetPoint.TargetHeading);
            }

            if (loc != null)
            {

                // Move Player, changing target destination is failing !!
                player.MoveTo(loc);
                return false;
            }

            player.Out.SendMessage("Something went Wrong when creating Instance !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            return false;
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:AdventureWingJumpPoint.cs


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