artifacts: centralise the descriptions of the artifact types/fragment names, and fix an incorrect warning concerning the new amar artifacts
This commit is contained in:
parent
50b2633257
commit
c634720cf1
@ -72,8 +72,9 @@ window.artifact.processData = function(data) {
|
|||||||
artifact.clearData();
|
artifact.clearData();
|
||||||
|
|
||||||
$.each (data.artifacts, function(i,artData) {
|
$.each (data.artifacts, function(i,artData) {
|
||||||
if (artData.artifactId != 'jarvis') {
|
// if we have no descriptions for a type, we don't know about it
|
||||||
// jarvis artifacts - fragmentInfos and targetInfos
|
if (!artifact.getArtifactDescriptions(artData.artifactId)) {
|
||||||
|
// jarvis and amar artifacts - fragmentInfos and targetInfos
|
||||||
// (future types? completely unknown at this time!)
|
// (future types? completely unknown at this time!)
|
||||||
console.warn('Note: unknown artifactId '+artData.artifactId+' - guessing how to handle it');
|
console.warn('Note: unknown artifactId '+artData.artifactId+' - guessing how to handle it');
|
||||||
}
|
}
|
||||||
@ -141,6 +142,15 @@ window.artifact.isArtifact = function(type) {
|
|||||||
return type in artifact.artifactTypes;
|
return type in artifact.artifactTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.artifact.getArtifactDescriptions = function(type) {
|
||||||
|
var descriptions = {
|
||||||
|
'jarvis': { 'title': "Jarvis Shards", 'fragmentName': "shards" },
|
||||||
|
'amar': { 'title': "Amar Artifacts", 'fragmentName': "artifacts" }
|
||||||
|
};
|
||||||
|
|
||||||
|
return descriptions[type];
|
||||||
|
}
|
||||||
|
|
||||||
// used to render portals that would otherwise be below the visible level
|
// used to render portals that would otherwise be below the visible level
|
||||||
window.artifact.getArtifactEntities = function() {
|
window.artifact.getArtifactEntities = function() {
|
||||||
var entities = [];
|
var entities = [];
|
||||||
@ -244,7 +254,9 @@ window.artifact.showArtifactList = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.each(artifact.artifactTypes, function(type,type2) {
|
$.each(artifact.artifactTypes, function(type,type2) {
|
||||||
var name = typeNames[type] || ('New artifact type: '+type);
|
var description = artifact.getArtifactDescriptions(type);
|
||||||
|
|
||||||
|
var name = description ? description.title : ('unknown artifact type: '+type);
|
||||||
|
|
||||||
html += '<hr><div><b>'+name+'</b></div>';
|
html += '<hr><div><b>'+name+'</b></div>';
|
||||||
|
|
||||||
@ -273,7 +285,8 @@ window.artifact.showArtifactList = function() {
|
|||||||
if (data[type].target) {
|
if (data[type].target) {
|
||||||
row += '<br>';
|
row += '<br>';
|
||||||
}
|
}
|
||||||
row += '<span class="fragments'+(data[type].target?' '+TEAM_TO_CSS[data[type].target]:'')+'">Shard: #'+data[type].fragments.join(', #')+'</span> ';
|
var fragmentName = description ? description.fragmentName : 'fragment';
|
||||||
|
row += '<span class="fragments'+(data[type].target?' '+TEAM_TO_CSS[data[type].target]:'')+'">'+fragmentName+': #'+data[type].fragments.join(', #')+'</span> ';
|
||||||
sortVal = Math.min.apply(null, data[type].fragments); // use min shard number at portal as sort key
|
sortVal = Math.min.apply(null, data[type].fragments); // use min shard number at portal as sort key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,14 +203,11 @@ window.getPortalMiscDetails = function(guid,d) {
|
|||||||
// artifact details
|
// artifact details
|
||||||
|
|
||||||
// 2014-02-06: stock site changed from supporting 'jarvis shards' to 'amar artifacts'(?) - so let's see what we can do to be generic...
|
// 2014-02-06: stock site changed from supporting 'jarvis shards' to 'amar artifacts'(?) - so let's see what we can do to be generic...
|
||||||
var artifactTypes = {
|
$.each(artifact.getArtifactTypes(),function(index,type) {
|
||||||
'jarvis': { 'name': 'Jarvis', 'fragmentName': 'shard(s)' },
|
|
||||||
'amar': { 'name': 'Amar', 'fragmentName': 'artifact(s)' },
|
|
||||||
};
|
|
||||||
|
|
||||||
$.each(artifactTypes,function(type,details) {
|
|
||||||
var artdata = artifact.getPortalData (guid, type);
|
var artdata = artifact.getPortalData (guid, type);
|
||||||
if (artdata) {
|
if (artdata) {
|
||||||
|
var details = artifact.getArtifactDescriptions(type);
|
||||||
|
if (details) {
|
||||||
// the genFourColumnTable function below doesn't handle cases where one column is null and the other isn't - so default to *something* in both columns
|
// the genFourColumnTable function below doesn't handle cases where one column is null and the other isn't - so default to *something* in both columns
|
||||||
var target = ['',''], shards = [details.fragmentName,'(none)'];
|
var target = ['',''], shards = [details.fragmentName,'(none)'];
|
||||||
if (artdata.target) {
|
if (artdata.target) {
|
||||||
@ -221,6 +218,9 @@ window.getPortalMiscDetails = function(guid,d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
randDetailsData.push (target, shards);
|
randDetailsData.push (target, shards);
|
||||||
|
} else {
|
||||||
|
console.warn('Unknown artifact type '+type+': no names, so cannot display');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user