diff --git a/@twc_framework/addons/twc_discord/CfgDiscordRichPresence.hpp b/@twc_framework/addons/twc_discord/CfgDiscordRichPresence.hpp new file mode 100644 index 000000000..21003bbc2 --- /dev/null +++ b/@twc_framework/addons/twc_discord/CfgDiscordRichPresence.hpp @@ -0,0 +1,10 @@ +class CfgDiscordRichPresence { + applicationID = "877650991036649532"; + defaultDetails = "On the Main Menu"; + defaultState = "Wondering how I got here"; + defaultLargeImageKey = "default"; + defaultLargeImageText = "Main Menu"; + defaultSmallImageKey = "default"; + defaultSmallImageText = "Main Menu"; + useTimeElapsed = 1; +}; \ No newline at end of file diff --git a/@twc_framework/addons/twc_discord/CfgEventHandlers.hpp b/@twc_framework/addons/twc_discord/CfgEventHandlers.hpp new file mode 100644 index 000000000..c96ac2d37 --- /dev/null +++ b/@twc_framework/addons/twc_discord/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PostInit_EventHandlers { + class twc_discord { + clientInit = "_this call twc_discord_fnc_postInit"; + }; +}; diff --git a/@twc_framework/addons/twc_discord/CfgFunctions.hpp b/@twc_framework/addons/twc_discord/CfgFunctions.hpp new file mode 100644 index 000000000..896e41eac --- /dev/null +++ b/@twc_framework/addons/twc_discord/CfgFunctions.hpp @@ -0,0 +1,9 @@ +class CfgFunctions { + class twc_discord { + class functions { + file = "twc_discord\functions"; + + class postInit {}; + }; + }; +}; diff --git a/@twc_framework/addons/twc_discord/config.cpp b/@twc_framework/addons/twc_discord/config.cpp new file mode 100644 index 000000000..7889793a0 --- /dev/null +++ b/@twc_framework/addons/twc_discord/config.cpp @@ -0,0 +1,21 @@ +class CfgPatches { + class twc_discord { + units[] = {}; + weapons[] = {}; + + requiredAddons[] = { + "TWC_Core" + }; + + author = "ConnorAU / Bosenator"; + authorUrl = "http://thewreckingcrew.eu"; + version = "1"; + versionStr = "1"; + versionAr[] = {1}; + requiredVersion = 2; + }; +}; + +#include "CfgDiscordRichPresence.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgFunctions.hpp" \ No newline at end of file diff --git a/@twc_framework/addons/twc_discord/functions/fn_postInit.sqf b/@twc_framework/addons/twc_discord/functions/fn_postInit.sqf new file mode 100644 index 000000000..8c8333523 --- /dev/null +++ b/@twc_framework/addons/twc_discord/functions/fn_postInit.sqf @@ -0,0 +1,41 @@ +if !(hasInterface) exitWith {}; + +if (is3DEN) exitWith { + // in the editor, editing... + + [ + ["UpdateDetails","In the editor, editing..."], + ["UpdateState", "On " + worldName], + ["UpdateLargeImageKey","editor"], + ["UpdateSmallImageKey","editor"], + ["UpdateStartTimestamp", [0, 0]], + ["UpdateButtons", ["TWC", "https://thewreckingcrew.eu"]] + ] call (missionNameSpace getVariable ["DiscordRichPresence_fnc_update", {}]); +}; + +private _role = [(configFile >> "CfgVehicles" >> typeOf player), "displayName", "Unknown Role"] call BIS_fnc_returnConfigEntry; +private _mission = getMissionConfigValue ["onLoadName", getMissionConfigValue ["briefingName", "Untitled"]]; + +if (TWC_Core_isPublic) exitWith { + [ + ["UpdateDetails","Playing as " + _role], + ["UpdateState", "On " + _mission], + ["UpdateLargeImageKey","public"], + ["UpdateSmallImageKey","public"], + ["UpdateStartTimestamp", [0, 0]], + ["UpdateButtons",["TWC", "https://thewreckingcrew.eu"]] + ] call (missionNameSpace getVariable ["DiscordRichPresence_fnc_update", {}]); +}; + +private _era = missionNameSpace getVariable ["era", "modern"]; +if (_era == "1990") then { _era = "millennial"; }; +// modern, millennial, coldwar, ww2, mmo + +[ + ["UpdateDetails","Playing as " + _role], + ["UpdateState", "On " + _mission], + ["UpdateLargeImageKey", _era], + ["UpdateSmallImageKey", _era], + ["UpdateStartTimestamp", [0, 0]], + ["UpdateButtons", ["TWC", "https://thewreckingcrew.eu"]] +] call (missionNameSpace getVariable ["DiscordRichPresence_fnc_update", {}]); \ No newline at end of file diff --git a/@twc_framework/addons/twc_discord/readme.md b/@twc_framework/addons/twc_discord/readme.md new file mode 100644 index 000000000..39c3770f4 --- /dev/null +++ b/@twc_framework/addons/twc_discord/readme.md @@ -0,0 +1,7 @@ +# Discord +This PBO manages Discord Integrations, made possible by two addons from http://github.com/ConnorAU + +## Rich Presence +Configures and adds functionality to update the Discord Rich Presence to inform others what they're doing inside of Arma 3. Requires the https://steamcommunity.com/sharedfiles/filedetails/?id=1493485159 addon to be running on the client. + +![](https://i.imgur.com/BuIJLFl.png) \ No newline at end of file