예제 #1
0
        public static ushort GetTeleporterCell(MapRecord map, InteractiveElementRecord ele)
        {
            ushort cellId = (ushort)ele.Point.GetCellInDirection(DirectionsEnum.DIRECTION_SOUTH_WEST, 1).CellId;

            if (!map.Walkable(cellId))
            {
                ushort[] array = map.CloseCells(ele.CellId);
                cellId = array.Length == 0 ? map.RandomWalkableCell() : array[0];
            }
            return(cellId);
        }
예제 #2
0
        public override void Teleport(MapRecord map)
        {
            if (this.Maps.Contains(map.Id))
            {
                int cost = Costs[Maps.ToList().IndexOf(map.Id)];

                var zaapi = map.GetInteractiveByElementType(106); // IT Type Enum

                ushort cellId = zaapi != null?GetTeleporterCell(map, zaapi) : map.RandomWalkableCell();

                if (this.Character.RemoveKamas(cost))
                {
                    this.Close();
                    this.Character.Teleport(map.Id, cellId);
                }
            }
        }
예제 #3
0
        public override void Teleport(MapRecord map)
        {
            if (this.Maps.Contains(map.Id))
            {
                int    cost = Costs[Maps.ToList().IndexOf(map.Id)];
                ushort cellId;

                var zaap = map.Zaap;
                cellId = zaap != null?GetTeleporterCell(map, zaap) : map.RandomWalkableCell();

                if (this.Character.RemoveKamas(cost))
                {
                    this.Close();
                    this.Character.Teleport(map.Id, cellId);
                }
            }
        }
예제 #4
0
        public static void EndFightCommand(string value, WorldClient client)
        {
            var split = value.Split(' ');

            int       map    = int.Parse(split[0]);
            MapRecord record = MapRecord.GetMap(map);

            ushort randomWalkableCell = split.Length > 1 ? ushort.Parse(split[1]) : record.RandomWalkableCell();

            EndFightActionRecord endFight = new EndFightActionRecord(EndFightActionRecord.EndFightActions.DynamicPop(x => x.Id),
                                                                     client.Character.Map.Id,
                                                                     map,
                                                                     randomWalkableCell);

            endFight.AddInstantElement();

            client.Character.Reply("EndFightAction has been added");
        }