Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit e123473

Browse files
committed
Merge branch 'release/1.0.5.1'
2 parents febfce4 + 1e0a272 commit e123473

8 files changed

Lines changed: 71 additions & 40 deletions

File tree

app/js/AdvisoryList.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ var AdvisoryList = {
1010
Data.advisories = {};
1111
},
1212

13-
lookup: function(systemId) {
13+
lookup: function(systemId) {
1414
var advisories = $.map(AdvisoryList.types, function(t) {
1515
var a = {type: t, systemId: systemId}
1616

1717
if ($.inArray(t, Data.advisories[systemId]) !== -1) a.present = true;
1818

1919
return a;
20-
})
21-
20+
})
2221
return advisories;
2322
},
2423

app/js/SystemMap.js

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@ var SystemMap = {
88

99
// let's count things
1010
hostile_count: function(system) {
11-
if (system == undefined) { return 0; }
12-
return (system.name !== undefined ) ? $.grep(Data.hostiles, function(h) { return system.name === h.systemName && h.is_faded === false; }).length : 0
11+
if (system === undefined) { return 0; }
12+
return (system.name !== undefined ) ? $.grep(Data.hostiles, function(h) { return system.name === h.systemName && h.is_faded === false; }).length : 0;
1313
},
1414

1515
faded_count: function(system) {
16-
if (system == undefined) { return 0; }
17-
return (system.name !== undefined ) ? $.grep(Data.hostiles, function(h) { return system.name === h.systemName && h.is_faded === true; }).length : 0
16+
if (system === undefined) { return 0; }
17+
return (system.name !== undefined ) ? $.grep(Data.hostiles, function(h) { return system.name === h.systemName && h.is_faded === true; }).length : 0;
1818
},
1919

2020
friendly_count: function(system) {
21-
if (system == undefined) { return 0; }
22-
return (system.name !== undefined ) ? $.grep(Data.members, function(h) { return system.name === h.systemName; }).length : 0
21+
if (system === undefined) { return 0; }
22+
return (system.name !== undefined ) ? $.grep(Data.members, function(m) { return system.name === m.systemName; }).length : 0;
23+
},
24+
25+
advisory_count: function(system) {
26+
if (system === undefined) { return 0; }
27+
return (Data.advisories[system.id] instanceof Array) ? Data.advisories[system.id].length : 0;
2328
},
2429

2530
// Given a system, return the class that corresponds to whether a system is hostile or not.
@@ -28,11 +33,13 @@ var SystemMap = {
2833
return "hostile";
2934
} else if ( SystemMap.faded_count(system) > 0 ) {
3035
return "warning";
31-
} else if ( SystemMap.friendly_count(system) > 0 ) {
36+
} else if ( SystemMap.advisory_count(system) > 0 ) {
37+
return "warning";
38+
} else if ( SystemMap.friendly_count(system) > 0 ) {
3239
return "clear";
3340
}
3441
},
35-
42+
3643
// Given a line AB and a point C, finds point D such that CD is perpendicular to AB
3744
getSpPoint: function(A, B, C) {
3845
var x1 = A.x, y1 = A.y, x2 = B.x, y2 = B.y, x3 = C.x, y3 = C.y;
@@ -123,7 +130,7 @@ var SystemMap = {
123130
.data('regionId', system.regionID)
124131
.text( Data.regions[ system.regionID ].name );
125132

126-
SystemMap.updateHud( system.name );
133+
SystemMap.updateHud( system );
127134

128135
var link_groups = link.data(SystemMap.jumps)
129136
.enter().append("g")
@@ -156,11 +163,23 @@ var SystemMap = {
156163
.attr("text-anchor", "middle")
157164
.attr("alignment-baseline", "middle")
158165
.attr("x", rect_width / 2)
159-
.attr("y", -10)
166+
.attr("y", -8)
160167
.text(function(n) {
161-
return UI.advisoryUnicode( Data.advisories[n.system.id] );
168+
return UI.mapUnicode( Data.advisories[n.system.id] );
162169
});
163-
170+
171+
node_groups.append("text")
172+
.attr("class", "hostiles")
173+
.attr("text-anchor", "middle")
174+
.attr("vector-effect", "non-scaling-stroke")
175+
.attr("alignment-baseline", "middle")
176+
.attr("x", rect_width / 2)
177+
.attr("y", 25)
178+
.text(function(n) {
179+
var count = SystemMap.hostile_count(n.system)
180+
return (count > 0) ? count + " " + UI.mapUnicode(['Hostile']) : "";
181+
});
182+
164183
node_groups.on('click', function(n) {
165184
SystemMap.updateInfo( n.system.name );
166185
});
@@ -271,15 +290,15 @@ var SystemMap = {
271290
SystemMap.zoom.event(root);
272291
},
273292

274-
updateHud: function(system_name) {
275-
var system = {name: system_name}
293+
updateHud: function(system) {
294+
var system = {name: system.name, id: system.id }
276295
system.neighbors = $.map(SystemMap.links, function(n) {
277-
if (n.target.system && n.target.system.name === system_name) {
296+
if (n.target.system && n.target.system.name === system.name) {
278297
n.source.hostiles = SystemMap.hostile_count(n.source.system);
279298
n.source.faded = SystemMap.faded_count(n.source.system);
280299
return n.source;
281300
}
282-
if (n.source.system && n.source.system.name === system_name) {
301+
if (n.source.system && n.source.system.name === system.name) {
283302
n.target.hostiles = SystemMap.hostile_count(n.target.system);
284303
n.target.faded = SystemMap.faded_count(n.target.system);
285304
return n.target;
@@ -307,7 +326,7 @@ var SystemMap = {
307326
.data('system-id', Data.state.self.systemId)
308327
.text( Data.systems[ Data.state.self.systemId ].name );
309328

310-
SystemMap.updateHud( Data.systems[ Data.state.self.systemId ].name );
329+
SystemMap.updateHud( Data.systems[ Data.state.self.systemId ] );
311330
},
312331

313332
updateInfo: function(system_name) {
@@ -338,17 +357,17 @@ var SystemMap = {
338357

339358
d3.selectAll('g.node text.advisories')
340359
.text(function(n) {
341-
return UI.advisoryUnicode( Data.advisories[n.system.id] );
360+
return UI.mapUnicode( Data.advisories[n.system.id] );
342361
});
343362

344-
SystemMap.updateHud( Data.systems[ Data.state.self.systemId ].name );
363+
SystemMap.updateHud( Data.systems[ Data.state.self.systemId ] );
345364
},
346365

347366
redraw: function() {
348367
log("Redrawing System Map...");
349368
$("#system-map > svg").remove();
350369
SystemMap.draw();
351-
SystemMap.updateHud( Data.systems[ Data.state.self.systemId ].name );
370+
SystemMap.updateHud( Data.systems[ Data.state.self.systemId ] );
352371
},
353372

354373
init: function() {

app/js/UI.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,31 +146,37 @@ var UI = {
146146
return msgs[Math.floor(Math.random()*msgs.length)] + "...";
147147
},
148148

149-
advisoryUnicode: function(advisory_list) {
150-
if (advisory_list === undefined) return "";
151-
if (advisory_list.length === 0) return "";
149+
mapUnicode: function(list) {
150+
if (list === undefined) return "";
151+
if (list.length === 0) return "";
152152

153-
return $.map(advisory_list, function(a) {
153+
return $.map(list, function(a) {
154154
if (a == 'Wormhole Detected') return '\uf138';
155155
else if (a == 'Hostile Cloaked') return '\uf0c2';
156156
else if (a == 'Hostile Faded') return '\uf017';
157157
else if (a == 'Hostile Logged Off') return '\uf08b';
158158
else if (a == 'Undock Camped') return '\uf023';
159159
else if (a == 'Gate Bubbled') return '\uf192';
160-
else if (a == 'Hostiles') return '\uf0fb';
160+
else if (a == 'Hostile') return '\uf0fb';
161161
else return '';
162162

163163
}).join("");
164164
}
165165
};
166166

167+
Handlebars.logger.level = 0;
168+
167169
Handlebars.registerHelper('hud_detect_hostiles', function(status) {
168170
if (status == 'warning') return true;
169171
else return false;
170172
});
171173

172174
Handlebars.registerHelper('format_ts', function(ts) {
173-
return moment(ts).format('MM/DD HH:mm:ss');s
175+
return moment(ts).utc().format('MM/DD HH:mm:ss');
176+
});
177+
178+
Handlebars.registerHelper('format_ts_short', function(ts) {
179+
return moment(ts).utc().format('HH:mm:ss');
174180
});
175181

176182
Handlebars.registerHelper('ui_icon', function(icon) {

app/styles/main.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,13 @@ rect.status-hostile { stroke: #d9534f; fill: #74312f; }
514514
.node text.advisories {
515515
font-family: FontAwesome;
516516
font-size: 1.25rem;
517-
fill: #f89406;
517+
fill: #faa123;
518+
}
519+
520+
.node text.hostiles {
521+
font-family: FontAwesome;
522+
font-size: 1.25rem;
523+
fill: #d9534f;
518524
}
519525

520526
.current rect {
@@ -599,7 +605,7 @@ rect.status-hostile { stroke: #d9534f; fill: #74312f; }
599605
font-weight: bold;
600606
}
601607

602-
.hostile .faded > td { background-color: #444; }
608+
.hostile.faded td { opacity: 0.5; }
603609
.hostile .system, .hostile .ship-type, .hostile .actions, .hostile .alliance,
604610
.hostile .name { padding-left: 0.6rem; text-align: left; }
605611

app/templates/hostile.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<table id="hostile-{{characterId}}" class="hostile">
1+
<table id="hostile-{{characterId}}" class="hostile {{#if is_faded}}faded{{/if}}">
22
<tr>
33
<td class="ship-icon">{{{shipIcon}}}</td>
44
<td class="name"><a href="javascript:CCPEVE.showInfo(1377, {{characterId}});">{{characterName}}</a></td>
@@ -19,8 +19,8 @@
1919
<i class="fa fa-clock-o"></i> Faded
2020
{{/if}}
2121
</td>
22-
<td class="system {{#if isDocked}}docked{{/if}}"><a href="javascript:CCPEVE.showInfo(5,{{systemId}});">{{systemName}}</a></td>
23-
<td class="reported-at"><a title="Reported by {{reporterName}}">{{reported_at}}</a></td>
22+
<td class="system {{#if is_docked}}docked{{/if}}"><a href="javascript:CCPEVE.showInfo(5,{{systemId}});">{{systemName}}</a></td>
23+
<td class="reported-at"><a title="Reported by {{reporterName}}">{{format_ts_short ts}}</a></td>
2424
<td class="actions">
2525
<a title="Set Destination" onClick="CCPEVE.setDestination({{systemId}})"><i class="fa fa-map-marker" title="Set Destination"></i></a>
2626
<a title="Killboard: {{characterName}}" target="_blank" href="https://zkillboard.com/character/{{characterId}}/"><i class="fa fa-crosshairs" title="Killboard"></i></a>

server/config/settings.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ module.exports = function () {
88
session_secret: process.env.SESSION_SECRET || 'buttes',
99
log: 'console',
1010

11-
advisoryTtl: 1800,
11+
advisoryTtl: 3600,
1212
eventTtl: 300,
1313
scanTtl: 86400,
14-
reportTtl: 300,
15-
hostileTtl: 600,
14+
reportTtl: 86400,
15+
hostileFadeTtl: 600,
16+
hostileRemoveTtl: 1200,
1617
memberTtl: 600,
1718

1819
fleets: [

server/models/hostile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var HostileSchema = new Schema({
2626
is_docked: { type: Boolean, default: false }
2727
});
2828

29-
HostileSchema.index({ ts: 1, key: 1, fleetKey: 1 }, { expireAfterSeconds: settings.hostileTtl });
29+
HostileSchema.index({ ts: 1, key: 1, fleetKey: 1 }, { expireAfterSeconds: settings.hostileRemoveTtl });
3030

3131
HostileSchema.statics.prepare = function prepare(fleetKey, reporterId, reporterName, character) {
3232
return new this({

server/services/consuela.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ var clean_reports = function() {
9595
var clean_hostiles = function() {
9696
console.log('Consuela: Cleaning Hostiles');
9797

98-
Hostile.findQ({ts: { $lte: moment().unix() - +settings.hostileTtl }})
98+
Hostile.findQ({ts: { $lte: moment().unix() - +settings.hostileFadeTtl }})
9999
.then(function(hostiles) {
100100
_.forEach(hostiles, function(hostile) {
101101
if (!hostile.is_faded) {
@@ -107,7 +107,7 @@ var clean_hostiles = function() {
107107
})
108108
});
109109

110-
Hostile.findQ({ts: { $lte: moment().unix() - (+settings.hostileTtl * 2) }})
110+
Hostile.findQ({ts: { $lte: moment().unix() - +settings.hostileRemoveTtl }})
111111
.then(function(hostiles) {
112112
_.forEach(hostiles, function(hostile) {
113113
Event.prepare('hostileTimedOut', hostile.fleetKey, hostile)

0 commit comments

Comments
 (0)