Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions @twc_framework/addons/twc_discord/CfgDiscordRichPresence.hpp
Original file line number Diff line number Diff line change
@@ -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;
};
5 changes: 5 additions & 0 deletions @twc_framework/addons/twc_discord/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Extended_PostInit_EventHandlers {
class twc_discord {
clientInit = "_this call twc_discord_fnc_postInit";
};
};
9 changes: 9 additions & 0 deletions @twc_framework/addons/twc_discord/CfgFunctions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CfgFunctions {
class twc_discord {
class functions {
file = "twc_discord\functions";

class postInit {};
};
};
};
21 changes: 21 additions & 0 deletions @twc_framework/addons/twc_discord/config.cpp
Original file line number Diff line number Diff line change
@@ -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"
41 changes: 41 additions & 0 deletions @twc_framework/addons/twc_discord/functions/fn_postInit.sqf
Original file line number Diff line number Diff line change
@@ -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", {}]);
7 changes: 7 additions & 0 deletions @twc_framework/addons/twc_discord/readme.md
Original file line number Diff line number Diff line change
@@ -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)