mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +00:00
small changes to armor durability
This commit is contained in:
parent
a75e286337
commit
cad89edfd9
4 changed files with 55 additions and 53 deletions
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
class Minecart extends Vehicle{
|
class Minecart extends Vehicle{
|
||||||
const TYPE = OBJECT_MINECART;
|
const TYPE = OBJECT_MINECART;
|
||||||
|
|
||||||
|
private $moveVector = [];
|
||||||
|
const STATE_INITIAL = 0;
|
||||||
|
const STATE_ON_RAIL = 1;
|
||||||
|
const STATE_OFF_RAIL = 2;
|
||||||
|
|
||||||
|
|
||||||
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||||
parent::__construct($level, $eid, $class, $type, $data);
|
parent::__construct($level, $eid, $class, $type, $data);
|
||||||
$this->x = isset($this->data["TileX"]) ? $this->data["TileX"]:$this->x;
|
$this->x = isset($this->data["TileX"]) ? $this->data["TileX"]:$this->x;
|
||||||
|
|
@ -10,7 +17,10 @@ class Minecart extends Vehicle{
|
||||||
$this->setHealth(1, "generic");
|
$this->setHealth(1, "generic");
|
||||||
//$this->setName((isset($objects[$this->type]) ? $objects[$this->type]:$this->type));
|
//$this->setName((isset($objects[$this->type]) ? $objects[$this->type]:$this->type));
|
||||||
$this->size = 1;
|
$this->size = 1;
|
||||||
|
/*$this->moveVector[Entity::NORTH] = new Vector3(-1, 0, 0);
|
||||||
|
$this->moveVector[Entity::SOUTH] = new Vector3(1, 0, 0);
|
||||||
|
$this->moveVector[Entity::EAST] = new Vector3(0, 0, -1);
|
||||||
|
$this->moveVector[Entity::WEST] = new Vector3(0, 0, 1);*/
|
||||||
$this->update();
|
$this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
`<?php
|
||||||
|
|
||||||
class Item{
|
class Item{
|
||||||
public static $class = array(
|
public static $class = array(
|
||||||
|
|
@ -220,35 +220,9 @@ class Item{
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getMaxDurability(){
|
final public function getMaxDurability(){
|
||||||
$isArmor = $this->isArmor();
|
$isArmor = $this->getArmorMaterialDurability(); //can be used any of new methods, both return false if item is not armor
|
||||||
if($isArmor !== false){
|
if($isArmor !== false){
|
||||||
$armorDurability = [
|
return $this->getArmorMaterialDurability() * $this->getHealthPerArmorSlot();
|
||||||
10 => 56,
|
|
||||||
11 => 81,
|
|
||||||
12 => 76,
|
|
||||||
13 => 66,
|
|
||||||
|
|
||||||
20 => 166,
|
|
||||||
21 => 241,
|
|
||||||
22 => 226,
|
|
||||||
23 => 196,
|
|
||||||
|
|
||||||
30 => 166,
|
|
||||||
31 => 241,
|
|
||||||
32 => 226,
|
|
||||||
33 => 196,
|
|
||||||
|
|
||||||
40 => 364,
|
|
||||||
41 => 529,
|
|
||||||
42 => 496,
|
|
||||||
43 => 430,
|
|
||||||
|
|
||||||
50 => 78,
|
|
||||||
51 => 113,
|
|
||||||
52 => 106,
|
|
||||||
53 => 92,
|
|
||||||
];
|
|
||||||
return $armorDurability[$isArmor];
|
|
||||||
}
|
}
|
||||||
if(!$this->isTool() and $this->isHoe() === false and $this->id !== BOW){
|
if(!$this->isTool() and $this->isHoe() === false and $this->id !== BOW){
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -278,57 +252,74 @@ class Item{
|
||||||
}
|
}
|
||||||
return $levels[$type];
|
return $levels[$type];
|
||||||
}
|
}
|
||||||
final public function isArmor(){
|
|
||||||
|
public function getArmorMaterialDurability(){
|
||||||
switch($this->id){
|
switch($this->id){
|
||||||
case LEATHER_CAP:
|
case LEATHER_CAP:
|
||||||
return 10;
|
|
||||||
case LEATHER_TUNIC:
|
case LEATHER_TUNIC:
|
||||||
return 11;
|
|
||||||
case LEATHER_PANTS:
|
case LEATHER_PANTS:
|
||||||
return 12;
|
|
||||||
case LEATHER_BOOTS:
|
case LEATHER_BOOTS:
|
||||||
return 13;
|
return 5;
|
||||||
|
|
||||||
case CHAIN_HELMET:
|
case CHAIN_HELMET:
|
||||||
return 20;
|
|
||||||
case CHAIN_CHESTPLATE:
|
case CHAIN_CHESTPLATE:
|
||||||
return 21;
|
|
||||||
case CHAIN_LEGGINGS:
|
case CHAIN_LEGGINGS:
|
||||||
return 22;
|
|
||||||
case CHAIN_BOOTS:
|
case CHAIN_BOOTS:
|
||||||
return 23;
|
return 15;
|
||||||
|
|
||||||
case IRON_HELMET:
|
case IRON_HELMET:
|
||||||
return 30;
|
|
||||||
case IRON_CHESTPLATE:
|
case IRON_CHESTPLATE:
|
||||||
return 31;
|
|
||||||
case IRON_LEGGINGS:
|
case IRON_LEGGINGS:
|
||||||
return 32;
|
|
||||||
case IRON_BOOTS:
|
case IRON_BOOTS:
|
||||||
return 33;
|
return 15;
|
||||||
|
|
||||||
case DIAMOND_HELMET:
|
case DIAMOND_HELMET:
|
||||||
return 40;
|
|
||||||
case DIAMOND_CHESTPLATE:
|
case DIAMOND_CHESTPLATE:
|
||||||
return 41;
|
|
||||||
case DIAMOND_LEGGINGS:
|
case DIAMOND_LEGGINGS:
|
||||||
return 42;
|
|
||||||
case DIAMOND_BOOTS:
|
case DIAMOND_BOOTS:
|
||||||
return 43;
|
return 33;
|
||||||
|
|
||||||
case GOLD_HELMET:
|
case GOLD_HELMET:
|
||||||
return 50;
|
|
||||||
case GOLD_CHESTPLATE:
|
case GOLD_CHESTPLATE:
|
||||||
return 51;
|
|
||||||
case GOLD_LEGGINGS:
|
case GOLD_LEGGINGS:
|
||||||
return 52;
|
|
||||||
case GOLD_BOOTS:
|
case GOLD_BOOTS:
|
||||||
return 53;
|
return 7;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHealthPerArmorSlot(){
|
||||||
|
switch($this->id){
|
||||||
|
case LEATHER_CAP:
|
||||||
|
case CHAIN_HELMET:
|
||||||
|
case IRON_HELMET:
|
||||||
|
case DIAMOND_HELMET:
|
||||||
|
case GOLD_HELMET:
|
||||||
|
return 11;
|
||||||
|
case LEATHER_TUNIC:
|
||||||
|
case CHAIN_CHESTPLATE:
|
||||||
|
case IRON_CHESTPLATE:
|
||||||
|
case DIAMOND_CHESTPLATE:
|
||||||
|
case GOLD_CHESTPLATE:
|
||||||
|
return 16;
|
||||||
|
case LEATHER_PANTS:
|
||||||
|
case CHAIN_LEGGINGS:
|
||||||
|
case IRON_LEGGINGS:
|
||||||
|
case DIAMOND_LEGGINGS:
|
||||||
|
case GOLD_LEGGINGS:
|
||||||
|
return 15;
|
||||||
|
case LEATHER_BOOTS:
|
||||||
|
case CHAIN_BOOTS:
|
||||||
|
case IRON_BOOTS:
|
||||||
|
case DIAMOND_BOOTS:
|
||||||
|
case GOLD_BOOTS:
|
||||||
|
return 13;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final public function isPickaxe(){ //Returns false or level of the pickaxe
|
final public function isPickaxe(){ //Returns false or level of the pickaxe
|
||||||
switch($this->id){
|
switch($this->id){
|
||||||
case IRON_PICKAXE:
|
case IRON_PICKAXE:
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ class MinecraftInterface{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->bandwidth[0] += $len;
|
$this->bandwidth[0] += $len;
|
||||||
|
ServerAPI::request()->api->dhandle("mcinterface.read", ["buffer" => $buf, "source" => $source, "port" => $port]);
|
||||||
return $this->parsePacket($buf, $source, $port);
|
return $this->parsePacket($buf, $source, $port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class UDPSocket{
|
||||||
if($this->connected === false){
|
if($this->connected === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
|
return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function write($data, $dest, $port){
|
public function write($data, $dest, $port){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue