Database -> Furnidata.xml

Karel

Member
May 15, 2019
80
13
Hey hey
Is there a way to create furnidata.xml from database tables? I've seached on the internet, but all I got is the other way around...
Thanks! :)
 

Joe

Well-Known Member
Jun 10, 2012
4,172
1,955
Hey hey
Is there a way to create furnidata.xml from database tables? I've seached on the internet, but all I got is the other way around...
Thanks! :)
Probably not.. Look here, all of the furnidata.xml for the piece of furniture is there
You could also copy a hotel's whole furnidata, just a thought.

Not sure if there's a tool that does this.
 

Higoka

Active Member
Dec 16, 2018
174
74
i could make a small script but its not so hard to make a furnidata just copy the <furnitype> element and change id swfname title and description.
 

Higoka

Active Member
Dec 16, 2018
174
74
i havent tested this because i dont own a hotel but it should work i guess. its for arcturus.
PHP:
<?php

$pdo = new PDO('mysql:host=127.0.0.1;dbname=DBNAME;charset=utf8mb4', 'root', 'PASSWORD', [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);

$items = $pdo->query('SELECT * FROM items_base');

$roomItems = '';
$wallItems = '';

foreach ($items as $item) {
    $xml = vsprintf('<furnitype id="%d" classname="%s"><revision>0</revision><xdim>%d</xdim><ydim>%d</ydim><name>%s</name><description></description><canstandon>%d</canstandon><cansiton>%d</cansiton><canlayon>%d</canlayon></furnitype>', [
        $item['sprite_id'],
        $item['item_name'],
        $item['width'],
        $item['height'],
        $item['public_name'],
        $item['allow_walk'],
        $item['allow_sit'],
        $item['allow_lay'],
    ]);

    if ($item['type'] === 's') {
        $roomItems .= $xml;
    } else {
        $wallItems .= $xml;
    }
}

$xml = '<?xml version="1.0" encoding="UTF-8"?>
        <furnidata>
          <roomitemtypes>' . $roomItems . '</roomitemtypes>
          <wallitemtypes>' . $wallItems . '</wallitemtypes>
        </furnidata>';

file_put_contents('furnidata.xml', $xml);
 

Users who are viewing this thread

Top