Add newly developped plugins

This commit is contained in:
Beu 2023-01-24 01:25:19 +01:00
parent be3bc5cbd0
commit 3f02a9e87b
7 changed files with 239 additions and 0 deletions

View File

@ -0,0 +1,6 @@
[meta]
name = "RPG Online Spectator"
category = "Online"
author = "Beu"
version = "1.0"
siteid = 287

View File

@ -0,0 +1,71 @@
bool displayUI = true;
void RenderMenu() {
auto App = cast<CTrackMania>(GetApp());
auto Network = cast<CTrackManiaNetwork>(App.Network);
auto ServerInfo = cast<CTrackManiaNetworkServerInfo>(Network.ServerInfo);
if (Network !is null && ServerInfo !is null && ServerInfo.ServerLogin != "") {
if(UI::MenuItem("\\$77d" + Icons::VideoCamera + " \\$fffRPG Online Spectator", "", displayUI)) {
displayUI = !displayUI;
}
} else {
displayUI = false;
}
}
void RenderInterface() {
auto App = cast<CTrackMania>(GetApp());
auto Network = cast<CTrackManiaNetwork>(App.Network);
auto ServerInfo = cast<CTrackManiaNetworkServerInfo>(Network.ServerInfo);
CGamePlayground@ Playground = GetApp().CurrentPlayground;
if (Network !is null && ServerInfo !is null && ServerInfo.ServerLogin != "") {
if (Playground is null) return;
if (displayUI) {
auto ManiaApp = Network.ClientManiaAppPlayground;
UI::PushStyleVar(UI::StyleVar::WindowMinSize, vec2(200, 250));
if (UI::Begin("\\$fc3" + Icons::VideoCamera + "\\$z RPG Online Spectator", displayUI)) {
UI::TextWrapped("Only use this plugin to spectate other players to not cancel your run");
if (ManiaApp.ClientUI.ForceSpectator) {
if (UI::Button("Continue your run")) {
ManiaApp.ClientUI.ForceSpectator = false;
}
}
UI::Separator();
if (UI::BeginChild("playerlist")) {
for (uint i = 0; i < Playground.Players.Length; i++) {
CSmPlayer@ Player = cast<CSmPlayer@>(Playground.Players[i]);
CSmScriptPlayer@ ScriptPlayer = cast<CSmScriptPlayer@>(Player.ScriptAPI);
if (Playground.Interface.ManialinkScriptHandler.LocalUser.Login == Player.User.Login) continue;
bool isSpectator = Player.User.SpectatorMode == CGameNetPlayerInfo::ESpectatorMode::Watcher
|| Player.User.SpectatorMode == CGameNetPlayerInfo::ESpectatorMode::LocalWatcher
|| Player.SpawnIndex < 0;
if (isSpectator) continue;
if (UI::MenuItem(Player.User.Name)) {
ManiaApp.ClientUI.ForceSpectator = true;
CGamePlaygroundClientScriptAPI@ Api = GetApp().CurrentPlayground.Interface.ManialinkScriptHandler.Playground;
Api.SetSpectateTarget(Player.User.Login);
}
}
UI::EndChild();
}
UI::End();
}
UI::PopStyleVar();
}
} else {
displayUI = false;
}
}

View File

@ -0,0 +1,4 @@
[meta]
name = "TMWT Interfaces Remover"
category = "TMWT"
version = "1.0"

View File

@ -0,0 +1,81 @@
bool InterfacesAreHidden;
bool HideInterfaces;
string Last_ServerLogin;
CGameUILayer@ UILayer_LiveRanking;
CGameUILayer@ UILayer_TeamsScores;
void RenderMenu() {
if(UI::MenuItem("\\$77d" + Icons::User + " \\$fffTMWT Interfaces Remover", "", HideInterfaces)) {
auto app = cast<CTrackMania>(GetApp());
auto network = cast<CTrackManiaNetwork>(app.Network);
auto serverinfo = cast<CTrackManiaNetworkServerInfo>(network.ServerInfo);
if (network !is null && serverinfo !is null && serverinfo.ServerLogin != "") {
HideInterfaces = !HideInterfaces;
}
}
}
CGameUILayer@ findUILayer(const MwFastBuffer<CGameUILayer@> _UILayers, string _ManialinkId) {
for (uint i = 0; i < _UILayers.Length; i++) {
string manialink = _UILayers[i].ManialinkPage;
auto firstlines = manialink.Split("\n", 5);
if (firstlines.Length > 0) {
for (uint j = 0; j < firstlines.Length - 1; j++) {
if (firstlines[j].Contains(_ManialinkId)) {
return _UILayers[i];
}
}
}
}
return null;
}
void Main() {
while(true) {
auto app = cast<CTrackMania>(GetApp());
auto network = cast<CTrackManiaNetwork>(app.Network);
auto serverinfo = cast<CTrackManiaNetworkServerInfo>(network.ServerInfo);
if (network !is null && serverinfo !is null) {
if (Last_ServerLogin != serverinfo.ServerLogin) {
Last_ServerLogin = serverinfo.ServerLogin;
HideInterfaces = false;
InterfacesAreHidden = false;
}
CGameManiaAppPlayground@ ManiaApp = cast<CGameManiaAppPlayground>(network.ClientManiaAppPlayground);
if (ManiaApp !is null) {
if (UILayer_LiveRanking is null) {
@UILayer_LiveRanking = findUILayer(ManiaApp.UILayers, "UIModule_TMWTTeams_LiveRanking");
}
if (UILayer_TeamsScores is null) {
@UILayer_TeamsScores = findUILayer(ManiaApp.UILayers, "UIModule_TMWTTeams_Header");
}
if (HideInterfaces && !InterfacesAreHidden && ManiaApp.UI.UISequence == CGamePlaygroundUIConfig::EUISequence::Playing) {
if (HideLiveRanking && UILayer_LiveRanking !is null) {
UILayer_LiveRanking.IsVisible = false;
}
if (HideTeamsScores && UILayer_TeamsScores !is null) {
UILayer_TeamsScores.IsVisible = false;
}
InterfacesAreHidden = true;
} else if (InterfacesAreHidden && (!HideInterfaces || ManiaApp.UI.UISequence != CGamePlaygroundUIConfig::EUISequence::Playing)) {
if (UILayer_LiveRanking !is null) {
UILayer_LiveRanking.IsVisible = true;
}
if (UILayer_TeamsScores !is null) {
UILayer_TeamsScores.IsVisible = true;
}
InterfacesAreHidden = false;
}
}
} else {
Last_ServerLogin = "";
HideInterfaces = false;
InterfacesAreHidden = false;
@UILayer_LiveRanking = null;
@UILayer_TeamsScores = null;
}
yield();
}
}

View File

@ -0,0 +1,5 @@
[Setting category="Interfaces" name="Hide Live Ranking"]
bool HideLiveRanking = true;
[Setting category="Interfaces" name="Hide Teams Scores"]
bool HideTeamsScores = true;

View File

@ -0,0 +1,5 @@
[meta]
name = "TMWT Screen Remover"
category = "TMWT"
version = "1.2"
siteid = 183

67
TMWTScreenRemover/main.as Normal file
View File

@ -0,0 +1,67 @@
string last_serverlogin = "";
bool removesign;
bool signremoved;
void RenderMenu() {
if(UI::MenuItem("\\$77d" + Icons::User + " \\$fffTMWT Screen Remover", "", removesign)) {
auto app = cast<CTrackMania>(GetApp());
auto network = cast<CTrackManiaNetwork>(app.Network);
auto serverinfo = cast<CTrackManiaNetworkServerInfo>(network.ServerInfo);
if (network !is null && serverinfo !is null && serverinfo.ServerLogin != "") {
removesign = true;
signremoved = false;
}
}
}
void Main() {
while(true) {
auto app = cast<CTrackMania>(GetApp());
auto network = cast<CTrackManiaNetwork>(app.Network);
auto serverinfo = cast<CTrackManiaNetworkServerInfo>(network.ServerInfo);
if (network !is null && serverinfo !is null) {
if (last_serverlogin != serverinfo.ServerLogin) {
last_serverlogin = serverinfo.ServerLogin;
if (removesign) {
removesign = false;
}
if (signremoved) {
signremoved = false;
}
}
if (removesign && !signremoved) {
auto maniaapp = network.ClientManiaAppPlayground;
if (maniaapp !is null) {
signremoved = true;
auto uilayers = maniaapp.UILayers;
for (uint i = 0; i < uilayers.Length; i++) {
string manialink = uilayers[i].ManialinkPage;
auto firstlines = manialink.Split("\n", 5);
if (firstlines.Length > 0) {
for (uint j = 0; j < firstlines.Length - 1; j++) {
if (firstlines[j].Contains("UIModule_TMWTTeams_Sign")) {
maniaapp.UILayerDestroy(uilayers[i]);
}
}
}
}
}
}
} else {
if (last_serverlogin != "") {
last_serverlogin = "";
}
if (removesign) {
removesign = false;
}
if (signremoved) {
signremoved = false;
}
}
sleep(1000);
}
}