-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
2,020 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using System; | ||
using System.Threading; | ||
using ClassicUO.Dust765.Shared; | ||
using ClassicUO.Dust765.Lobby.Networking; | ||
using ClassicUO.Game; | ||
using ClassicUO.Game.Data; | ||
using ClassicUO.Game.Managers; | ||
|
||
namespace ClassicUO.Dust765.Autos | ||
{ | ||
internal class AutoLobbyStealthPosition | ||
{ | ||
public static bool IsEnabled { get; set; } | ||
public static Thread a_AutoLobbyStealthPositionThread; | ||
|
||
//##AutoLobbyStealthPosition Toggle##// | ||
public static void Toggle() | ||
{ | ||
GameActions.Print(String.Format("Auto LobbyStealthPosition:{0}abled", (IsEnabled = !IsEnabled) == true ? "En" : "Dis"), 70); | ||
} | ||
|
||
//##Register Command and Perform Checks##// | ||
public static void Initialize() | ||
{ | ||
CommandManager.Register("autohid", args => Toggle()); | ||
|
||
a_AutoLobbyStealthPositionThread = new Thread(new ThreadStart(DoAutoLobbyStealthPosition)) | ||
{ | ||
IsBackground = true | ||
}; | ||
} | ||
|
||
//##Default AutoLobbyStealthPosition Status on GameLoad##// | ||
static AutoLobbyStealthPosition() | ||
{ | ||
IsEnabled = false; | ||
} | ||
|
||
//##Perform AutoLobbyStealthPosition Update on Toggle/Player Death##// | ||
public static void Update() | ||
{ | ||
if (!IsEnabled || World.Player.IsDead) | ||
DisableAutoLobbyStealthPosition(); | ||
|
||
if (IsEnabled) | ||
EnableAutoLobbyStealthPosition(); | ||
} | ||
|
||
//##Enable AutoLobbyStealthPosition##// | ||
private static void EnableAutoLobbyStealthPosition() | ||
{ | ||
if (!a_AutoLobbyStealthPositionThread.IsAlive) | ||
{ | ||
a_AutoLobbyStealthPositionThread = new Thread(new ThreadStart(DoAutoLobbyStealthPosition)) | ||
{ | ||
IsBackground = true | ||
}; | ||
a_AutoLobbyStealthPositionThread.Start(); | ||
} | ||
} | ||
|
||
//##Disable AutoLobbyStealthPosition##// | ||
private static void DisableAutoLobbyStealthPosition() | ||
{ | ||
if (a_AutoLobbyStealthPositionThread.IsAlive) | ||
{ | ||
a_AutoLobbyStealthPositionThread.Abort(); | ||
} | ||
} | ||
|
||
//##Perform AutoLobbyStealthPosition Checks##// | ||
private static void DoAutoLobbyStealthPosition() | ||
{ | ||
DateTime dateTime = DateTime.Now; | ||
while (true) | ||
{ | ||
|
||
if (World.Player == null || World.Player.IsDead) | ||
DisableAutoLobbyStealthPosition(); | ||
|
||
if (!World.Player.IsDead && World.Player != null && ((DateTime.Now - dateTime) > TimeSpan.FromSeconds(2.5))) | ||
{ | ||
|
||
if (Lobby.Lobby._netState == null || !Lobby.Lobby._netState.IsOpen) | ||
{ | ||
|
||
} | ||
else if (World.Player.IsHidden) | ||
{ | ||
SendPacketToLobby(); | ||
} | ||
|
||
dateTime = DateTime.Now; | ||
Thread.Sleep(250); | ||
} | ||
Thread.Sleep(250); | ||
} | ||
} | ||
|
||
//##Perform SendPacketToLobby##// | ||
private static void SendPacketToLobby() | ||
{ | ||
string posXY = (World.Player.X.ToString() + "," + World.Player.Y.ToString() + "," + World.Player.Z.ToString()); | ||
Lobby.Lobby._netState.Send(new PHiddenPosition((posXY))); | ||
} | ||
|
||
//##Perform Message##// | ||
public static void Print(string message, MessageColor color = MessageColor.Default) | ||
{ | ||
GameActions.Print(message, (ushort)color, MessageType.System, 1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net; | ||
|
||
namespace ClassicUO.Dust765.Lobby | ||
{ | ||
public sealed class CommandArgs | ||
{ | ||
private List<String> m_Arguments = new List<string>(); | ||
|
||
public int Count => m_Arguments.Count; | ||
|
||
public CommandArgs(string text) | ||
{ | ||
int i = 0; | ||
|
||
while(i < text.Length) | ||
{ | ||
char c = text[i]; | ||
if(c != ' ') | ||
{ | ||
// start reading text argument | ||
|
||
int j = i; | ||
while(j < text.Length && (text[j] != ' ')) | ||
j++; | ||
|
||
int len = j - i - 1; | ||
|
||
m_Arguments.Add(text.Substring(i, j - i)); | ||
|
||
i = j + 1; // stopped reading text argument | ||
} | ||
else | ||
{ | ||
i++; | ||
} | ||
} | ||
} | ||
|
||
public string GetArgument(int i) | ||
{ | ||
if(i < 0 || i > m_Arguments.Count) | ||
return string.Empty; | ||
|
||
return m_Arguments[i]; | ||
} | ||
|
||
public IPAddress GetIPAddress(int i) | ||
{ | ||
IPAddress res = IPAddress.None; | ||
String ipString = GetArgument(i); | ||
|
||
if(ipString != null) | ||
IPAddress.TryParse(ipString, out res); | ||
|
||
return res; | ||
} | ||
} | ||
} |
Oops, something went wrong.