diff --git a/admin/pages/players.php b/admin/pages/players.php
index c0be81f4..75a30c11 100644
--- a/admin/pages/players.php
+++ b/admin/pages/players.php
@@ -10,6 +10,7 @@
use MyAAC\Forum;
use MyAAC\Models\Player;
+use MyAAC\Server\Outfits;
use MyAAC\Server\XML\Vocations;
defined('MYAAC') or die('Direct access not allowed!');
@@ -659,14 +660,14 @@ else if (isset($_REQUEST['search'])) {
+ $outfits = Outfits::get();
+ if ($outfits) { ?>
diff --git a/system/compat/base.php b/system/compat/base.php
index 5a46ecf2..75fcbd35 100644
--- a/system/compat/base.php
+++ b/system/compat/base.php
@@ -74,3 +74,57 @@ function fieldExist($field, $table)
global $db;
return $db->hasColumn($table, $field);
}
+
+function Outfits_loadfromXML(): ?array
+{
+ global $config;
+ $file_path = $config['data_path'] . 'XML/outfits.xml';
+ if (!file_exists($file_path)) { return null; }
+
+ $xml = new DOMDocument;
+ $xml->load($file_path);
+
+ $outfits = null;
+ foreach ($xml->getElementsByTagName('outfit') as $outfit) {
+ $outfits[] = Outfit_parseNode($outfit);
+ }
+ return $outfits;
+}
+
+function Outfit_parseNode($node): array
+{
+ $looktype = (int)$node->getAttribute('looktype');
+ $type = (int)$node->getAttribute('type');
+ $lookname = $node->getAttribute('name');
+ $premium = $node->getAttribute('premium');
+ $unlocked = $node->getAttribute('unlocked');
+ $enabled = $node->getAttribute('enabled');
+ return array('id' => $looktype, 'type' => $type, 'name' => $lookname, 'premium' => $premium, 'unlocked' => $unlocked, 'enabled' => $enabled);
+}
+
+function Mounts_loadfromXML(): ?array
+{
+ global $config;
+ $file_path = $config['data_path'] . 'XML/mounts.xml';
+ if (!file_exists($file_path)) { return null; }
+
+ $xml = new DOMDocument;
+ $xml->load($file_path);
+
+ $mounts = null;
+ foreach ($xml->getElementsByTagName('mount') as $mount) {
+ $mounts[] = Mount_parseNode($mount);
+ }
+ return $mounts;
+}
+
+function Mount_parseNode($node): array
+{
+ $id = (int)$node->getAttribute('id');
+ $clientid = (int)$node->getAttribute('clientid');
+ $name = $node->getAttribute('name');
+ $speed = (int)$node->getAttribute('speed');
+ $premium = $node->getAttribute('premium');
+ $type = $node->getAttribute('type');
+ return array('id' => $id, 'clientid' => $clientid, 'name' => $name, 'speed' => $speed, 'premium' => $premium, 'type' => $type);
+}
diff --git a/system/functions.php b/system/functions.php
index f6c1ea1f..1ae4384a 100644
--- a/system/functions.php
+++ b/system/functions.php
@@ -1640,58 +1640,6 @@ function verify_number($number, $name, $max_length)
echo_error($name . ' cannot be longer than ' . $max_length . ' digits.');
}
-function Outfits_loadfromXML()
-{
- global $config;
- $file_path = $config['data_path'] . 'XML/outfits.xml';
- if (!file_exists($file_path)) { return null; }
-
- $xml = new DOMDocument;
- $xml->load($file_path);
-
- $outfits = null;
- foreach ($xml->getElementsByTagName('outfit') as $outfit) {
- $outfits[] = Outfit_parseNode($outfit);
- }
- return $outfits;
-}
-
- function Outfit_parseNode($node) {
- $looktype = (int)$node->getAttribute('looktype');
- $type = (int)$node->getAttribute('type');
- $lookname = $node->getAttribute('name');
- $premium = $node->getAttribute('premium');
- $unlocked = $node->getAttribute('unlocked');
- $enabled = $node->getAttribute('enabled');
- return array('id' => $looktype, 'type' => $type, 'name' => $lookname, 'premium' => $premium, 'unlocked' => $unlocked, 'enabled' => $enabled);
-}
-
-function Mounts_loadfromXML()
-{
- global $config;
- $file_path = $config['data_path'] . 'XML/mounts.xml';
- if (!file_exists($file_path)) { return null; }
-
- $xml = new DOMDocument;
- $xml->load($file_path);
-
- $mounts = null;
- foreach ($xml->getElementsByTagName('mount') as $mount) {
- $mounts[] = Mount_parseNode($mount);
- }
- return $mounts;
-}
-
- function Mount_parseNode($node) {
- $id = (int)$node->getAttribute('id');
- $clientid = (int)$node->getAttribute('clientid');
- $name = $node->getAttribute('name');
- $speed = (int)$node->getAttribute('speed');
- $premium = $node->getAttribute('premium');
- $type = $node->getAttribute('type');
- return array('id' => $id, 'clientid' => $clientid, 'name' => $name, 'speed' => $speed, 'premium' => $premium, 'type' => $type);
-}
-
function left($str, $length) {
return substr($str, 0, $length);
}
diff --git a/system/src/Server/Outfits.php b/system/src/Server/Outfits.php
new file mode 100644
index 00000000..fbcc7068
--- /dev/null
+++ b/system/src/Server/Outfits.php
@@ -0,0 +1,24 @@
+load();
+
+ return $outfits->getOutfits();
+ });
+ }
+}
diff --git a/system/src/Server/TOML/Outfits.php b/system/src/Server/TOML/Outfits.php
new file mode 100644
index 00000000..122631da
--- /dev/null
+++ b/system/src/Server/TOML/Outfits.php
@@ -0,0 +1,40 @@
+outfits[] = [
+ 'id' => $outfit['id'],
+ 'sex' => ($outfit['sex'] == 'male' ? SEX_MALE : SEX_FEMALE),
+ 'name' => $outfit['name'],
+ 'premium' => $outfit['premium'] ?? false,
+ 'locked' => $outfit['locked'] ?? false,
+ 'enabled' => $outfit['enabled'] ?? true,
+ ];
+ }
+ }
+
+ public function getOutfits(): array {
+ return $this->outfits;
+ }
+}
diff --git a/system/src/Server/XML/Outfits.php b/system/src/Server/XML/Outfits.php
new file mode 100644
index 00000000..9616fdd3
--- /dev/null
+++ b/system/src/Server/XML/Outfits.php
@@ -0,0 +1,49 @@
+load($file);
+
+ foreach ($xml->getElementsByTagName('outfit') as $outfit) {
+ $this->outfits[] = $this->parseOutfitNode($outfit);
+ }
+ }
+
+ private function parseOutfitNode($node): array
+ {
+ $looktype = (int)$node->getAttribute('looktype');
+ $type = (int)$node->getAttribute('type');
+ $name = $node->getAttribute('name');
+ $premium = getBoolean($node->getAttribute('premium'));
+ $locked = !getBoolean($node->getAttribute('unlocked'));
+ $enabled = getBoolean($node->getAttribute('enabled'));
+
+ return [
+ 'id' => $looktype,
+ 'sex' => ($type === 1 ? SEX_MALE : SEX_FEMALE),
+ 'name' => $name,
+ 'premium' => $premium,
+ 'locked' => $locked,
+ 'enabled' => $enabled,
+ ];
+ }
+
+ public function getOutfits(): array {
+ return $this->outfits;
+ }
+}
diff --git a/system/src/global.php b/system/src/global.php
index 8206945a..5d2e6bc3 100644
--- a/system/src/global.php
+++ b/system/src/global.php
@@ -1,5 +1,8 @@