public void UpdateObject(GameObjectInstance obj) { var session = sessions.Get(obj); var gobj = gameData.GetGameObject(obj.ObjectId); var transform = gameData.GetTransform(gobj.TransformId); foreach (var playerConnection in connectionProvider.GetAllActivePlayerConnections(session)) { playerConnection.Send(ObjectUpdate.Create(obj, transform, gobj.Static), SendOption.Reliable); } }
protected override void Handle(PlayerMoveRequest data, PlayerConnection connection) { if (connection.Player == null) { #if RELEASE logger.LogError($"Move request from {connection.InstanceID}. But has not selected a player."); #endif return; } logger.LogDebug($"Move Request from {connection.Player.Id} from {data.Position} to {data.Destination}"); var player = connection.Player; var transform = gameData.GetTransform(player.TransformId); transform.SetPosition(data.Position); transform.SetDestination(data.Destination); var session = sessionManager.Get(player); // player moves, release any locked objects the player may have. session.Objects.ReleaseLocks(player); // exit combat if we are in one. This will cancel any ongoing attacks. playerState.ExitCombat(player); foreach (var playerConnection in connectionProvider.GetAllActivePlayerConnections(session)) { playerConnection.Send(new PlayerMoveResponse() { PlayerId = player.Id, Destination = data.Destination, Position = data.Position, Running = data.Running }, Shinobytes.Ravenfall.RavenNet.SendOption.Reliable); } }