Added armor (merged from zeeZ).
This commit is contained in:
parent
3b16a36b99
commit
3fd511a8d1
9 changed files with 99 additions and 13 deletions
|
|
@ -529,19 +529,47 @@
|
|||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.dynmap .playerHealth {
|
||||
.dynmap .healthContainer {
|
||||
display: block;
|
||||
position: absolute;
|
||||
bottom: 3px;
|
||||
bottom: 0;
|
||||
left: 34px;
|
||||
height: 11px;
|
||||
|
||||
background: url(../images/heart.png) rgba(0,0,0,0.6) repeat-x left center;
|
||||
padding: 1px 0;
|
||||
width: 50px;
|
||||
|
||||
background: rgba(0,0,0,0.6);
|
||||
padding: 2px;
|
||||
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.dynmap .playerHealth {
|
||||
height: 7px;
|
||||
|
||||
background: url(../images/heart.png) repeat-x left center;
|
||||
}
|
||||
|
||||
.dynmap .playerHealthBackground {
|
||||
height: 7px;
|
||||
width: 50px;
|
||||
|
||||
background: url(../images/heart_depleted.png) repeat-x left center;
|
||||
}
|
||||
|
||||
.dynmap .playerArmor {
|
||||
height: 7px;
|
||||
|
||||
background: url(../images/armor.png) repeat-x left center;
|
||||
}
|
||||
|
||||
.dynmap .playerArmorBackground {
|
||||
height: 7px;
|
||||
width: 50px;
|
||||
|
||||
background: url(../images/armor_depleted.png) repeat-x left center;
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
* Compass
|
||||
|
|
|
|||
BIN
web/images/armor.png
Normal file
BIN
web/images/armor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 213 B |
BIN
web/images/armor_depleted.png
Normal file
BIN
web/images/armor_depleted.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 B |
Binary file not shown.
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 198 B |
BIN
web/images/heart_depleted.png
Normal file
BIN
web/images/heart_depleted.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 183 B |
|
|
@ -454,7 +454,8 @@ DynMap.prototype = {
|
|||
name: update.name,
|
||||
location: new Location(me.worlds[update.world], parseFloat(update.x), parseFloat(update.y), parseFloat(update.z)),
|
||||
health: update.health,
|
||||
account: update.account
|
||||
armor: update.armor,
|
||||
account: update.account
|
||||
};
|
||||
|
||||
$(me).trigger('playeradded', [ player ]);
|
||||
|
|
@ -497,6 +498,7 @@ DynMap.prototype = {
|
|||
var me = this;
|
||||
var location = player.location = new Location(me.worlds[update.world], parseFloat(update.x), parseFloat(update.y), parseFloat(update.z));
|
||||
player.health = update.health;
|
||||
player.armor = update.armor;
|
||||
|
||||
$(me).trigger('playerupdated', [ player ]);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
|||
.text(player.name));
|
||||
|
||||
if (configuration.showplayerfaces) {
|
||||
getMinecraftHead(player.account, 32, function(head) {
|
||||
getMinecraftHead(player.name, 32, function(head) {
|
||||
$(head)
|
||||
.addClass('playericon')
|
||||
.prependTo(div);
|
||||
|
|
@ -23,10 +23,28 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
|||
});
|
||||
}
|
||||
if (configuration.showplayerhealth) {
|
||||
player.healthBar = $('<div/>')
|
||||
.addClass('playerHealth')
|
||||
.css('width', (player.health/2*9) + 'px')
|
||||
player.healthContainer = $('<div/>')
|
||||
.addClass('healthContainer')
|
||||
.appendTo(div);
|
||||
if (player.health !== undefined && player.armor !== undefined) {
|
||||
player.healthBar = $('<div/>')
|
||||
.addClass('playerHealth')
|
||||
.css('width', (player.health/2*5) + 'px');
|
||||
player.armorBar = $('<div/>')
|
||||
.addClass('playerArmor')
|
||||
.css('width', (player.armor/2*5) + 'px');
|
||||
|
||||
$('<div/>')
|
||||
.addClass('playerHealthBackground')
|
||||
.append(player.healthBar)
|
||||
.appendTo(player.healthContainer);
|
||||
$('<div/>')
|
||||
.addClass('playerArmorBackground')
|
||||
.append(player.armorBar)
|
||||
.appendTo(player.healthContainer);
|
||||
} else {
|
||||
player.healthContainer.css('display','none');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -40,7 +58,14 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
|||
player.marker.toggle(dynmap.world === player.location.world);
|
||||
player.marker.setPosition(markerPosition);
|
||||
// Update health
|
||||
if (configuration.showplayerhealth)
|
||||
player.healthBar.css('width', (player.health/2*9) + 'px');
|
||||
if (configuration.showplayerhealth) {
|
||||
if (player.health !== undefined && player.armor !== undefined) {
|
||||
player.healthContainer.css('display','block');
|
||||
player.healthBar.css('width', (player.health/2*5) + 'px');
|
||||
player.armorBar.css('width', (player.armor/2*5) + 'px');
|
||||
} else {
|
||||
player.healthContainer.css('display','none');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue