Add brand to winlist, Inject json on active, clean up

This commit is contained in:
MrARM
2018-09-03 00:03:04 -05:00
parent 36a6b47802
commit cbc0995045
7 changed files with 117 additions and 73 deletions

152
.idea/workspace.xml generated
View File

@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="792feb45-6e3f-45d4-a001-5c7cbb169965" name="Default" comment="" />
<list default="true" id="792feb45-6e3f-45d4-a001-5c7cbb169965" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/TODO" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/shows.js" beforeDir="false" afterPath="$PROJECT_DIR$/routes/shows.js" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@@ -12,11 +17,11 @@
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="app.js" pinned="false" current-in-tab="false">
<file leaf-file-name="app.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-238">
<caret line="76" column="31" selection-start-line="76" selection-start-column="31" selection-end-line="76" selection-end-column="31" />
<state relative-caret-position="418">
<caret line="194" column="73" selection-start-line="194" selection-start-column="73" selection-end-line="194" selection-end-column="73" />
</state>
</provider>
</entry>
@@ -33,17 +38,8 @@
<file leaf-file-name="shows.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/routes/shows.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-197">
<caret line="15" column="58" selection-start-line="15" selection-start-column="58" selection-end-line="15" selection-end-column="58" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="style.css" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/public/stylesheets/style.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="87">
<caret line="9015" column="29" selection-start-line="9015" selection-start-column="29" selection-end-line="9015" selection-end-column="29" />
<state relative-caret-position="449">
<caret line="47" column="77" selection-start-line="47" selection-start-column="77" selection-end-line="47" selection-end-column="77" />
</state>
</provider>
</entry>
@@ -60,13 +56,13 @@
<file leaf-file-name="config.json" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config.json">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="1" selection-start-column="1" selection-end-column="1" />
<state relative-caret-position="68">
<caret line="4" column="20" selection-start-line="4" selection-start-column="20" selection-end-line="4" selection-end-column="20" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="true">
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
@@ -75,11 +71,20 @@
</provider>
</entry>
</file>
<file leaf-file-name="TODO" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/TODO">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="15" selection-start-column="15" selection-end-column="15" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="index.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/routes/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="64" selection-start-line="4" selection-start-column="64" selection-end-line="4" selection-end-column="64" />
<caret line="4" column="55" selection-start-line="4" selection-start-column="40" selection-end-line="4" selection-end-column="55" />
</state>
</provider>
</entry>
@@ -97,7 +102,7 @@
<entry file="file://$PROJECT_DIR$/routes/pac.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="9" column="27" lean-forward="true" selection-start-line="9" selection-start-column="27" selection-end-line="9" selection-end-column="27" />
<caret line="9" column="27" selection-start-line="9" selection-start-column="27" selection-end-line="9" selection-end-column="27" />
</state>
</provider>
</entry>
@@ -130,6 +135,9 @@
<replace>,</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
@@ -141,15 +149,16 @@
<option value="$PROJECT_DIR$/config.backup.json" />
<option value="$PROJECT_DIR$/routes/me.js" />
<option value="$PROJECT_DIR$/views/error.ejs" />
<option value="$PROJECT_DIR$/routes/shows.js" />
<option value="$PROJECT_DIR$/public/robots.txt" />
<option value="$PROJECT_DIR$/routes/pac.js" />
<option value="$PROJECT_DIR$/routes/index.js" />
<option value="$PROJECT_DIR$/views/pac.ejs" />
<option value="$PROJECT_DIR$/views/index.ejs" />
<option value="$PROJECT_DIR$/app.js" />
<option value="$PROJECT_DIR$/config.json" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/routes/shows.js" />
<option value="$PROJECT_DIR$/TODO" />
<option value="$PROJECT_DIR$/config.json" />
<option value="$PROJECT_DIR$/app.js" />
</list>
</option>
</component>
@@ -184,6 +193,16 @@
<item name="HQAdmin" type="b2602c69:ProjectViewProjectNode" />
<item name="HQAdmin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="HQAdmin" type="b2602c69:ProjectViewProjectNode" />
<item name="HQAdmin" type="462c0819:PsiDirectoryNode" />
<item name="routes" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="HQAdmin" type="b2602c69:ProjectViewProjectNode" />
<item name="HQAdmin" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
@@ -267,12 +286,12 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1535813979689</updated>
<workItem from="1535813994908" duration="44205000" />
<workItem from="1535813994908" duration="46526000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="44205000" />
<option name="totallyTimeSpent" value="46526000" />
</component>
<component name="ToolWindowManager">
<frame x="-1928" y="-8" width="1936" height="1056" extended-state="6" />
@@ -286,13 +305,13 @@
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="right" id="Maven Projects" />
<window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
<window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.32897604" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32897604" />
<window_info anchor="bottom" id="Version Control" />
<window_info id="npm" side_tool="true" />
<window_info anchor="bottom" id="Terminal" weight="0.32897604" />
<window_info id="Capture Tool" />
<window_info id="Designer" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.16666667" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16666667" />
<window_info anchor="right" id="Database" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32897604" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
@@ -391,34 +410,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/shows.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-197">
<caret line="15" column="58" selection-start-line="15" selection-start-column="58" selection-end-line="15" selection-end-column="58" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/pac.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="9" column="27" lean-forward="true" selection-start-line="9" selection-start-column="27" selection-end-line="9" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="64" selection-start-line="4" selection-start-column="64" selection-end-line="4" selection-end-column="64" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/error.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="7" column="18" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/pac.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
@@ -433,24 +424,59 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.js">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-238">
<caret line="76" column="31" selection-start-line="76" selection-start-column="31" selection-end-line="76" selection-end-column="31" />
<state relative-caret-position="34">
<caret line="2" column="5" selection-start-line="2" selection-start-column="5" selection-end-line="2" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/pac.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="9" column="27" selection-start-line="9" selection-start-column="27" selection-end-line="9" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="55" selection-start-line="4" selection-start-column="40" selection-end-line="4" selection-end-column="55" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/shows.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="449">
<caret line="47" column="77" selection-start-line="47" selection-start-column="77" selection-end-line="47" selection-end-column="77" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/error.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="7" column="18" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/TODO">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="15" selection-start-column="15" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config.json">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="1" selection-start-column="1" selection-end-column="1" />
<state relative-caret-position="68">
<caret line="4" column="20" selection-start-line="4" selection-start-column="20" selection-end-line="4" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="5" selection-start-line="2" selection-start-column="5" selection-end-line="2" selection-end-column="5" />
<state relative-caret-position="418">
<caret line="194" column="73" selection-start-line="194" selection-start-column="73" selection-end-line="194" selection-end-column="73" />
</state>
</provider>
</entry>

3
TODO Normal file
View File

@@ -0,0 +1,3 @@
Upload to vultr
Add current balance
Add answer bots

25
app.js
View File

@@ -104,6 +104,8 @@ wss.on('connection', function (ws, ureq) {
var masterPingTimeout = null;
var masterPingInterval = null;
var broadcastId = 0;
var payout = 500000;
var users = 0;
var msgt = (new Date().getTime()).toString();
//First connect
ws.send(sys('Connecting to HQ...'));
@@ -176,11 +178,30 @@ wss.on('connection', function (ws, ureq) {
if(obj.interceptor.discord.enabled){
try{
var msg = JSON.parse(message);
if(msg.type != "interaction"){
var modified = false;
if(msg.type === "questionSummary") {
users = msg.advancingPlayersCount;
var cash = (payout/users)/100;
ws.send(sys('Current payout: '+cash.toLocaleString("en-US", {style:"currency", currency:"USD"})));
}
if(msg.type === "gameStatus") {
payout = msg.prizeCents;
}
if(msg.type === "gameSummary"){
//Inject TES to winnerlist
modified = true;
var tesplayer = {"name":"TES","id":0,"avatarUrl":"https://d2xu1hdomh3nrx.cloudfront.net/avatars/f8502122aa594246bc11eeb60ea0b516-15284031.jpg","prize":"THX 4 PLAYING","wins":0};
msg.winners.unshift(tesplayer);
ws.send(JSON.stringify(msg));
}
if(msg.type !== "interaction" && !modified){
ws.send(message);
}
} catch (e) {
ws.send(message);
try{
ws.send(message);
} catch(e){}
}
}

View File

@@ -1,3 +0,0 @@
{"type":"chatVisibilityToggled","chatVisible":true}
{"type":"chatVisibilityToggled","chatVisible":true}
{"type":"subscribe","broadcastId":44433}

View File

@@ -1,3 +0,0 @@
{"type":"chatVisibilityToggled","chatVisible":true}
{"type":"chatVisibilityToggled","chatVisible":true}
{"type":"subscribe","broadcastId":44433}

View File

@@ -1,2 +0,0 @@
{"type":"subscribe","broadcastId":44433}
{"type":"chatVisibilityToggled","chatVisible":true}

View File

@@ -44,6 +44,8 @@ router.all('/', function(req, res, next) {
output.broadcast.streams.passthrough = obj.streamURL;
output.broadcast.streams.source = obj.streamURL;
output.broadcast.streamUrl = obj.streamURL;
} else if(output.active){
output.broadcast.socketUrl = 'ws://'+req.get('host')+':40510/';
}
res.json(output);
});