2014-04-19 01:59:49 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ManiaPlanet dedicated server Xml-RPC client
|
|
|
|
*
|
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Maniaplanet\DedicatedServer\Xmlrpc;
|
|
|
|
|
2015-06-18 16:18:19 +02:00
|
|
|
class FaultException extends Exception {
|
|
|
|
static function create($faultString, $faultCode) {
|
|
|
|
switch ($faultString) {
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Password incorrect.':
|
|
|
|
case 'Permission denied.':
|
|
|
|
return new AuthenticationException($faultString, $faultCode);
|
|
|
|
case 'not connected to the internet':
|
|
|
|
case 'Not connected to the masterserver.':
|
|
|
|
case 'Not a game server.':
|
|
|
|
case 'Not a server.':
|
|
|
|
case 'Couldn\'t create the fake player.':
|
|
|
|
case 'Only server can receive a callvote':
|
|
|
|
case 'No map currently loaded.':
|
|
|
|
case 'No replay to save':
|
|
|
|
case 'Internal error.':
|
|
|
|
return new UnavailableFeatureException($faultString, $faultCode);
|
|
|
|
case 'You must enable the callbacks to be able to do chat routing.':
|
|
|
|
case 'Chat routing not enabled.':
|
|
|
|
case 'Script cloud disabled.':
|
|
|
|
case 'Already waiting for a vote.':
|
|
|
|
case 'You must stop server first.':
|
|
|
|
return new LockedFeatureException($faultString, $faultCode);
|
2014-05-08 21:10:56 +02:00
|
|
|
case 'Login or Uid unknown.':
|
2014-04-19 01:59:49 +02:00
|
|
|
case 'Login unknown.':
|
2015-02-24 10:26:46 +01:00
|
|
|
case 'Payer login unknown.':
|
2014-06-12 15:39:50 +02:00
|
|
|
return new UnknownPlayerException($faultString, $faultCode);
|
2014-04-19 23:14:37 +02:00
|
|
|
case 'The player is not a spectator':
|
2014-04-21 23:14:06 +02:00
|
|
|
case 'The player is not a spectator.':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Not a network player.':
|
|
|
|
case 'Player is not a fake player':
|
|
|
|
return new PlayerStateException($faultString, $faultCode);
|
2014-04-24 10:33:47 +02:00
|
|
|
case 'Player already ignored.':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Player already black listed.':
|
|
|
|
case 'Player already on guest list.':
|
|
|
|
case 'Map already added.':
|
|
|
|
return new AlreadyInListException($faultString, $faultCode);
|
|
|
|
case 'Login not banned.':
|
2014-04-24 10:33:47 +02:00
|
|
|
case 'Player not ignored.':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Player not black listed.':
|
|
|
|
case 'Player not on guest list.':
|
|
|
|
case 'Map not in the selection.':
|
2014-04-21 23:14:06 +02:00
|
|
|
case 'The map isn\'t in the current selection.':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Map not found.':
|
2014-06-12 15:39:50 +02:00
|
|
|
return new NotInListException($faultString, $faultCode);
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Start index out of bound.':
|
|
|
|
case 'invalid index':
|
|
|
|
return new IndexOutOfBoundException($faultString, $faultCode);
|
|
|
|
case 'the next map must be different from the current one.':
|
2015-01-12 13:39:10 +01:00
|
|
|
case 'No next map currently defined.':
|
2014-05-13 17:37:35 +02:00
|
|
|
return new NextMapException($faultString, $faultCode);
|
|
|
|
case 'Change in progress.':
|
|
|
|
return new ChangeInProgressException($faultString, $faultCode);
|
2014-04-22 21:56:18 +02:00
|
|
|
case 'Incompatible map type.':
|
|
|
|
case 'Map not complete.':
|
2014-08-03 13:02:02 +02:00
|
|
|
case 'Map corrupted.':
|
2014-06-21 22:36:20 +02:00
|
|
|
case 'Map lightmap is not up to date.':
|
2017-03-26 19:51:22 +02:00
|
|
|
case 'Map lightmap is not up to date. (will still load for now)':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'The map doesn\'t match the server packmask.':
|
|
|
|
return new InvalidMapException($faultString, $faultCode);
|
2014-04-22 21:56:18 +02:00
|
|
|
case 'Ladder mode unknown.':
|
2014-05-08 21:10:56 +02:00
|
|
|
case 'You cannot change the max players count: AllowSpectatorRelays is activated.':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'You cannot change the max spectators count: AllowSpectatorRelays is activated.':
|
2014-06-30 23:20:02 +02:00
|
|
|
case 'There are too many players':
|
|
|
|
case 'There are too many spectators':
|
2015-01-24 23:29:39 +01:00
|
|
|
case 'Unknown hideserver value':
|
2014-05-08 21:10:56 +02:00
|
|
|
return new ServerOptionsException($faultString, $faultCode);
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'New mode unknown.':
|
|
|
|
case 'You need to stop the server to change to/from script mode.':
|
|
|
|
case 'Not in script mode.':
|
|
|
|
case 'Not in Team mode.':
|
|
|
|
case 'Not in Rounds or Laps mode.':
|
|
|
|
case 'The scores must be decreasing.':
|
2015-06-18 16:18:19 +02:00
|
|
|
case 'No current script.':
|
2014-05-13 17:37:35 +02:00
|
|
|
return new GameModeException($faultString, $faultCode);
|
2017-03-16 18:20:30 +01:00
|
|
|
case 'couldn\'t write file.':
|
2014-05-13 17:37:35 +02:00
|
|
|
case 'Unable to write the black list file.':
|
|
|
|
case 'Unable to write the guest list file.':
|
|
|
|
case 'Unable to write the playlist file.':
|
|
|
|
case 'Could not save file.':
|
|
|
|
case 'Map unknown.':
|
|
|
|
case 'The playlist file does not exist.':
|
|
|
|
case 'Invalid url or file.':
|
|
|
|
case 'Invalid url.':
|
|
|
|
return new FileException($faultString, $faultCode);
|
2014-04-19 01:59:49 +02:00
|
|
|
}
|
2015-06-18 16:18:19 +02:00
|
|
|
if (preg_match('~^Unknown setting \'.*\'\.$~iu', $faultString)) {
|
2014-05-13 17:37:35 +02:00
|
|
|
return new GameModeException($faultString, $faultCode);
|
2015-06-18 16:18:19 +02:00
|
|
|
}
|
|
|
|
if (preg_match('~^Couldn\'t load \'.*\'\.$~iu', $faultString)) {
|
2014-05-13 17:37:35 +02:00
|
|
|
return new FileException($faultString, $faultCode);
|
2015-06-18 16:18:19 +02:00
|
|
|
}
|
2014-04-19 01:59:49 +02:00
|
|
|
|
|
|
|
return new self($faultString, $faultCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-18 16:18:19 +02:00
|
|
|
class AuthenticationException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class UnavailableFeatureException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class LockedFeatureException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class UnknownPlayerException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class PlayerStateException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class AlreadyInListException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class NotInListException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class IndexOutOfBoundException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class NextMapException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class ChangeInProgressException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class InvalidMapException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class GameModeException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class ServerOptionsException extends FaultException {
|
|
|
|
}
|
|
|
|
|
|
|
|
class FileException extends FaultException {
|
|
|
|
}
|