Exemple #1
0
<?php

class Chatted extends Action
{
    public function __construct($row)
    {
        parent::LoadData($row);
    }
    public function __toString()
    {
        return sprintf("%s said &quot;%s&quot; at World %s - &lt;%d,%d,%d&gt;", $this->getUserLink(), htmlentities($this->data), $this->getWorldName(), $this->X, $this->Y, $this->Z);
    }
    public function getActionString()
    {
        return 'said <i>&quot;' . htmlentities($this->data) . '&quot;</i>';
    }
}
registerAction(CHAT, function ($row) {
    return new Chatted($row, false);
});
Exemple #2
0
                            $modif[$dataRemoved[1]] = -intval($dataRemoved[2]);
                        }
                        if (isset($modif[$dataAdded[0]])) {
                            $modif[$dataAdded[0]] += intval($dataAdded[1]);
                        } else {
                            $modif[$dataAdded[0]] = intval($dataAdded[1]);
                        }
                    } else {
                        //Item was added or removed
                        $data = preg_split('/:/', $change);
                        if (isset($modif[$data[1]])) {
                            $modif[$data[1]] += intval($data[2]);
                        } else {
                            $modif[$data[1]] = intval($data[2]);
                        }
                    }
                }
            }
            //check whether there were any modifications
            foreach ($modif as $id => $value) {
                if ($value != 0) {
                    $this->changed = true;
                }
            }
            $this->modif = $modif;
        }
    }
}
registerAction(CHEST_DELTA, function ($row) {
    return new ChestChanged($row, false);
});
<?php

header('Content-type: application/json');
require_once __DIR__ . '/dataLayer.php';
$action = $_POST['action'];
switch ($action) {
    case 'LOGIN':
        loginAction();
        break;
    case 'COOKIES':
        verifyCookies();
        break;
    case 'REGISTER':
        registerAction();
        break;
    case 'FRIENDS':
        getFriends();
        break;
    case 'ADDFRIEND':
        addFriend();
        break;
    case 'USERS':
        getUsers();
        break;
    case 'PROFILE':
        getProfile();
        break;
    case 'ENDSESS':
        endSession();
        break;
    case 'SAVET':
Exemple #4
0
<?php

class ButtonPressed extends Action
{
    public function __construct($row)
    {
        parent::LoadData($row);
    }
    public function __toString()
    {
        return sprintf("%s pressed a button at World %s - &lt;%d,%d,%d&gt;", $this->getUserLink(), $this->data, $this->getWorldName(), $this->X, $this->Y, $this->Z);
    }
    public function getActionString()
    {
        return 'pressed a button';
    }
}
registerAction(BUTTON_PRESSED, function ($row) {
    return new ButtonPressed($row, true);
});
Exemple #5
0
<?php

/** Block Modified Action
 */
class BlockModified extends Action
{
    public $removed = false;
    public function __construct($row, $wasRemoved)
    {
        parent::LoadData($row);
        $this->removed = $wasRemoved;
    }
    public function __toString()
    {
        return sprintf("%s %s a %s at World %s - &lt;%d,%d,%d&gt;", $this->getUserLink(), $this->removed ? 'removed' : 'placed', blockID2Link($this->type), $this->getWorldName(), $this->X, $this->Y, $this->Z);
    }
    public function getActionString()
    {
        return ($this->removed ? 'removed' : 'placed') . ' a ' . blockID2Link($this->type);
    }
}
registerAction(BLOCK_BROKEN, function ($row) {
    return new BlockModified($row, true);
});
registerAction(BLOCK_PLACED, function ($row) {
    return new BlockModified($row, false);
});