public GameControler(ConnectedHost host, Logger logg) { mHost = host; mLogg = logg; World = new WorldControler(host); Player = new PlayerControler(host, World); }
public void Move(DirectionsEnum direction, WorldControler world, short cellId) { mChangeMap = true; MapDirection = direction; Move(GetRandomCellid(direction, world), cellId, true, world); }
private short GetRandomCellid(DirectionsEnum direction, WorldControler world, bool passAcotrs = false) { try { switch (direction) { case DirectionsEnum.DIRECTION_SOUTH: while (true) { Random al = new Random(); int dest = al.Next(532, 559); if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs)) { return((short)(dest)); } } case DirectionsEnum.DIRECTION_NORTH: while (true) { Random al = new Random(); int dest = al.Next(14, 27); if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs)) { return((short)(dest)); } } case DirectionsEnum.DIRECTION_EAST: while (true) { Random al = new Random(); int dest = al.Next(0, 39) * 14 + 13; if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs)) { return((short)(dest)); } } case DirectionsEnum.DIRECTION_WEST: while (true) { Random al = new Random(); int dest = al.Next(0, 39) * 14; if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs)) { return((short)(dest)); } } } } catch (Exception e) { mHost.logger.Log("Impossible de changer la map vers cette direction", LogLevelEnum.Error); } return(GetRandomCellid(direction, world, true)); }
public PlayerControler(ConnectedHost host,WorldControler world) { mHost = host; mWorld = world; mPathFinder = new Pathfinder(); PlayerBaseInformations = new PlayerBaseInformationsModel(mHost); PlayerCharacteristics = new PlayerCharacteristicsModel(mHost); PlayerInventory = new PlayerInventoryModel(mHost); PlayerSpells = new PlayerSpellsModel(mHost); PlayerJobs = new PlayerJobsModel(mHost); mMoveFrame = new MoveFrame(mHost); PlayerFightInformations = new PlayerFightInformationsModel(mHost); }
public int Move(short destinationCellId, short curentCellId, bool useDiagonal, WorldControler world) { mHost.Bot.Game.Player.mPathFinder.SetMap(world.Map, useDiagonal); DebugHighlightCellsMessage message = new DebugHighlightCellsMessage(Color.Red.ToArgb(), new List <ushort>().ToArray()); List <CellWithOrientation> cels = mHost.Bot.Game.Player.mPathFinder.GetPath(curentCellId, destinationCellId); if (cels == null) { Move(destinationCellId, curentCellId, useDiagonal, world); } List <short> keyMouvement = new List <short>(); foreach (CellWithOrientation ce in cels) { message.cells.ToList().Add((ushort)ce.Id); ce.GetCompressedValue(); keyMouvement.Add(ce.CompressedValue); } mHost.SendMessage(message, DestinationEnum.CLIENT); Move(keyMouvement.ToArray(), world.Map.Data.Id); return((int)keyMouvement.Count); }