Skip to content
Permalink
Browse files

Complete game options.

  • Loading branch information...
roncli committed Jul 4, 2015
1 parent c81115c commit 3dcfc57ab9e9c9c99043916adeb6753153a65366
Showing with 404 additions and 64 deletions.
  1. +1 −0 missions.json
  2. +1 −1 package.json
  3. +4 −0 public/css/bootstrap-override.css
  4. +78 −3 public/js/ddsn.js
  5. +215 −1 public/templates/add-server-game.htm
  6. +105 −59 websocket.js

Large diffs are not rendered by default.

@@ -20,7 +20,7 @@
"dependencies": {
"descent3console": "0.1.2",
"descent3launcher": "0.1.2",
"descent3mn3tools": "0.1.0",
"descent3mn3tools": "0.1.1",
"express": "4.13.0",
"handlebars": "3.0.3",
"ws": "0.7.2"
@@ -4,4 +4,8 @@

.input-group-addon:last-child {
border-right: none;
}

table {
font-size: inherit;
}
@@ -17,7 +17,8 @@ var app = angular.module("ddsn", []),
{difficulty: 2, name: "Hotshot"},
{difficulty: 3, name: "Ace"},
{difficulty: 4, name: "Insane"}
]
],
selectMissionToggle: true
};

(function() {
@@ -278,6 +279,77 @@ var app = angular.module("ddsn", []),
data.settings.addServer.game.timeLimitValid = data.settings.addServer.game.timeLimit === null || (typeof data.settings.addServer.game.timeLimit === "number" && data.settings.addServer.game.timeLimit >= 1 && data.settings.addServer.game.timeLimit % 1 === 0);
};

$scope.missionSearch = function() {
if (data.settings.addServer.game.missionSearch.length < 2) {
return;
}

var searchStrings = data.settings.addServer.game.missionSearch.toLowerCase().replace(/[^a-zA-Z0-9'\-\.]+/, " ").trim().split(" ");

data.missionsList = data.missions.filter(function(mission) {
var index;

if (
(data.settings.addServer.game.scriptName === 'ctf' && !mission.data.gameTypes.ctf) ||
(data.settings.addServer.game.scriptName === 'entropy' && !mission.data.gameTypes.entropy) ||
(data.settings.addServer.game.scriptName === 'hoard' && !mission.data.gameTypes.hoard) ||
(data.settings.addServer.game.scriptName === 'monsterball' && !mission.data.gameTypes.monsterball)
) {
return false;
}

for (index = 0; index < searchStrings.length; index++) {
if (mission.mission.indexOf(searchStrings[index]) === -1) {
return false;
}
}
return true;
});

data.selectMissionToggle = true;
};

$scope.refreshMissions = function() {
data.loadingMissions = true;
ws.send(JSON.stringify({
message: "missions"
}));
};

$scope.selectMission = function(mission) {
data.settings.addServer.game.selectedMission = mission;
data.settings.addServer.game.missionName = mission.shortFilename;
data.selectMissionToggle = false;
data.settings.addServer.game.setLevel = 1;
};

$scope.updateAddServerGameTeamName = function(teamNum) {
if (data.settings.addServer.game.setTeamName[teamNum].length === 0) {
switch (teamNum) {
case 0:
data.settings.addServer.game.setTeamName[0] = "Red";
break;
case 1:
data.settings.addServer.game.setTeamName[1] = "Blue";
break;
case 2:
data.settings.addServer.game.setTeamName[2] = "Green";
break;
case 3:
data.settings.addServer.game.setTeamName[3] = "Yellow";
break;
}
}
};

$scope.updateAddServerGameRespawnTime = function() {
data.settings.addServer.game.respawnTimeValid = data.settings.addServer.game.respawnTime === null || (typeof data.settings.addServer.game.respawnTime === "number" && data.settings.addServer.game.respawnTime >= 1 && data.settings.addServer.game.respawnTime % 1 === 0);
};

$scope.updateAddServerGameAudioTauntDelay = function() {
data.settings.addServer.game.audioTauntDelayValid = data.settings.addServer.game.audioTauntDelay === null || (typeof data.settings.addServer.game.audioTauntDelay === "number" && data.settings.addServer.game.audioTauntDelay >= 1 && data.settings.addServer.game.audioTauntDelay % 1 === 0);
};

$scope.updateSettingsDescent3Path = function() {
ws.send(JSON.stringify({
message: "settings.descent3.path",
@@ -316,10 +388,13 @@ var app = angular.module("ddsn", []),

switch (message.message) {
case "missions":
// TODO: Handle missions
data.missions = message.missions;
data.loadingMissions = false;
scope.$apply();
break;
case "missions.progress":
// TODO: Handle missinos progress
data.loadingMissionPercent = message.percent;
scope.$apply();
break;
case "settings":
for (key in message.settings) {

0 comments on commit 3dcfc57

Please sign in to comment.
You can’t perform that action at this time.