public static void ChangeMap(Map map, Action<Zone> initialization) { if (State == GameState.Playing) State = GameState.ChangingMap; var newZone = new Zone(map); initialization(newZone); if (State == GameState.CharacterScreen) { State = GameState.LoadingScreen; Network.AuthServer.Send(AuthServerMessage.Dispatch, Network.AuthServer.LoginCount, 0, (uint) newZone.Map, new byte[] { 0x02, 0x00, 0x23, 0x98, 0x7F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0); } else if (State == GameState.ChangingMap) { State = GameState.LoadingScreen; Network.GameServer.Send(GameServerMessage.Dispatch, new byte[] { 0x02, 0x00, 0x23, 0x98, 0x7F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0, (byte) 0, (ushort) newZone.Map, (byte) 0, 0); } else { Debug.ThrowException(new Exception("cannot change zone in gamestate " + State)); } Zone = newZone; }
public static bool Initialize() { try { Map.TeamArenas.Info().Flags &= ~AreaInfo.AreaFlags.HideOnWorldmap; CancelLoginHook.Install(() => AuthLogic.CancelLogin()); AgentTrackerHook.Install((id, data) => { Creature creature; if (IdManager.TryGet(id, out creature)) { creature.Transformation.Goal = new Position(BitConverter.ToSingle(BitConverter.GetBytes(Marshal.ReadInt32(data + 8)), 0), BitConverter.ToSingle(BitConverter.GetBytes(Marshal.ReadInt32(data + 12)), 0), (short) Marshal.ReadInt32(data + 16)); } }); Network.Initialize(); Zone = new Zone(Map.AscalonCity); return true; } catch (Exception) { return false; } }