/// <summary> /// Loads all the revive spots. /// </summary> /// <returns>Returns true if the revive spots were loaded.</returns> public static bool LoadReviveSpots() { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\tLoading Revive Spots..."); using (var revive = new SqlHandler(Program.Config.ReadString("GameConnectionString"))) { using (var cmd = new SqlCommandBuilder(revive, SqlCommandType.SELECT, false)) { cmd.Finish("DB_ReviveSpots"); } while (revive.Read()) { Maps.MapPoint revivepoint = new ProjectX_V3_Game.Maps.MapPoint(revive.ReadUInt16("ReviveTargetMapID"), revive.ReadUInt16("ReviveX"), revive.ReadUInt16("ReviveY")); ushort frommap = revive.ReadUInt16("ReviveMapID"); if (!Core.Kernel.Maps.Contains(frommap)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Failed to load revive spots. Failed at map: {0}, perhaps the map is not existing.", revivepoint.MapID); Console.ResetColor(); return false; } Core.Kernel.Maps[frommap].RevivePoint = revivepoint; } } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\tLoaded Revive Spots..."); return true; }
/// <summary> /// Loads all the revive spots. /// </summary> /// <returns>Returns true if the revive spots were loaded.</returns> public static bool LoadReviveSpots() { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\tLoading Revive Spots..."); using (var revive = new SqlHandler(Program.Config.ReadString("GameConnectionString"))) { using (var cmd = new SqlCommandBuilder(revive, SqlCommandType.SELECT, false)) { cmd.Finish("DB_ReviveSpots"); } while (revive.Read()) { Maps.MapPoint revivepoint = new ProjectX_V3_Game.Maps.MapPoint(revive.ReadUInt16("ReviveTargetMapID"), revive.ReadUInt16("ReviveX"), revive.ReadUInt16("ReviveY")); ushort frommap = revive.ReadUInt16("ReviveMapID"); if (!Core.Kernel.Maps.Contains(frommap)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Failed to load revive spots. Failed at map: {0}, perhaps the map is not existing.", revivepoint.MapID); Console.ResetColor(); return(false); } Core.Kernel.Maps[frommap].RevivePoint = revivepoint; } } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\tLoaded Revive Spots..."); return(true); }
public void Jump() { if (Core.Screen.GetDistance(Original.X, Original.Y, DestinationX, DestinationY) <= 5) { Threads.ActionThread.Actions.TryRemove(CurrentJumpAction.ActionID, out CurrentJumpAction); CurrentJumpAction = null; return; } Enums.ConquerAngle angle = Core.Screen.GetFacing(Core.Screen.GetAngle(Original.X, Original.Y, DestinationX, DestinationY)); Maps.MapPoint point = Packets.MovementPacket.CreateDirectionPoint(Original.X, Original.Y, (byte)angle); if (!Original.Map.ValidCoord(point.X, point.Y)) { return; } const ushort size = 14; for (ushort i = size; i > 0; i--) { Maps.MapPoint npoint = Packets.MovementPacket.CreateDirectionPoint(point.X, point.Y, (byte)angle); npoint = new ProjectX_V3_Game.Maps.MapPoint(0, npoint.X, npoint.Y); if (Original.Map.ValidCoord(npoint.X, npoint.Y)) { point = npoint; } else { break; } } ushort x = point.X; ushort y = point.Y; Packets.GeneralDataPacket general = new ProjectX_V3_Game.Packets.GeneralDataPacket(Enums.DataAction.Jump); general.Id = Original.EntityUID; general.Data1Low = x; general.Data1High = y; general.Data5 = uint.MaxValue; general.Data3Low = Original.X; general.Data3High = Original.Y; general.Data4 = (uint)Original.Map.MapID; general.Timestamp = ProjectX_V3_Lib.Native.Winmm.timeGetTime(); Original.SendToScreen(general, false, false); Original.X = x; Original.Y = y; }
public void Jump(ushort size, Enums.ConquerAngle angle) { Maps.MapPoint point = Packets.MovementPacket.CreateDirectionPoint(Original.X, Original.Y, (byte)angle); if (!Original.Map.ValidCoord(point.X, point.Y)) { return; } for (ushort i = size; i > 0; i--) { Maps.MapPoint npoint = Packets.MovementPacket.CreateDirectionPoint(point.X, point.Y, (byte)angle); npoint = new ProjectX_V3_Game.Maps.MapPoint(0, npoint.X, npoint.Y); if (Original.Map.ValidCoord(npoint.X, npoint.Y)) { point = npoint; } else { break; } } Jump(point.X, point.Y); }