public void RejoinMap(bool spawnjoin, bool winner) { Client.Send(new GameContextDestroyMessage()); Client.Send(new GameContextCreateMessage(1)); if (winner && FighterInstance.Fight.Map.DugeonMap) { var dungeonMap = DungeonRecord.GetDungeonData(FighterInstance.Fight.Map.Id); FighterInstance = null; Client.Character.Teleport(dungeonMap.TeleportMapId, dungeonMap.TeleportCellId); RefreshStats(); return; } FighterInstance = null; if (spawnjoin && !winner) { if (Client.Character.Record.SpawnPointMapId != -1) { MapsHandler.SendCurrentMapMessage(Client, Client.Character.Record.SpawnPointMapId); Record.CellId = (short)InteractiveRecord.GetTeleporterCellId(Client.Character.Record.SpawnPointMapId, TeleporterTypeEnum.TELEPORTER_ZAAP); } else { Client.Character.Teleport(ConfigurationManager.Instance.StartMapId, ConfigurationManager.Instance.StartCellId); } } else { MapsHandler.SendCurrentMapMessage(Client, Client.Character.Record.MapId); } RefreshStats(); }
public void StartFighting() { Clients.ForEach(x => x.UpdateRegistrationStatus(false, PvpArenaStepEnum.ARENA_STEP_STARTING_FIGHT)); int arenaMapId = ArenaProvider.Instance.RandomArenaMap(); BlueTeam.ForEach(x => MapsHandler.SendCurrentMapMessage(x.WorldClient, arenaMapId)); RedTeam.ForEach(x => MapsHandler.SendCurrentMapMessage(x.WorldClient, arenaMapId)); var fight = FightProvider.Instance.CreateArenaFight(MapRecord.GetMap(arenaMapId), this); BlueTeam.ForEach(x => fight.BlueTeam.AddFighter(x.WorldClient.Character.CreateFighter(fight.BlueTeam))); RedTeam.ForEach(x => fight.RedTeam.AddFighter(x.WorldClient.Character.CreateFighter(fight.RedTeam))); fight.StartPlacement(); Clients.Clear(); ArenaProvider.Instance.m_arena_groups.Remove(this); }
public void Teleport(int mapid, short cellid) { if (cellid < 0 || cellid > 560) { cellid = 350; } if (IsFighting) { return; } if (Map != null && Map.Id == mapid) { if (cellid >= 0) { SendMap(new TeleportOnSameMapMessage(Id, (ushort)cellid)); Record.CellId = cellid; } else { SendMap(new TeleportOnSameMapMessage(Id, (ushort)Client.Character.Record.CellId)); } return; } if (Map != null) { Map.Instance.RemoveClient(Client); } MapsHandler.SendCurrentMapMessage(Client, mapid); if (cellid != -1) { this.Record.CellId = cellid; } this.Record.MapId = mapid; }