forked from UltimaPHP/UltimaPHP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pacotes colocados para o novo padrão A8 e A9. Adicionado novas funcoe…
…s na classe packet.
- Loading branch information
Showing
5 changed files
with
238 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
/** | ||
* Ultima PHP - OpenSource Ultima Online Server written in PHP | ||
* Version: 0.1 - Pre Alpha | ||
* | ||
* Send the server list to the client | ||
*/ | ||
class packet_0xA9 extends Packets { | ||
|
||
private $sizePacket; | ||
private $charCount; | ||
private $chars; | ||
private $citiesCount; | ||
private $cities; | ||
private $flags; | ||
private $lastCharLost; | ||
/** | ||
* Defines the packet, the length and if there is a client send | ||
*/ | ||
public function __construct($client = false) { | ||
$this->setPacket(0xA9); | ||
|
||
if ($client) { | ||
$this->client = $client; | ||
} | ||
} | ||
|
||
/**s | ||
* Handle the packet receive | ||
*/ | ||
public function send() { | ||
if (!$this->client) { | ||
return false; | ||
} | ||
|
||
$this->addInt8($this->charCount); | ||
|
||
for($i=0;$i<$this->charCount;$i++) | ||
{ | ||
if ($i < count($this->chars)) { | ||
$this->addText($this->chars[$i]['name'], 30); | ||
$this->addText("", 30); | ||
} else { | ||
$this->addText("", 60); | ||
} | ||
} | ||
|
||
$this->addInt8(dechex($this->citiesCount)); | ||
|
||
foreach ($this->cities as $key => $location) | ||
{ | ||
$this->addInt8(dechex($key+1)); | ||
$this->addText($location['name'], 32); | ||
$this->addText($location['area'], 32); | ||
$this->addInt32(dechex($location['position']['x'])); | ||
$this->addInt32(dechex($location['position']['y'])); | ||
$this->addInt32(dechex($location['position']['z'])); | ||
$this->addInt32(dechex($location['position']['map'])); | ||
$this->addUInt32(dechex($location['cliloc'])); | ||
$this->addInt32(0); | ||
} | ||
|
||
|
||
$this->addInt32(dechex($this->flags)); | ||
$this->addInt16($this->lastCharLost); | ||
|
||
Sockets::out($this->client, $this); | ||
return true; | ||
} | ||
|
||
public function setSizePacket($sizePacket) { | ||
$this->sizePacket = $sizePacket; | ||
return true; | ||
} | ||
|
||
public function setCharCount($charCount) { | ||
$this->charCount = (int)$charCount; | ||
return true; | ||
} | ||
|
||
public function setChars($chars) { | ||
$this->chars = $chars; | ||
return true; | ||
} | ||
|
||
public function setCitiesCount($citiesCount) { | ||
$this->citiesCount = (int)$citiesCount; | ||
return true; | ||
} | ||
|
||
public function setCities($cities) { | ||
$this->cities = $cities; | ||
return true; | ||
} | ||
|
||
public function setFlags($flags) { | ||
$this->flags = $flags; | ||
return true; | ||
} | ||
|
||
public function setLastCharLost($lastCharLost) { | ||
$this->lastCharLost = (int)$lastCharLost; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* Ultima PHP - OpenSource Ultima Online Server written in PHP | ||
* Version: 0.1 - Pre Alpha | ||
*/ | ||
|
||
class packet_0xB9 extends Packets { | ||
|
||
private $flags; | ||
|
||
/** | ||
* Defines the packet, the length and if there is a client send | ||
*/ | ||
public function __construct($client = false) { | ||
$this->setPacket(0xB9); | ||
$this->setLength(5); | ||
|
||
if ($client) { | ||
$this->client = $client; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Handle the packet sending | ||
*/ | ||
public function send() { | ||
if (!$this->client) { | ||
return false; | ||
} | ||
|
||
$this->addInt32($this->flags); | ||
|
||
return Sockets::out($this->client, $this); | ||
} | ||
|
||
public function setFlags($flags) { | ||
$this->flags = $flags; | ||
return true; | ||
} | ||
} |