From b17c7575d67fc4d49a8334f8a486c486c9ce8602 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Tue, 5 May 2015 19:59:41 -0400 Subject: [PATCH] Added RenX.HybridUUID --- Jupiter Bot.sln | 28 +++++- RenX.HybridUUID/RenX.HybridUUID.vcxproj | 85 +++++++++++++++++++ .../RenX.HybridUUID.vcxproj.filters | 38 +++++++++ RenX.HybridUUID/RenX_HybridUUID.cpp | 59 +++++++++++++ RenX.HybridUUID/RenX_HybridUUID.h | 40 +++++++++ 5 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 RenX.HybridUUID/RenX.HybridUUID.vcxproj create mode 100644 RenX.HybridUUID/RenX.HybridUUID.vcxproj.filters create mode 100644 RenX.HybridUUID/RenX_HybridUUID.cpp create mode 100644 RenX.HybridUUID/RenX_HybridUUID.h diff --git a/Jupiter Bot.sln b/Jupiter Bot.sln index 40d22a9..ba2ecdd 100644 --- a/Jupiter Bot.sln +++ b/Jupiter Bot.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bot", "Bot\Bot.vcxproj", "{C188871B-5F32-4946-B301-24CA2EBB275D}" EndProject @@ -133,6 +133,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.Warn", "RenX.Warn\RenX {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.Stats", "RenX.Stats\RenX.Stats.vcxproj", "{3D059AAF-9F6C-4C18-BEBD-E64947F463EB}" + ProjectSection(ProjectDependencies) = postProject + {C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D} + {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.NicknameUUID", "RenX.NicknameUUID\RenX.NicknameUUID.vcxproj", "{553C70DE-37B7-4C31-985B-591BEC238C9D}" + ProjectSection(ProjectDependencies) = postProject + {C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D} + {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.HybridUUID", "RenX.HybridUUID\RenX.HybridUUID.vcxproj", "{FF61361F-CB09-4C72-80E2-9CA2DA63910E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -231,6 +245,18 @@ Global {41C67B8B-D84D-42C2-B174-200B2ACB19C0}.Debug|Win32.Build.0 = Debug|Win32 {41C67B8B-D84D-42C2-B174-200B2ACB19C0}.Release|Win32.ActiveCfg = Release|Win32 {41C67B8B-D84D-42C2-B174-200B2ACB19C0}.Release|Win32.Build.0 = Release|Win32 + {3D059AAF-9F6C-4C18-BEBD-E64947F463EB}.Debug|Win32.ActiveCfg = Debug|Win32 + {3D059AAF-9F6C-4C18-BEBD-E64947F463EB}.Debug|Win32.Build.0 = Debug|Win32 + {3D059AAF-9F6C-4C18-BEBD-E64947F463EB}.Release|Win32.ActiveCfg = Release|Win32 + {3D059AAF-9F6C-4C18-BEBD-E64947F463EB}.Release|Win32.Build.0 = Release|Win32 + {553C70DE-37B7-4C31-985B-591BEC238C9D}.Debug|Win32.ActiveCfg = Debug|Win32 + {553C70DE-37B7-4C31-985B-591BEC238C9D}.Debug|Win32.Build.0 = Debug|Win32 + {553C70DE-37B7-4C31-985B-591BEC238C9D}.Release|Win32.ActiveCfg = Release|Win32 + {553C70DE-37B7-4C31-985B-591BEC238C9D}.Release|Win32.Build.0 = Release|Win32 + {FF61361F-CB09-4C72-80E2-9CA2DA63910E}.Debug|Win32.ActiveCfg = Debug|Win32 + {FF61361F-CB09-4C72-80E2-9CA2DA63910E}.Debug|Win32.Build.0 = Debug|Win32 + {FF61361F-CB09-4C72-80E2-9CA2DA63910E}.Release|Win32.ActiveCfg = Release|Win32 + {FF61361F-CB09-4C72-80E2-9CA2DA63910E}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RenX.HybridUUID/RenX.HybridUUID.vcxproj b/RenX.HybridUUID/RenX.HybridUUID.vcxproj new file mode 100644 index 0000000..d1d9d02 --- /dev/null +++ b/RenX.HybridUUID/RenX.HybridUUID.vcxproj @@ -0,0 +1,85 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {FF61361F-CB09-4C72-80E2-9CA2DA63910E} + RenX.HybridUUID + + + + Application + true + v120 + MultiByte + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\Plugins\ + AllRules.ruleset + + + + Level3 + Disabled + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + ../Bot;../Jupiter;../RenX.Core + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + true + true + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RenX.HybridUUID/RenX.HybridUUID.vcxproj.filters b/RenX.HybridUUID/RenX.HybridUUID.vcxproj.filters new file mode 100644 index 0000000..274faf5 --- /dev/null +++ b/RenX.HybridUUID/RenX.HybridUUID.vcxproj.filters @@ -0,0 +1,38 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Resource Files + + + Resource Files + + + Resource Files + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/RenX.HybridUUID/RenX_HybridUUID.cpp b/RenX.HybridUUID/RenX_HybridUUID.cpp new file mode 100644 index 0000000..6296e53 --- /dev/null +++ b/RenX.HybridUUID/RenX_HybridUUID.cpp @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2015 Justin James. + * + * This license must be preserved. + * Any applications, libraries, or code which make any use of any + * component of this program must not be commercial, unless explicit + * permission is granted from the original author. The use of this + * program for non-profit purposes is permitted. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * In the event that this license restricts you from making desired use of this program, contact the original author. + * Written by Justin James + */ + +#include "Jupiter/String.h" +#include "RenX_Core.h" +#include "RenX_Server.h" +#include "RenX_PlayerInfo.h" +#include "RenX_Functions.h" +#include "RenX_HybridUUID.h" + +Jupiter::StringS calc_uuid(RenX::PlayerInfo *player) +{ + if (player->steamid != 0U) + return Jupiter::StringS::Format("S%.16llX", player->steamid); + return Jupiter::StringS::Format("N%.*s", player->name.size(), player->name.ptr());; +} + +RenX_HybridUUIDPlugin::RenX_HybridUUIDPlugin() +{ + RenX::Core &core = *RenX::getCore(); + size_t index = core.getServerCount(); + while (index != 0) + core.getServer(--index)->setUUIDFunction(calc_uuid); +} + +RenX_HybridUUIDPlugin::~RenX_HybridUUIDPlugin() +{ + RenX::Core &core = *RenX::getCore(); + size_t index = core.getServerCount(); + while (index != 0) + core.getServer(--index)->setUUIDFunction(RenX::default_uuid_func); +} + +void RenX_HybridUUIDPlugin::RenX_OnServerCreate(RenX::Server *server) +{ + server->setUUIDFunction(calc_uuid); +} + +// Plugin instantiation and entry point. +RenX_HybridUUIDPlugin pluginInstance; + +extern "C" __declspec(dllexport) Jupiter::Plugin *getPlugin() +{ + return &pluginInstance; +} diff --git a/RenX.HybridUUID/RenX_HybridUUID.h b/RenX.HybridUUID/RenX_HybridUUID.h new file mode 100644 index 0000000..16b49ea --- /dev/null +++ b/RenX.HybridUUID/RenX_HybridUUID.h @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2015 Justin James. + * + * This license must be preserved. + * Any applications, libraries, or code which make any use of any + * component of this program must not be commercial, unless explicit + * permission is granted from the original author. The use of this + * program for non-profit purposes is permitted. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * In the event that this license restricts you from making desired use of this program, contact the original author. + * Written by Justin James + */ + +#if !defined _RENX_HYBRIDUUID_H_HEADER +#define _RENX_HYBRIDUUID_H_HEADER + +#include "Jupiter/Plugin.h" +#include "Jupiter/Reference_String.h" +#include "RenX_Plugin.h" + +class RenX_HybridUUIDPlugin : public RenX::Plugin +{ +public: // RenX::Plugin + void RenX_OnServerCreate(RenX::Server *server) override; + +public: // Jupiter::Plugin + const Jupiter::ReadableString &getName() override { return name; } + + RenX_HybridUUIDPlugin(); + ~RenX_HybridUUIDPlugin(); + +private: + STRING_LITERAL_AS_NAMED_REFERENCE(name, "RenX_TemplatePlugin"); +}; + +#endif // _RENX_HYBRIDUUID_H_HEADER \ No newline at end of file