Skip to content

Commit

Permalink
Adding nicknames to ratios. Fixes #93
Browse files Browse the repository at this point in the history
  • Loading branch information
johnluetke committed Jun 15, 2015
1 parent de0b6db commit fede535
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 43 deletions.
63 changes: 32 additions & 31 deletions database/tables/Stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS `Stats` (
`order` tinyint(3) NOT NULL,
`stat` varchar(20) NOT NULL,
`name` varchar(50) NOT NULL,
`nickname` varchar(10) DEFAULT NULL,
`unit` varchar(15) NOT NULL,
`group` varchar(18) NOT NULL,
`ocr` tinyint(1) NOT NULL DEFAULT '0',
Expand All @@ -17,34 +18,34 @@ CREATE TABLE IF NOT EXISTS `Stats` (
UNIQUE KEY `order` (`order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `Stats` (`order`, `stat`, `name`, `unit`, `group`, `ocr`, `graph`, `leaderboard`, `prediction`) VALUES
(0, 'ap', 'AP', 'AP', '', 1, 1, 7, 0),
(3, 'innovator', 'Innovator', '', '', 0, 0, 0, 0),
(6, 'unique_visits', 'Unique Portals Visited', 'visits', 'Discovery', 1, 1, 7, 1),
(9, 'portals_discovered', 'Portals Discovered', 'discoveries', 'Discovery', 1, 0, 7, 0),
(12, 'xm_collected', 'XM Collected', 'XM', 'Discovery', 1, 1, 7, 0),
(15, 'distance_walked', 'Distance Walked', 'km', 'Health', 1, 1, 7, 1),
(18, 'res_deployed', 'Resonators Deployed', 'deployments', 'Building', 1, 1, 7, 1),
(21, 'links_created', 'Links Created', 'links', 'Building', 1, 1, 7, 1),
(24, 'fields_created', 'Control Fields Created', 'fields', 'Building', 1, 1, 7, 1),
(27, 'mu_captured', 'Mind Units Captured', 'MUs', 'Building', 1, 1, 7, 1),
(30, 'longest_link', 'Longest Link Ever Created', 'km', 'Building', 1, 0, 1, 0),
(33, 'largest_field', 'Largest Control Field', 'MUs', 'Building', 1, 0, 1, 0),
(36, 'xm_recharged', 'XM Recharged', 'XM', 'Building', 1, 1, 7, 1),
(39, 'portals_captured', 'Portals Captured', 'captures', 'Building', 1, 1, 7, 1),
(42, 'unique_captures', 'Unique Portals Captured', 'unique captures', 'Building', 1, 1, 7, 1),
(45, 'mods_deployed', 'Mods Deployed', 'mods', 'Building', 1, 1, 7, 1),
(48, 'res_destroyed', 'Resonators Destroyed', 'resonators', 'Combat', 1, 1, 7, 1),
(51, 'portals_neutralized', 'Portals Neutralized', 'portals', 'Combat', 1, 1, 7, 0),
(54, 'links_destroyed', 'Enemy Links Destroyed', 'links', 'Combat', 1, 1, 7, 0),
(57, 'fields_destroyed', 'Enemy Control Fields Destroyed', 'fields', 'Combat', 1, 1, 7, 0),
(60, 'oldest_portal', 'Max Time Portal Held', 'days', 'Defense', 1, 0, 1, 0),
(63, 'oldest_link', 'Max Time Link Maintained', 'days', 'Defense', 1, 0, 1, 0),
(66, 'oldest_link_days', 'Max Link Length x Days', 'km-days', 'Defense', 1, 0, 1, 0),
(69, 'oldest_field', 'Max Time Field Held', 'days', 'Defense', 1, 0, 1, 0),
(72, 'largest_field_days', 'Largest Field MUs x Days', 'MU-days', 'Defense', 1, 0, 1, 0),
(75, 'unique_missions', 'Unique Missions Completed', 'missions', 'Missions', 1, 1, 7, 1),
(78, 'hacks', 'Hacks', 'hacks', 'Resource Gathering', 1, 1, 7, 1),
(81, 'glyphs', 'Glyph Hack Points', 'points', 'Resource Gathering', 1, 1, 7, 1),
(84, 'hacking_streak', 'Longest Hacking Streak', 'days', 'Resource Gathering', 1, 0, 1, 0),
(87, 'recruits', 'Agents Successfully Recruited', 'agents', 'Mentoring', 1, 0, 7, 0);
INSERT INTO `Stats` (`order`, `stat`, `name`, `nickname`, `unit`, `group`, `ocr`, `graph`, `leaderboard`, `prediction`) VALUES
(0, 'ap', 'AP', 'AP', 'AP', '', 1, 1, 7, 0),
(3, 'innovator', 'Innovator', NULL, '', '', 0, 0, 0, 0),
(6, 'unique_visits', 'Unique Portals Visited', 'UPV', 'visits', 'Discovery', 1, 1, 7, 1),
(9, 'portals_discovered', 'Portals Discovered', NULL, 'discoveries', 'Discovery', 1, 0, 7, 0),
(12, 'xm_collected', 'XM Collected', NULL, 'XM', 'Discovery', 1, 1, 7, 0),
(15, 'distance_walked', 'Distance Walked', 'KM Walked', 'km', 'Health', 1, 1, 7, 1),
(18, 'res_deployed', 'Resonators Deployed', 'Deploys', 'deploys', 'Building', 1, 1, 7, 1),
(21, 'links_created', 'Links Created', 'Links', 'links', 'Building', 1, 1, 7, 1),
(24, 'fields_created', 'Control Fields Created', 'Fields', 'fields', 'Building', 1, 1, 7, 1),
(27, 'mu_captured', 'Mind Units Captured', 'MU', 'MUs', 'Building', 1, 1, 7, 1),
(30, 'longest_link', 'Longest Link Ever Created', NULL, 'km', 'Building', 1, 0, 1, 0),
(33, 'largest_field', 'Largest Control Field', NULL, 'MUs', 'Building', 1, 0, 1, 0),
(36, 'xm_recharged', 'XM Recharged', NULL, 'XM', 'Building', 1, 1, 7, 1),
(39, 'portals_captured', 'Portals Captured', 'Captures', 'captures', 'Building', 1, 1, 7, 1),
(42, 'unique_captures', 'Unique Portals Captured', 'UPC', 'unique captures', 'Building', 1, 1, 7, 1),
(45, 'mods_deployed', 'Mods Deployed', 'Mods', 'mods', 'Building', 1, 1, 7, 1),
(48, 'res_destroyed', 'Resonators Destroyed', 'Destroys', 'resonators', 'Combat', 1, 1, 7, 1),
(51, 'portals_neutralized', 'Portals Neutralized', NULL, 'portals', 'Combat', 1, 1, 7, 0),
(54, 'links_destroyed', 'Enemy Links Destroyed', NULL, 'links', 'Combat', 1, 1, 7, 0),
(57, 'fields_destroyed', 'Enemy Control Fields Destroyed', NULL, 'fields', 'Combat', 1, 1, 7, 0),
(60, 'oldest_portal', 'Max Time Portal Held', NULL, 'days', 'Defense', 1, 0, 1, 0),
(63, 'oldest_link', 'Max Time Link Maintained', NULL, 'days', 'Defense', 1, 0, 1, 0),
(66, 'oldest_link_days', 'Max Link Length x Days', NULL, 'km-days', 'Defense', 1, 0, 1, 0),
(69, 'oldest_field', 'Max Time Field Held', NULL, 'days', 'Defense', 1, 0, 1, 0),
(72, 'largest_field_days', 'Largest Field MUs x Days', NULL, 'MU-days', 'Defense', 1, 0, 1, 0),
(75, 'unique_missions', 'Unique Missions Completed', 'Missions', 'missions', 'Missions', 1, 1, 7, 1),
(78, 'hacks', 'Hacks', 'Hanks', 'hacks', 'Resource Gathering', 1, 1, 7, 1),
(81, 'glyphs', 'Glyph Hack Points', NULL, 'points', 'Resource Gathering', 1, 1, 7, 1),
(84, 'hacking_streak', 'Longest Hacking Streak', NULL, 'days', 'Resource Gathering', 1, 0, 1, 0),
(87, 'recruits', 'Agents Successfully Recruited', NULL, 'agents', 'Mentoring', 1, 0, 7, 0);
6 changes: 1 addition & 5 deletions resources/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@upcoming-badge-time-margin: @upcoming-badge-height / 7;
@upcoming-badge-width: 270;

@ratio-height: 105;
@ratio-height: 115;
@ratio-seperator-padding: @ratio-height / 5;
@ratio-width: 180;

Expand Down Expand Up @@ -501,10 +501,6 @@ table#stat-entry {
}
}
}

div.badge-name {
display: none;
}
}

.badge-icon-75 {
Expand Down
3 changes: 2 additions & 1 deletion src/BlueHerons/StatTracker/StatTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ public function setBaseURL($request) {
*/
public static function getStats() {
if (!is_array(self::$stats)) {
$stmt = self::db()->query("SELECT stat as `key`, name, `group`, unit, ocr, graph, leaderboard FROM Stats ORDER BY `order` ASC;");
$stmt = self::db()->query("SELECT stat as `key`, name, `nickname`, `group`, unit, ocr, graph, leaderboard FROM Stats ORDER BY `order` ASC;");
$rows = $stmt->fetchAll();

foreach($rows as $row) {
$stat = new Stat();
extract($row);
$stat->stat = $key;
$stat->name = $name;
$stat->nickname = $nickname;
$stat->group = $group;
$stat->unit = $unit;
$stat->ocr = $ocr;
Expand Down
12 changes: 6 additions & 6 deletions views/dashboard.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
<div class="badges">
<div class="badge-display badge-1">
<div class="badge-image badge-icon-75" />
<div class="badge-name" />
</div>
<div class="seperator">:</div>
<div class="badge-display badge-2">
<div class="badge-image badge-icon-75" />
<div class="badge-name" />
</div>
</div>
<div class="value" />
Expand Down Expand Up @@ -145,12 +147,10 @@ function onPageLoad() {
ratio.stat2.level = "level-icon-75 {{faction_class}} l" + ratio.stat2.level;
}
$(html).find(".badge-1 .badge-image").addClass(ratio.stat1.badge)
.addClass(ratio.stat1.level)
.attr("title", ratio.stat1.name);
$(html).find(".badge-2 .badge-image").addClass(ratio.stat2.badge)
.addClass(ratio.stat2.level)
.attr("title", ratio.stat2.name);
$(html).find(".badge-1 .badge-image").addClass(ratio.stat1.badge + " " + ratio.stat1.level);
$(html).find(".badge-2 .badge-image").addClass(ratio.stat2.badge + " " + ratio.stat2.level);
$(html).find(".badge-1 .badge-name").html(ratio.stat1.name);
$(html).find(".badge-2 .badge-name").html(ratio.stat2.name);
$(html).find(".value").html(format(ratio.ratio));
$("#ratios").append(html);
Expand Down

0 comments on commit fede535

Please sign in to comment.