mirror of
https://github.com/wassname/cardsforscience.git
synced 2026-06-27 18:58:47 +08:00
Add achievements
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ h1 br {
|
||||
}
|
||||
|
||||
#achievements-container .alert-glyph {
|
||||
float:left; font-size: 32px; margin-right: 10px;
|
||||
float:left; font-size: 20px; margin-right: 10px;
|
||||
}
|
||||
|
||||
#achievements-container .alert-text {
|
||||
|
||||
+7
-5
@@ -29,7 +29,7 @@ var achievements =
|
||||
for (var item in achievements[list[i].type]) {
|
||||
var a = $.extend(true, {}, list[i]);
|
||||
a.target = item;
|
||||
if (list[i].type == 'workers') {
|
||||
if (list[i].type == 'workers' && list[i].threshold == 1) {
|
||||
a.description = a.description.replace('${name}', item.substring(0, item.length - 1));
|
||||
} else {
|
||||
a.description = a.description.replace('${name}', item);
|
||||
@@ -71,9 +71,11 @@ var achievements =
|
||||
for (var i = 0; i < achievements.list.length; i++) {
|
||||
if (achievements.list[i].type == type &&
|
||||
achievements.list[i].target == subtype &&
|
||||
achievements.list[i].threshold >= achievements[type][subtype]
|
||||
achievements[type][subtype] >= achievements.list[i].threshold
|
||||
)
|
||||
{
|
||||
console.log(achievements.list[i].threshold, achievements[type][subtype]);
|
||||
|
||||
achievements.list[i].completed = true;
|
||||
achievements.displayAchievement(i);
|
||||
}
|
||||
@@ -84,13 +86,13 @@ var achievements =
|
||||
{
|
||||
var alert = '<div class="alert alert-success alert-dismissible" role="alert">';
|
||||
alert += '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
|
||||
alert += '<span class="glyphicon glyphicon-thumbs-up alert-glyph"></span> <span class="alert-text">' + achievements.list[i].description + '</span>';
|
||||
alert += '<span class="glyphicon ' + achievements.list[i].icon + ' alert-glyph"></span> <span class="alert-text">' + achievements.list[i].description + '</span>';
|
||||
alert += '</div>';
|
||||
|
||||
alert = $(alert);
|
||||
|
||||
if (achievements.list[i].completed && !achievements.list[i].alerted) {
|
||||
$('#achievements-container').append(alert);
|
||||
$('#achievements-container').prepend(alert);
|
||||
|
||||
var remove = function(a)
|
||||
{
|
||||
@@ -111,7 +113,7 @@ var achievements =
|
||||
|
||||
timeFormatter: function(msec)
|
||||
{
|
||||
var totals = Math.floor(msec / 1000);
|
||||
var totals = Math.ceil(msec / 1000);
|
||||
var days = Math.floor(totals / (24 * 60 * 60));
|
||||
var hours = Math.floor((totals % (24 * 60 * 60)) / (60 * 60));
|
||||
var totalmin = (totals % (24 * 60 * 60)) % (60 * 60);
|
||||
|
||||
+315
-3
@@ -1,22 +1,334 @@
|
||||
[
|
||||
{
|
||||
"description": "You have just discovered ${name}!",
|
||||
"description": "${name} discovery!",
|
||||
"icon": "glyphicon-cog",
|
||||
"type": "research",
|
||||
"target": "research",
|
||||
"threshold": 1
|
||||
},
|
||||
{
|
||||
"description": "You have hired your first ${name}!",
|
||||
"description": "${name} research level 5!",
|
||||
"icon": "glyphicon-cog",
|
||||
"type": "research",
|
||||
"target": "research",
|
||||
"threshold": 5
|
||||
},
|
||||
{
|
||||
"description": "${name} research level 25!",
|
||||
"icon": "glyphicon-cog",
|
||||
"type": "research",
|
||||
"target": "research",
|
||||
"threshold": 25
|
||||
},
|
||||
{
|
||||
"description": "${name} research level 50!",
|
||||
"icon": "glyphicon-cog",
|
||||
"type": "research",
|
||||
"target": "research",
|
||||
"threshold": 50
|
||||
},
|
||||
{
|
||||
"description": "${name} research level 100!",
|
||||
"icon": "glyphicon-cog",
|
||||
"type": "research",
|
||||
"target": "research",
|
||||
"threshold": 100
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"description": "The first ${name} hired!",
|
||||
"icon": "glyphicon-user",
|
||||
"type": "workers",
|
||||
"target": "workers",
|
||||
"threshold": 1
|
||||
},
|
||||
{
|
||||
"description": "You have just made your first click!",
|
||||
"description": "5 ${name} working for you!",
|
||||
"icon": "glyphicon-user",
|
||||
"type": "workers",
|
||||
"target": "workers",
|
||||
"threshold": 5
|
||||
},
|
||||
{
|
||||
"description": "25 ${name} working for you!",
|
||||
"icon": "glyphicon-user",
|
||||
"type": "workers",
|
||||
"target": "workers",
|
||||
"threshold": 25
|
||||
},
|
||||
{
|
||||
"description": "50 ${name} working for you!",
|
||||
"icon": "glyphicon-user",
|
||||
"type": "workers",
|
||||
"target": "workers",
|
||||
"threshold": 50
|
||||
},
|
||||
{
|
||||
"description": "100 ${name} working for you!",
|
||||
"icon": "glyphicon-user",
|
||||
"type": "workers",
|
||||
"target": "workers",
|
||||
"threshold": 100
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"description": "Your first click!",
|
||||
"icon": "glyphicon-hand-up",
|
||||
"type": "count",
|
||||
"target": "clicks",
|
||||
"threshold": 1
|
||||
},
|
||||
{
|
||||
"description": "100 clicks!",
|
||||
"icon": "glyphicon-hand-up",
|
||||
"type": "count",
|
||||
"target": "clicks",
|
||||
"threshold": 100
|
||||
},
|
||||
{
|
||||
"description": "1000 clicks!",
|
||||
"icon": "glyphicon-hand-up",
|
||||
"type": "count",
|
||||
"target": "clicks",
|
||||
"threshold": 1000
|
||||
},
|
||||
{
|
||||
"description": "10.0k clicks!",
|
||||
"icon": "glyphicon-hand-up",
|
||||
"type": "count",
|
||||
"target": "clicks",
|
||||
"threshold": 10000
|
||||
},
|
||||
{
|
||||
"description": "10.0k0 clicks!",
|
||||
"icon": "glyphicon-hand-up",
|
||||
"type": "count",
|
||||
"target": "clicks",
|
||||
"threshold": 100000
|
||||
},
|
||||
{
|
||||
"description": "1.0M clicks!",
|
||||
"icon": "glyphicon-hand-up",
|
||||
"type": "count",
|
||||
"target": "clicks",
|
||||
"threshold": 1000000
|
||||
},
|
||||
|
||||
{
|
||||
"description": "100 data collected!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "data",
|
||||
"threshold": 100
|
||||
},
|
||||
{
|
||||
"description": "10.0k data collected!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "data",
|
||||
"threshold": 10000
|
||||
},
|
||||
{
|
||||
"description": "1.0M data collected!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "data",
|
||||
"threshold": 1000000
|
||||
},
|
||||
{
|
||||
"description": "100.0M data collected!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "data",
|
||||
"threshold": 100000000
|
||||
},
|
||||
{
|
||||
"description": "10.0B data collected!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "data",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
{
|
||||
"description": "10.0B data collected!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "data",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
|
||||
{
|
||||
"description": "JTN 100 funding gathered!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "money",
|
||||
"threshold": 100
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0k funding gathered!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "money",
|
||||
"threshold": 10000
|
||||
},
|
||||
{
|
||||
"description": "JTN 1.0M funding gathered!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "money",
|
||||
"threshold": 1000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 100.0M funding gathered!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "money",
|
||||
"threshold": 100000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0B funding gathered!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "money",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0B funding gathered!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "money",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"description": "100 data processed!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "dataSpent",
|
||||
"threshold": 100
|
||||
},
|
||||
{
|
||||
"description": "10.0k data processed!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "dataSpent",
|
||||
"threshold": 10000
|
||||
},
|
||||
{
|
||||
"description": "1.0M data processed!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "dataSpent",
|
||||
"threshold": 1000000
|
||||
},
|
||||
{
|
||||
"description": "100.0M data processed!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "dataSpent",
|
||||
"threshold": 100000000
|
||||
},
|
||||
{
|
||||
"description": "10.0B data processed!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "dataSpent",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
{
|
||||
"description": "10.0B data processed!",
|
||||
"icon": "glyphicon-hdd",
|
||||
"type": "count",
|
||||
"target": "dataSpent",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
|
||||
{
|
||||
"description": "JTN 100 funding spent in HR department!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyWorkers",
|
||||
"threshold": 100
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0k funding spent in HR department!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyWorkers",
|
||||
"threshold": 10000
|
||||
},
|
||||
{
|
||||
"description": "JTN 1.0M funding spent in HR department!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyWorkers",
|
||||
"threshold": 1000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 100.0M funding spent in HR department!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyWorkers",
|
||||
"threshold": 100000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0B funding spent in HR department!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyWorkers",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0B funding spent in HR department!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyWorkers",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
|
||||
{
|
||||
"description": "JTN 100 funding spent for upgrades!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyUpgrades",
|
||||
"threshold": 100
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0k funding spent for upgrades!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyUpgrades",
|
||||
"threshold": 10000
|
||||
},
|
||||
{
|
||||
"description": "JTN 1.0M funding spent for upgrades!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyUpgrades",
|
||||
"threshold": 1000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 100.0M funding spent for upgrades!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyUpgrades",
|
||||
"threshold": 100000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0B funding spent for upgrades!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyUpgrades",
|
||||
"threshold": 10000000000
|
||||
},
|
||||
{
|
||||
"description": "JTN 10.0B funding spent for upgrades!",
|
||||
"icon": "glyphicon-usd",
|
||||
"type": "count",
|
||||
"target": "moneyUpgrades",
|
||||
"threshold": 10000000000
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user