• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Gesior classes/vocations.php

Adorius Black

Advanced OT User
Joined
Mar 31, 2020
Messages
304
Solutions
3
Reaction score
180
Hi I reinstalled my windows and suddenly I have this error. Before I havent problem with it. Anybody know what does it mean please?
voca.png
PHP:
<?php
if(!defined('INITIALIZED'))
    exit;

class Vocations implements Iterator, Countable
{
    private $vocations = array();
    private $XML;
    public $iterator = 0;

    public function __construct($file)
    {
        $XML = new DOMDocument();
        if(!$XML->load($file))
            throw new InvalidArgumentException('Cannot load file <b>' . htmlspecialchars($file) . '</b>');

        $this->XML = $XML;
        $_tmp_vocations = array();

        foreach($XML->getElementsByTagName('vocation') as $vocation)
        {
            if($vocation->hasAttribute('id') && $vocation->hasAttribute('name'))
            {
                $vocationData = array();
                $vocationData['id'] = $vocation->getAttribute('id');
                $vocationData['name'] = $vocation->getAttribute('name');
                if($vocation->hasAttribute('fromvoc'))
                    $vocationData['fromvoc'] = $vocation->getAttribute('fromvoc');
                else
                    $vocationData['fromvoc'] = $vocationData['id'];
                if($vocation->hasAttribute('manamultiplier'))
                    $vocationData['manamultiplier'] = $vocation->getAttribute('manamultiplier');
                else
                    $vocationData['manamultiplier'] = 1;

                if($vocation->hasAttribute('gainhp'))
                    $vocationData['gainhp'] = $vocation->getAttribute('gainhp');
                else
                    $vocationData['gainhp'] = 0;
                if($vocation->hasAttribute('gainmana'))
                    $vocationData['gainmana'] = $vocation->getAttribute('gainmana');
                else
                    $vocationData['gainmana'] = 0;
                if($vocation->hasAttribute('gaincap'))
                    $vocationData['gaincap'] = $vocation->getAttribute('gaincap');
                else
                    $vocationData['gaincap'] = 0;

                if($vocation->hasAttribute('gainhpticks'))
                    $vocationData['gainhpticks'] = $vocation->getAttribute('gainhpticks');
                else
                    $vocationData['gainhpticks'] = 1;
                if($vocation->hasAttribute('gainhpamount'))
                    $vocationData['gainhpamount'] = $vocation->getAttribute('gainhpamount');
                else
                    $vocationData['gainhpamount'] = 0;

                if($vocation->hasAttribute('gainmanaticks'))
                    $vocationData['gainmanaticks'] = $vocation->getAttribute('gainmanaticks');
                else
                    $vocationData['gainmanaticks'] = 1;
                if($vocation->hasAttribute('gainmanaamount'))
                    $vocationData['gainmanaamount'] = $vocation->getAttribute('gainmanaamount');
                else
                    $vocationData['gainmanaamount'] = 0;

                if($vocation->hasAttribute('gainsoulticks'))
                    $vocationData['gainsoulticks'] = $vocation->getAttribute('gainsoulticks');
                else
                    $vocationData['gainsoulticks'] = 1;

                if($vocation->hasAttribute('attackspeed'))
                    $vocationData['attackspeed'] = $vocation->getAttribute('attackspeed');
                else
                    $vocationData['attackspeed'] = 2000;

                $_tmp_vocations[$vocation->getAttribute('id')] = $vocationData;
            }
            else
                throw new RuntimeException('Cannot load vocation. <b>id</b> or/and <b>name</b> parameter is missing');
        }
        foreach($_tmp_vocations as $_tmp_vocation)
        {
            $this->vocations[$_tmp_vocation['id']] = new Vocation($_tmp_vocation);
        }
    }
    /*
     * Get vocation
    */
    public function getVocation($voc_id)
    {
        if(isset($this->vocations[$voc_id]))
            return $this->vocations[$voc_id];
        return false;
    }
    /*
     * Get vocation name without getting vocation
    */
    public function getVocationName($voc_id)
    {
        if($vocs = self::getVocation($voc_id))
            return $vocs->getName();
        return 'vocation does not exist';
    }

    public function current()
    {
        return $this->vocations[$this->iterator];
    }

    public function rewind()
    {
        $this->iterator = 0;
    }

    public function next()
    {
        ++$this->iterator;
    }

    public function key()
    {
        return $this->iterator;
    }

    public function valid()
    {
        return isset($this->vocations[$this->iterator]);
    }

    public function count()
    {
        return count($this->vocations);
    }

}

I have this errors also with original gesior and alot more errors which I really dont understand from where they comes. Everything happens after reinstall OS. I am using Xampp
eee.png


I already add php into variables. but it doesnt help. i am using php 8.1.25. I dont think its problem with my code because its same with original gesior and before reinstalling OS it was good without error and I didnt change even one line of code. Everything is same as it was. So problem is maybe in my php version or I add bad variable. I really dont know...

My variable is set to:
C:\xampp\php
 
Last edited:
You need to use XAMPP with PHP version 7.x (7.4 probably).
New PHP versions require cleaner PHP code. Gesior2012 code is in PHP format from 2008. Some critical parts were adjusted to meet PHP 7.x - 8.0 standards, but for sure they are not 8.0+ valid code. Anyway, this code still works and is 100% safe.
These are just deprecated and warnings. Edit index.php. There is:
PHP:
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE);
change it to:
PHP:
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING);
 
Back
Top