This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathRun.php
59 lines (44 loc) · 1.4 KB
/
Run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/*
Tags so people can find this repo:
Club Penguin
CPPS
Club Penguin Private Server
How to make a
CP
*/
namespace Kitsune\ClubPenguin;
use Kitsune\BindException;
date_default_timezone_set("America/Los_Angeles");
error_reporting(E_ALL ^ E_STRICT);
spl_autoload_register(function ($path) {
$realPath = str_replace("\\", "/", $path) . ".php";
$includeSuccess = include_once $realPath;
if(!$includeSuccess) {
echo "Unable to load $realPath\n";
}
});
$loginFile = "Login.xml";
$redemptionFile = "Redemption.xml";
$worldsDirectory = "Worlds";
$worldManager = new WorldManager();
$loginConfig = simplexml_load_file($loginFile);
$login = new Login();
$login->listen($loginConfig->address, (int)$loginConfig->port);
$redemptionConfig = simplexml_load_file($redemptionFile);
$redemption = new Redemption();
$redemption->listen($redemptionConfig->address, (int)$redemptionConfig->port);
$worldFiles = array_diff(scandir($worldsDirectory), array('..', '.'));
foreach($worldFiles as $worldFile){
$worldConfig = simplexml_load_file($worldsDirectory . "/" . $worldFile);
$worldManager->add((int)$worldConfig->id, $worldConfig->name, $worldConfig->address, (int)$worldConfig->port, $worldConfig->capacity, $worldConfig->language);
}
$login->worldManager = $worldManager;
while(true) {
$login->acceptClients();
$redemption->acceptClients();
foreach($worldManager->worldsById as $world){
$world->acceptClients();
}
}
?>