[UPDATE] Adding monster looks to db (#220)

* [UPDATE] Adding monster looks to db

* small adjustments

add into schema.sql + change position in table

* add DEFAULT = ''

---------

Co-authored-by: slawkens <slawkens@gmail.com>
This commit is contained in:
Matheus Collier
2023-03-31 04:04:13 -03:00
committed by GitHub
parent 7569536d56
commit fd419076c2
5 changed files with 38 additions and 2 deletions

View File

@@ -36,6 +36,7 @@
* @property-read int $armor Armor rate.
* @property-read array $defenses List of defenses.
* @property-read array $attacks List of attacks.
* @property-read array $look List of looks.
*/
class OTS_Monster extends DOMDocument
{
@@ -273,6 +274,30 @@ class OTS_Monster extends DOMDocument
return $loot;
}
/**
* Returns look of the monster.
*
* @return array Look with all the attributes of the look.
* @throws DOMException On DOM operation error.
*/
public function getLook()
{
$look = array();
$element = $this->documentElement->getElementsByTagName('look')->item(0);
$look['type'] = $element->getAttribute('type');
$look['typeex'] = $element->getAttribute('typeex');
$look['head'] = $element->getAttribute('head');
$look['body'] = $element->getAttribute('body');
$look['legs'] = $element->getAttribute('legs');
$look['feet'] = $element->getAttribute('feet');
$look['addons'] = $element->getAttribute('addons');
$look['corpse'] = $element->getAttribute('corpse');
return $look;
}
/**
* Returns all monster summons.
*
@@ -560,6 +585,9 @@ class OTS_Monster extends DOMDocument
case 'attacks':
return $this->getAttacks();
case 'look':
return $this->getLook();
default:
throw new OutOfBoundsException();
}