Skip to content

Commit

Permalink
LOBBY
Browse files Browse the repository at this point in the history
  • Loading branch information
dust765 committed Jan 27, 2022
1 parent fc7040a commit 26abcab
Show file tree
Hide file tree
Showing 20 changed files with 2,020 additions and 1 deletion.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,20 @@ underchar: Hamstrung timer (also on healthbar)

buffbar: hamstrung

# lobby

connect multiple Dust765 clients to a lobby server to issue commands

[Dust765's LobbyServer] (https://github.com/dust765/LobbyServer)

features: send your lasttarget to be everyones, drop everyones spell on lasttarget, make everyone cast a spell, everyone attack lasttarget

autostealthposition: command: -autohid ((needs connected lobby) broadcast your position when hidden, everyone will see your position

commands: see options for a full list

macros: see options for a full list

# Added files

/src/Dust765
Expand All @@ -244,6 +258,8 @@ buffbar: hamstrung

/src/Dust765/Shared

/src/Dust765/Lobby

/src/halo.png

/src/arrow.png
Expand Down Expand Up @@ -696,6 +712,10 @@ FILE START END COMMIT

/src/Game/UI/Gumps/Login/LoginGump.cs 419 429 LOGIN

/src/Game/Managers/MacroManager.cs 1954 1990 LOBBY

/src/Game/Managers/MacroManager.cs 2534 2541 LOBBY

# Introduction
ClassicUO is an open source implementation of the Ultima Online Classic Client. This client is intended to emulate all standard client versions and is primarily tested against Ultima Online free shards.

Expand Down
4 changes: 4 additions & 0 deletions src/Configuration/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ internal sealed class Profile
public bool UOClassicCombatBuffbar_GotHEnabled { get; set; } = false;
*/
// ## BEGIN - END ## // OUTLANDS
// ## BEGIN - END ## // LOBBY
public string LobbyIP { get; set; } = "127.0.0.1";
public string LobbyPort { get; set; } = "2596";
// ## BEGIN - END ## // LOBBY
// ## BEGIN - END ## // BASICSETUP

public bool IgnoreStaminaCheck { get; set; } = false;
Expand Down
113 changes: 113 additions & 0 deletions src/Dust765/Autos/AutoLobbyStealthPosition.cs
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);
}
}
}
60 changes: 60 additions & 0 deletions src/Dust765/Lobby/CommandArgs.cs
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;
}
}
}
Loading

0 comments on commit 26abcab

Please sign in to comment.