mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Unreal Tournament support
Added UT module Added UT plugin to Git Added Contains, EndWith, StartsWith to string layer conditions
This commit is contained in:
parent
5e13dac219
commit
63b0b1d8e5
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Razer2Artemis", "Razer2Artemis\Razer2Artemis.vcxproj", "{39711909-C1D5-46CE-A9EA-2D561692EA47}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrealTournament2Artemis", "UnrealTournament2Artemis\UnrealTournament2Artemis.vcxproj", "{3541864F-1662-4BD6-8328-2C87AE61D152}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CD_ROM|Any CPU = CD_ROM|Any CPU
|
||||
@ -84,6 +86,34 @@ Global
|
||||
{39711909-C1D5-46CE-A9EA-2D561692EA47}.SingleImage|x64.Build.0 = Release|x64
|
||||
{39711909-C1D5-46CE-A9EA-2D561692EA47}.SingleImage|x86.ActiveCfg = Release|Win32
|
||||
{39711909-C1D5-46CE-A9EA-2D561692EA47}.SingleImage|x86.Build.0 = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.CD_ROM|Any CPU.ActiveCfg = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.CD_ROM|Any CPU.Build.0 = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.CD_ROM|x64.ActiveCfg = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.CD_ROM|x64.Build.0 = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.CD_ROM|x86.ActiveCfg = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.CD_ROM|x86.Build.0 = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Debug|x64.Build.0 = Debug|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Debug|x86.Build.0 = Debug|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.DVD-5|Any CPU.ActiveCfg = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.DVD-5|Any CPU.Build.0 = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.DVD-5|x64.ActiveCfg = Debug|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.DVD-5|x64.Build.0 = Debug|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.DVD-5|x86.ActiveCfg = Debug|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.DVD-5|x86.Build.0 = Debug|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Release|x64.ActiveCfg = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Release|x64.Build.0 = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Release|x86.ActiveCfg = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.Release|x86.Build.0 = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.SingleImage|Any CPU.ActiveCfg = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.SingleImage|Any CPU.Build.0 = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.SingleImage|x64.ActiveCfg = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.SingleImage|x64.Build.0 = Release|x64
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.SingleImage|x86.ActiveCfg = Release|Win32
|
||||
{3541864F-1662-4BD6-8328-2C87AE61D152}.SingleImage|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Shows verious game states and events on the keyboard." />
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows team, HP, ammo and money on the keyboard and shows team colors on mouse and headset" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Shows verious game states and events on the keyboard." />
|
||||
Text="By default shows mana, HP, character state on the keyboard and colors headset and mouse according to HP" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Allows you to create layers based on ingame cooldown and your hero." />
|
||||
Text="By default colors the keyboard according to the chosen hero and shows ability cooldowns." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Shows your boost amount on the keyboard." />
|
||||
Text="By default fills up the keyboard according to the amount of boost. Also colors mouse and headset according to boost." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -19,16 +19,100 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
|
||||
public class Player
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Team { get; set; }
|
||||
public int Health { get; set; }
|
||||
public int Armor { get; set; }
|
||||
public string Powerup { get; set; }
|
||||
public PlayerState State { get; set; }
|
||||
public Inventory Inventory { get; set; }
|
||||
public Weapon Weapon { get; set; }
|
||||
public MatchPlayer MatchStatus { get; set; }
|
||||
}
|
||||
|
||||
public class PlayerState
|
||||
{
|
||||
public string PlayerName { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public int Score { get; set; }
|
||||
public int TeamNum { get; set; }
|
||||
public int RankCheck { get; set; }
|
||||
public int DuelRank { get; set; }
|
||||
public int No_of_Duel_Played { get; set; }
|
||||
public int CTFRank { get; set; }
|
||||
public int No_CTF_MatchesPlayed { get; set; }
|
||||
public int TDMRank { get; set; }
|
||||
public int No_TDM_MatchesPlayed { get; set; }
|
||||
public int DMRank { get; set; }
|
||||
public int No_DM_Matches_Played { get; set; }
|
||||
public int ShowdownRank { get; set; }
|
||||
public int No_Showdowns { get; set; }
|
||||
}
|
||||
|
||||
public class Inventory
|
||||
{
|
||||
public bool HasJumpBoots { get; set; }
|
||||
public bool HasInvisibility { get; set; }
|
||||
public bool HasBerserk { get; set; }
|
||||
public bool HasUDamage { get; set; }
|
||||
public bool HasThighPads { get; set; }
|
||||
public bool HasShieldBelt { get; set; }
|
||||
public bool HasChestArmor { get; set; }
|
||||
public bool HasHelmet { get; set; }
|
||||
}
|
||||
|
||||
public class Weapon
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Ammo { get; set; }
|
||||
public int MaxAmmo { get; set; }
|
||||
public bool IsFiring { get; set; }
|
||||
public int FireMode { get; set; }
|
||||
public ZoomState ZoomState { get; set; }
|
||||
}
|
||||
|
||||
public enum ZoomState
|
||||
{
|
||||
Unzoomed = 0,
|
||||
Zoomed = 3,
|
||||
ZoomingIn = 2,
|
||||
ZoomingOut = 1,
|
||||
}
|
||||
|
||||
public class Environment
|
||||
{
|
||||
public string Mode { get; set; }
|
||||
public string MapName { get; set; }
|
||||
public string GameMode { get; set; }
|
||||
public bool MatchStarted { get; set; }
|
||||
public int GoalScore { get; set; }
|
||||
public string ServerName { get; set; }
|
||||
public bool bWeaponStay { get; set; }
|
||||
public bool bTeamGame { get; set; }
|
||||
public bool bAllowTeamSwitches { get; set; }
|
||||
public bool bStopGameClock { get; set; }
|
||||
public bool bCasterControl { get; set; }
|
||||
public bool bForcedBalance { get; set; }
|
||||
public bool bPlayPlayerIntro { get; set; }
|
||||
public int TimeLimit { get; set; }
|
||||
public int SpawnProtectionTime { get; set; }
|
||||
public int RemainingTime { get; set; }
|
||||
public int ElapsedTime { get; set; }
|
||||
public int RespawnWaitTime { get; set; }
|
||||
public int ForceRespawnTime { get; set; }
|
||||
}
|
||||
|
||||
public class MatchPlayer
|
||||
{
|
||||
public string PlayerName { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public int Score { get; set; }
|
||||
public int TeamNum { get; set; }
|
||||
public int RankCheck { get; set; }
|
||||
public int DuelRank { get; set; }
|
||||
public int No_of_Duel_Played { get; set; }
|
||||
public int CTFRank { get; set; }
|
||||
public int No_CTF_MatchesPlayed { get; set; }
|
||||
public int TDMRank { get; set; }
|
||||
public int No_TDM_MatchesPlayed { get; set; }
|
||||
public int DMRank { get; set; }
|
||||
public int No_DM_Matches_Played { get; set; }
|
||||
public int ShowdownRank { get; set; }
|
||||
public int No_Showdowns { get; set; }
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Shows your boost amount on the keyboard." />
|
||||
Text="By default shows team, HP armor and ammo on the keyboard and shows team colors on mouse and headset." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.UnrealTournament
|
||||
{
|
||||
@ -16,7 +12,7 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
public UnrealTournamentViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new UnrealTournamentModel(main, new UnrealTournamentSettings()), events, pFactory)
|
||||
{
|
||||
DisplayName = "Rocket League";
|
||||
DisplayName = "Unreal Tournament";
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
}
|
||||
@ -33,7 +29,5 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
}
|
||||
|
||||
public UnrealTournamentModel UnrealTournamentModel { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Colors the keyboard according to the sign Gerald is using." />
|
||||
Text="By default colors the keyboard according to the sign Gerald is using." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -24,7 +24,7 @@ namespace Artemis.Profiles.Layers.Animations
|
||||
|
||||
public void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c)
|
||||
{
|
||||
if (applied.Brush == null)
|
||||
if (applied?.Brush == null)
|
||||
return;
|
||||
|
||||
const int scale = 4;
|
||||
|
||||
@ -31,7 +31,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
// Put the subject in a list, allowing Dynamic Linq to be used.
|
||||
if (Type == "String")
|
||||
{
|
||||
return _interpreter.Eval<bool>($"subject.{Field}.ToLower() {Operator} value",
|
||||
return _interpreter.Eval<bool>($"subject.{Field}.ToLower(){Operator}(value)",
|
||||
new Parameter("subject", subject.GetType(), subject),
|
||||
new Parameter("value", Value.ToLower()));
|
||||
}
|
||||
|
||||
@ -57,6 +57,8 @@ namespace Artemis.Utilities
|
||||
{
|
||||
var propertyNames = path.Split('.');
|
||||
var prop = o.GetType().GetProperty(propertyNames[0]);
|
||||
if (prop == null)
|
||||
return null;
|
||||
var value = prop.GetValue(o, null);
|
||||
|
||||
if (propertyNames.Length == 1 || value == null)
|
||||
|
||||
@ -25,6 +25,15 @@ namespace Artemis.ViewModels.Profiles
|
||||
new NamedOperator("Not equal to", "!=")
|
||||
};
|
||||
|
||||
private readonly NamedOperator[] _stringOperators =
|
||||
{
|
||||
new NamedOperator("Equal to", "=="),
|
||||
new NamedOperator("Not equal to", "!="),
|
||||
new NamedOperator("Contains", ".Contains"),
|
||||
new NamedOperator("Starts with", ".StartsWith"),
|
||||
new NamedOperator("Ends with", ".EndsWith"),
|
||||
};
|
||||
|
||||
private readonly NamedOperator[] _operators =
|
||||
{
|
||||
new NamedOperator("Equal to", "=="),
|
||||
@ -156,6 +165,10 @@ namespace Artemis.ViewModels.Profiles
|
||||
Enums.Add("False");
|
||||
EnumValueIsVisible = true;
|
||||
break;
|
||||
case "String":
|
||||
Operators.AddRange(_stringOperators);
|
||||
UserValueIsVisible = true;
|
||||
break;
|
||||
default:
|
||||
Operators.AddRange(_operators);
|
||||
UserValueIsVisible = true;
|
||||
|
||||
21
Artemis/UnrealTournament2Artemis/Artemis.uplugin
Normal file
21
Artemis/UnrealTournament2Artemis/Artemis.uplugin
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"Version" : 1,
|
||||
"FileVersion": 3,
|
||||
"FriendlyName": "Artemis Plugin",
|
||||
"VersionName": "1.0",
|
||||
"CreatedBy": "Robert Beekman",
|
||||
"CreatedByURL": "https://github.com/SpoinkyNL/Artemis",
|
||||
"EngineVersion": "4.4.0",
|
||||
"Description": "Communicates with Artemis to let the main program know what's happening ingame",
|
||||
"Category": "UnrealTournament.Mod",
|
||||
"EnabledByDefault": true,
|
||||
"CanContainContent": false,
|
||||
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "Artemis",
|
||||
"Type": "Runtime",
|
||||
"WhitelistPlatforms": [ "Win32", "Win64" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Changelist" : 2897679,
|
||||
"BuildId" : "5a8ef5b7-c9bb-42bd-ab7c-fb8e33f704ec",
|
||||
"Modules" :
|
||||
{
|
||||
"Artemis" : "UE4-Artemis-Win64-Shipping.dll"
|
||||
}
|
||||
}
|
||||
23
Artemis/UnrealTournament2Artemis/Source/Artemis.Build.cs
Normal file
23
Artemis/UnrealTournament2Artemis/Source/Artemis.Build.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.IO;
|
||||
|
||||
namespace UnrealBuildTool.Rules
|
||||
{
|
||||
public class Artemis : ModuleRules
|
||||
{
|
||||
public Artemis(TargetInfo Target)
|
||||
{
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"UnrealTournament",
|
||||
"InputCore",
|
||||
"SlateCore",
|
||||
"Json"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
225
Artemis/UnrealTournament2Artemis/Source/Private/Artemis.cpp
Normal file
225
Artemis/UnrealTournament2Artemis/Source/Private/Artemis.cpp
Normal file
@ -0,0 +1,225 @@
|
||||
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "Artemis.h"
|
||||
|
||||
#include "UnrealTournament.h"
|
||||
#include "UTPlayerController.h"
|
||||
#include "UTGameState.h"
|
||||
#include "UTArmor.h"
|
||||
#include "UTTimedPowerup.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY_STATIC(LogUTKBLightShow, Log, All);
|
||||
|
||||
AArtemis::AArtemis(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
}
|
||||
|
||||
FArtemis::FArtemis()
|
||||
{
|
||||
FrameTimeMinimum = 0.03f;
|
||||
DeltaTimeAccumulator = 0;
|
||||
}
|
||||
|
||||
IMPLEMENT_MODULE(FArtemis, Artemis)
|
||||
|
||||
void FArtemis::StartupModule()
|
||||
{
|
||||
WritePipe(FString(TEXT("Unreal Tournament plugin loaded")));
|
||||
}
|
||||
|
||||
void FArtemis::ShutdownModule()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FArtemis::Tick(float DeltaTime)
|
||||
{
|
||||
if (GIsEditor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid double ticking
|
||||
if (LastFrameCounter > 0 && LastFrameCounter == GFrameCounter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LastFrameCounter = GFrameCounter;
|
||||
|
||||
// We may be going 120hz, don't spam the device
|
||||
DeltaTimeAccumulator += DeltaTime;
|
||||
if (DeltaTimeAccumulator < FrameTimeMinimum)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DeltaTimeAccumulator = 0;
|
||||
|
||||
// Setup JSON object
|
||||
TSharedRef<FJsonObject> RootJson(new FJsonObject());
|
||||
TSharedRef<FJsonObject> PlayerJson(new FJsonObject());
|
||||
TSharedRef<FJsonObject> EnvironmentJson(new FJsonObject());
|
||||
RootJson->SetObjectField("Player", PlayerJson);
|
||||
RootJson->SetObjectField("Environment", EnvironmentJson);
|
||||
// Setup JSON writer to be used before returning
|
||||
FString Buffer;
|
||||
TSharedRef<TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&Buffer);
|
||||
|
||||
AUTPlayerController* UTPC = nullptr;
|
||||
AUTGameState* GS = nullptr;
|
||||
const TIndirectArray<FWorldContext>& AllWorlds = GEngine->GetWorldContexts();
|
||||
for (const FWorldContext& Context : AllWorlds)
|
||||
{
|
||||
UWorld* World = Context.World();
|
||||
if (World && World->WorldType == EWorldType::Game)
|
||||
{
|
||||
UTPC = Cast<AUTPlayerController>(GEngine->GetFirstLocalPlayerController(World));
|
||||
if (UTPC)
|
||||
{
|
||||
UUTLocalPlayer* UTLP = Cast<UUTLocalPlayer>(UTPC->GetLocalPlayer());
|
||||
if (UTLP == nullptr || UTLP->IsMenuGame())
|
||||
{
|
||||
UTPC = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
GS = World->GetGameState<AUTGameState>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!UTPC || !GS)
|
||||
{
|
||||
RootJson->SetStringField("State", "MainMenu");
|
||||
FJsonSerializer::Serialize(RootJson, Writer);
|
||||
WritePipe(Buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update environment data
|
||||
if (GS->GetGameModeClass())
|
||||
{
|
||||
EnvironmentJson->SetStringField("GameMode", GS->GetGameModeClass()->GetName());
|
||||
}
|
||||
EnvironmentJson->SetBoolField("MatchStarted", GS->HasMatchStarted());
|
||||
EnvironmentJson->SetNumberField("GoalScore", GS->GoalScore);
|
||||
// Insert GameState JsonReport
|
||||
GS->MakeJsonReport(EnvironmentJson);
|
||||
// The JsonReport may contain all players, which is a bit too much
|
||||
if (EnvironmentJson->HasField("Players"))
|
||||
{
|
||||
EnvironmentJson->RemoveField("Players");
|
||||
}
|
||||
|
||||
// Update player data
|
||||
// If character not found player must be spectating(?)
|
||||
if (!UTPC->GetUTCharacter())
|
||||
{
|
||||
RootJson->SetStringField("State", "Spectating");
|
||||
}
|
||||
// If dead, don't try reading HP/Armor
|
||||
else if (UTPC->GetUTCharacter()->IsDead())
|
||||
{
|
||||
RootJson->SetStringField("State", "Dead");
|
||||
PlayerJson->SetNumberField("Health", 0);
|
||||
PlayerJson->SetNumberField("Armor", 0);
|
||||
}
|
||||
// Player is found and alive
|
||||
else
|
||||
{
|
||||
// Update HP and armor
|
||||
RootJson->SetStringField("State", "Alive");
|
||||
PlayerJson->SetNumberField("Health", UTPC->GetUTCharacter()->Health);
|
||||
PlayerJson->SetNumberField("Armor", UTPC->GetUTCharacter()->ArmorAmount);
|
||||
|
||||
// Update player powerups data
|
||||
TSharedRef<FJsonObject> InventoryJson(new FJsonObject());
|
||||
PlayerJson->SetObjectField("Inventory", InventoryJson);
|
||||
InventoryJson->SetBoolField("HasJumpBoots", false);
|
||||
InventoryJson->SetBoolField("HasInvisibility", false);
|
||||
InventoryJson->SetBoolField("HasBerserk", false);
|
||||
InventoryJson->SetBoolField("HasUDamage", false);
|
||||
InventoryJson->SetBoolField("HasThighPads", false);
|
||||
InventoryJson->SetBoolField("HasShieldBelt", false);
|
||||
InventoryJson->SetBoolField("HasChestArmor", false);
|
||||
InventoryJson->SetBoolField("HasHelmet", false);
|
||||
|
||||
for (TInventoryIterator<> It(UTPC->GetUTCharacter()); It; ++It)
|
||||
{
|
||||
AUTInventory* InventoryItem = (*It);
|
||||
// Using Contains here because pickups might have slighty different names in different contexts
|
||||
if (InventoryItem->GetClass()->GetName().Contains("Armor_ThighPads"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasThighPads", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("Armor_ShieldBelt"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasShieldBelt", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("Armor_Chest"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasChestArmor", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("Armor_Helmet"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasHelmet", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("JumpBoots"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasJumpBoots", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("Invis"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasInvisibility", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("Berserk"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasBerserk", true);
|
||||
}
|
||||
else if (InventoryItem->GetClass()->GetName().Contains("UDamage"))
|
||||
{
|
||||
InventoryJson->SetBoolField("HasUDamage", true);
|
||||
}
|
||||
}
|
||||
|
||||
// Update player weapon data
|
||||
TSharedRef<FJsonObject> WeaponJson(new FJsonObject());
|
||||
PlayerJson->SetObjectField("Weapon", WeaponJson);
|
||||
if (UTPC->GetUTCharacter()->GetWeapon())
|
||||
{
|
||||
WeaponJson->SetStringField("Name", UTPC->GetUTCharacter()->GetWeapon()->GetClass()->GetName());
|
||||
WeaponJson->SetNumberField("Ammo", UTPC->GetUTCharacter()->GetWeapon()->Ammo);
|
||||
WeaponJson->SetNumberField("MaxAmmo", UTPC->GetUTCharacter()->GetWeapon()->MaxAmmo);
|
||||
WeaponJson->SetBoolField("IsFiring", UTPC->GetUTCharacter()->GetWeapon()->IsFiring());
|
||||
WeaponJson->SetNumberField("FireMode", UTPC->GetUTCharacter()->GetWeapon()->GetCurrentFireMode());
|
||||
WeaponJson->SetNumberField("ZoomState", UTPC->GetUTCharacter()->GetWeapon()->ZoomState);
|
||||
}
|
||||
else {
|
||||
WeaponJson->SetStringField("Name", "None");
|
||||
}
|
||||
}
|
||||
// Insert PlayerState JsonReport
|
||||
TSharedRef<FJsonObject> PlayerStateJson(new FJsonObject());
|
||||
PlayerJson->SetObjectField("State", PlayerStateJson);
|
||||
if (UTPC->UTPlayerState)
|
||||
{
|
||||
UTPC->UTPlayerState->MakeJsonReport(PlayerStateJson);
|
||||
}
|
||||
|
||||
FJsonSerializer::Serialize(RootJson, Writer);
|
||||
WritePipe(Buffer);
|
||||
}
|
||||
|
||||
void FArtemis::WritePipe(FString msg)
|
||||
{
|
||||
pipe = CreateFile(TEXT("\\\\.\\pipe\\artemis"), GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr);
|
||||
if (pipe == nullptr || pipe == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 BytesWritten = 0;
|
||||
WriteFile(pipe, TCHAR_TO_ANSI(*msg), msg.Len(), (::DWORD*)&BytesWritten, nullptr);
|
||||
}
|
||||
41
Artemis/UnrealTournament2Artemis/Source/Private/Artemis.h
Normal file
41
Artemis/UnrealTournament2Artemis/Source/Private/Artemis.h
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "Core.h"
|
||||
#include "UnrealTournament.h"
|
||||
#include "JsonSerializer.h"
|
||||
#include "JsonObject.h"
|
||||
#include "JsonReader.h"
|
||||
|
||||
#include "Artemis.generated.h"
|
||||
|
||||
UCLASS(Blueprintable, Meta = (ChildCanTick))
|
||||
class AArtemis : public AActor
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
};
|
||||
|
||||
struct FArtemis : FTickableGameObject, IModuleInterface
|
||||
{
|
||||
FArtemis();
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
virtual bool IsTickable() const override { return true; }
|
||||
virtual bool IsTickableInEditor() const override { return true; }
|
||||
virtual bool IsTickableWhenPaused() const override { return true; }
|
||||
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
// Put a real stat id here
|
||||
virtual TStatId GetStatId() const
|
||||
{
|
||||
return TStatId();
|
||||
}
|
||||
|
||||
void WritePipe(FString msg);
|
||||
HANDLE pipe;
|
||||
float DeltaTimeAccumulator;
|
||||
float FrameTimeMinimum;
|
||||
uint64 LastFrameCounter;
|
||||
};
|
||||
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3541864F-1662-4BD6-8328-2C87AE61D152}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>UnrealTournament2Artemis</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;UNREALTOURNAMENT2ARTEMIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;UNREALTOURNAMENT2ARTEMIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UNREALTOURNAMENT2ARTEMIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;UNREALTOURNAMENT2ARTEMIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Intermediate\Build\Win64\UE4\Inc\Artemis\Artemis.generated.cpp" />
|
||||
<ClCompile Include="Intermediate\Build\Win64\UE4\Shipping\Artemis\Module.Artemis.cpp" />
|
||||
<ClCompile Include="Source\Private\Artemis.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Intermediate\Build\Win64\UE4\Inc\Artemis\Artemis.generated.dep.h" />
|
||||
<ClInclude Include="Intermediate\Build\Win64\UE4\Inc\Artemis\Artemis.generated.h" />
|
||||
<ClInclude Include="Intermediate\Build\Win64\UE4\Inc\Artemis\ArtemisClasses.h" />
|
||||
<ClInclude Include="Source\Private\Artemis.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Artemis.uplugin" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source\Private\Artemis.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Intermediate\Build\Win64\UE4\Inc\Artemis\Artemis.generated.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Intermediate\Build\Win64\UE4\Shipping\Artemis\Module.Artemis.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Source\Private\Artemis.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Intermediate\Build\Win64\UE4\Inc\Artemis\Artemis.generated.dep.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Intermediate\Build\Win64\UE4\Inc\Artemis\Artemis.generated.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Intermediate\Build\Win64\UE4\Inc\Artemis\ArtemisClasses.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Artemis.uplugin" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
x
Reference in New Issue
Block a user