public void HandleChangeMapMessage(Bot bot, ChangeMapMessage message) { MapPositionData mapPosition = MapsPositionManager.Instance.GetMapPosition(message.mapId); if (m_lastPath != null && m_lastMapPos != null) { MapNeighbour direction = Map.GetDirectionOfTransitionCell(m_lastPath.End); int? neighbour = m_lastMapPos.GetNeighbourId(direction); if (neighbour == null) { bot.Character.SendWarning("The actual map ({0}) is not the {1} neighbour of the previous map {2} (NOT FOUND)", message.mapId, direction, m_lastMapPos.MapId); } else if (neighbour != message.mapId) { bot.Character.SendWarning("The actual map ({0}) is not the {1} neighbour of the previous map {2}" + "(MISMATCH attempt : {3})", message.mapId, direction, m_lastMapPos.MapId, neighbour); } else { bot.Character.SendDebug("You came from {0}", direction); } } m_lastMapPos = mapPosition; }
public void ChangeMapMessageFrame(WorldClient client, ChangeMapMessage changeMapMessage) { int mapId = (int)changeMapMessage.mapId; MapTransition replacedMap = MapTransitionsRepository.Instance.GetTransitionFromMapId((int)changeMapMessage.mapId, (int)MapManager.Instance.GetMapNeighbourTransitionEnumFromCell(client.ActiveCharacter.CellId)); if (replacedMap != null) { mapId = replacedMap.MapIdReplaced; } if (!MapManager.Instance.CheckIfNextMapIsValid(client.ActiveCharacter.MapId, mapId, client.ActiveCharacter.CellId)) { return; } var oldMap = MapManager.Instance.GetMap(client.ActiveCharacter.MapId); var map = MapManager.Instance.GetMap(mapId); if (map != null) { oldMap.ExitMap(client); client.SendPacket(new GameContextDestroyMessage()); client.SendPacket(new GameContextCreateMessage(1)); client.ActiveCharacter.MapId = mapId; client.SendPacket(new CurrentMapMessage(client.ActiveCharacter.MapId, "649ae451ca33ec53bbcbcc33becf15f4")); client.ActiveCharacter.CellId = MapManager.Instance.CheckWalkableCell(map, MapManager.Instance.GetOppositeCellFromNeight(client.ActiveCharacter.CellId)); CharacterRepository.Instance.Update(client.ActiveCharacter); } }
private void ChangeMap(DirectionsEnum direction, Map map) { ChangeMapMessage message = new ChangeMapMessage(); switch (direction) { case DirectionsEnum.DIRECTION_EAST: message = new ChangeMapMessage(map.RightNeighbourId); break; case DirectionsEnum.DIRECTION_NORTH: message = new ChangeMapMessage(map.TopNeighbourId); break; case DirectionsEnum.DIRECTION_SOUTH: message = new ChangeMapMessage(map.BottomNeighbourId); break; case DirectionsEnum.DIRECTION_WEST: message = new ChangeMapMessage(map.LeftNeighbourId); break; } mHost.SendMessage(message); }
/** * Change map movement */ public async Task ChangeMap(GameClient client, ChangeMapMessage changeMapMessage) { var map = await this.GetMapById(client.Character.MapId); Map mapDestination = null; if (map == null) { client.Disconnect(); return; } var cellChangeMap = map.CellChangeMaps.FirstOrDefault(x => x.cellId == client.Character.CellId && x.orientation != OrientationEnum.NONE); if (cellChangeMap == null) { return; } //find map destination from orientation switch ((OrientationEnum)cellChangeMap.orientation) { case OrientationEnum.TOP: mapDestination = this.GetMapById(map.TopNeighbourId).Result; break; case OrientationEnum.LEFT: mapDestination = this.GetMapById(map.LeftNeighbourId).Result; break; case OrientationEnum.RIGHT: mapDestination = this.GetMapById(map.RightNeighbourId).Result; break; case OrientationEnum.BOTTOM: mapDestination = this.GetMapById(map.BottomNeighbourId).Result; break; } if (mapDestination == null) { client.Disconnect(); return; } Leave(client.Character); client.Character.MapId = mapDestination.Id; client.Character.CellId = this._pathfinderManager.GetOppositeCellId(mapDestination, client.Character.CellId); client.Send(new CurrentMapMessage(client.Character.MapId, "649ae451ca33ec53bbcbcc33becf15f4")); map.Characters.Remove(client.Character.Id, out Character removedCharacter); mapDestination.Characters.TryAdd(client.Character.Id, client.Character); //update this._characterRepository.UpdateEntity(client.Character.Id, client.Character); Enter(client.Character); }
public void LaunchChangeMap(int mapId) { var msg = new ChangeMapMessage(mapId); _client.Send(msg); _time = 0; _mapId = -1; Task.Factory.StartNew(CheckMapChange); }
public static void HandleChangeMapMessage(WorldClient client, ChangeMapMessage message) { MapNeighbour clientMapRelativePosition = client.Character.Map.GetClientMapRelativePosition(message.mapId); if (clientMapRelativePosition != MapNeighbour.None && client.Character.Position.Cell.MapChangeData != 0) { client.Character.Teleport(clientMapRelativePosition); } }
public static void HandleChangeMapMessage(WorldClient client, ChangeMapMessage message) { var neighbourState = client.Character.Map.GetClientMapRelativePosition(message.mapId); // todo : check with MapChangeData the neighbour validity if (neighbourState != MapNeighbour.None && client.Character.Position.Cell.MapChangeData != 0) { client.Character.Teleport(neighbourState); } }
public void HandleChangeMapMessage(Bot bot, ChangeMapMessage message) { if (Character.Id == PartyLeaderId) // I'm the leader => ask all other characters to follow me on the new map { LastLeaderCell = Character.Cell.Id; // Select all ffight plugins within the party int previousmapId = Character.Map.Id; foreach (FFight ffight in GetOtherFFights(true, true)) { ffight.ComeOnMyMap(previousmapId, LastLeaderCell, message.mapId); } } }
public void LaunchChangeMap(int mapId) { //if (AutoTimeout) // m_Account.Game.Character.State.SetTimeout(StateEnum.Context, false, TimeoutMin, TimeoutMax); using (BigEndianWriter writer = new BigEndianWriter()) { ChangeMapMessage msg = new ChangeMapMessage(mapId); msg.Serialize(writer); MessagePackaging pack = new MessagePackaging(writer); pack.Pack((int)msg.ProtocolID); m_Account.SocketManager.Send(pack.Writer.Content); } }
public AbstractMessage Parse(string input) { Regex regex = new Regex(pattern); if (regex.IsMatch(input)) { ChangeMapMessage abstractMessage = new ChangeMapMessage(); var match = regex.Match(input); abstractMessage.Type = match.Groups["type"].Value; abstractMessage.Map = match.Groups["map"].Value; return(abstractMessage); } return(null); }
public void LaunchChangeMap(int mapId) { if (m_Account.Path != null) { m_Account.Path.ClearStack(); } m_MapId = -1; ChangeMapMessage msg = new ChangeMapMessage(mapId); m_Account.SetStatus(Status.Busy); m_Account.SocketManager.Send(msg); Thread t = new Thread(new ThreadStart(CheckMapChange)); t.Start(); }
public static void HandleChangeMapMessage(Client client, ChangeMapMessage message) { short cell = client.Character.CellId; if (client.Character.Map.TopNeighbourId == message.mapId) { cell += 532; } if (client.Character.Map.BottomNeighbourId == message.mapId) { cell -= 532; } if (client.Character.Map.LeftNeighbourId == message.mapId) { cell += 13; } if (client.Character.Map.RightNeighbourId == message.mapId) { cell -= 13; } client.Character.Teleport(message.mapId, cell); }
public static void ChangeMapMessage(ChangeMapMessage message, WorldClient client) { MapScrollEnum scrollType = MapScrollEnum.UNDEFINED; if (client.Character.Map.LeftMap == message.mapId) { scrollType = MapScrollEnum.Left; } if (client.Character.Map.RightMap == message.mapId) { scrollType = MapScrollEnum.Right; } if (client.Character.Map.DownMap == message.mapId) { scrollType = MapScrollEnum.Bottom; } if (client.Character.Map.TopMap == message.mapId) { scrollType = MapScrollEnum.Top; } if (scrollType != MapScrollEnum.UNDEFINED) { int overrided = ScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType); ushort cellid = ScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType); client.Character.Record.Direction = ScrollActionRecord.GetScrollDirection(scrollType); int teleportMapId = overrided != -1 ? overrided : message.mapId; if (overrided == 0) { teleportMapId = message.mapId; } MapRecord teleportedMap = MapRecord.GetMap(teleportMapId); if (teleportedMap != null) { cellid = teleportedMap.Walkable(cellid) ? cellid : ScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap); client.Character.Teleport(teleportMapId, cellid); } else { client.Character.ReplyError("This map cannot be founded"); } } else { scrollType = ScrollActionRecord.GetScrollTypeFromCell((short)client.Character.Record.CellId); if (scrollType == MapScrollEnum.UNDEFINED) { client.Character.ReplyError("Unknown Map Scroll Action..."); } else { int overrided = ScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType); ushort cellid = ScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType); MapRecord teleportedMap = MapRecord.GetMap(overrided); if (teleportedMap != null) { client.Character.Record.Direction = ScrollActionRecord.GetScrollDirection(scrollType); cellid = teleportedMap.Walkable(cellid) ? cellid : ScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap); client.Character.Teleport(overrided, cellid); } else { client.Character.ReplyError("This map cannot be founded"); } } } }
public void ChangeMapMessage(GameClient client, ChangeMapMessage changeMapMessage) { Container.Instance().Resolve <IMapManager>().ChangeMap(client, changeMapMessage); }
public static void HandleChangeMap(ChangeMapMessage message, WorldClient client) { MapScrollType scrollType = MapScrollType.UNDEFINED; if (client.Character.Map.LeftMap == message.mapId) { scrollType = MapScrollType.LEFT; } if (client.Character.Map.RightMap == message.mapId) { scrollType = MapScrollType.RIGHT; } if (client.Character.Map.DownMap == message.mapId) { scrollType = MapScrollType.BOTTOM; } if (client.Character.Map.TopMap == message.mapId) { scrollType = MapScrollType.TOP; } if (scrollType != MapScrollType.UNDEFINED) { int overrided = MapScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType); short cellid = MapScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType); client.Character.Record.Direction = MapScrollActionRecord.GetScrollDirection(scrollType); int teleportMapId = overrided != -1 ? overrided : message.mapId; if (overrided == 0) { teleportMapId = message.mapId; } MapRecord teleportedMap = MapRecord.GetMap(teleportMapId); if (teleportedMap != null) { cellid = teleportedMap.Walkable(cellid) ? cellid : MapScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap); client.Character.Teleport(teleportMapId, cellid); } else { client.Character.NotificationError("This map cannot be founded"); } } else { scrollType = MapScrollActionRecord.GetScrollTypeFromCell(client.Character.Record.CellId); if (scrollType == MapScrollType.UNDEFINED) { client.Character.NotificationError("Unknown Map Scroll Action..."); } else { int overrided = MapScrollActionRecord.GetOverrideScrollMapId(client.Character.Map.Id, scrollType); short cellid = MapScrollActionRecord.GetScrollDefaultCellId(client.Character.Record.CellId, scrollType); MapRecord teleportedMap = MapRecord.GetMap(overrided); if (teleportedMap != null) { client.Character.Record.Direction = MapScrollActionRecord.GetScrollDirection(scrollType); cellid = teleportedMap.Walkable(cellid) ? cellid : MapScrollActionRecord.SearchScrollCellId(cellid, scrollType, teleportedMap); client.Character.Teleport(overrided, cellid); } else { client.Character.NotificationError("This map cannot be founded"); } } } }