Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 14.06.2007, 12:01   #14
Alamat
Архивный участник
 
Join Date: Jun 2007
Posts: 61
Default

Вот качед, я его обрезал немного сейчас, но там лежит он в полном объеме
<?php

class CacheD {
var $cachedport = 2012;
var $cachedip = 'xx.x.0.1';
var $webadmin = 'WebAdmin';

//To have explicit output, use CacheD_chatterbox, better than editing this array
var $fsockerror = false;
var $socketerrors = array(
"1" => True, "01" => False, "02" => False, "03" => False, "04" => False,
"05" => False, "06" => False, "07" => False, "08" => False, "09" => False,
"010" => False, "011" => False, "012" => False, "013" => False, "014" => False,
"015" => False, "016" => False, "017" => False, "018" => False, "019" => False,
"020" => False, "021" => False, "022" => False, "023" => False, "024" => False,
"025" => False, "026" => False);

function tounicode ($string){
$rs="";
for($i=0; $i < strlen($string); $i++) { $rs .= $string[$i].chr(0); }
$rs .= chr(0).chr(0);
return($rs);
}

function CacheDInteractive($buf) {
$fp = fsockopen($this->cachedip, $this->cachedport , $errno, $errstr, 5);
$rs = '';
if (!$fp) return $this -> fsockerror;

$packet = pack("s", (strlen($buf)+2)).$buf;
fwrite($fp, $packet);
$len = unpack("v", fread($fp, 2));
$rid = unpack("c", fread($fp, 1));
for ($i = 0;$i < (($len[1]-4) / 4);$i++) {
$read = unpack("i", fread($fp, 4));
$rs .= $read[1];
}
fclose($fp);
$result = $this -> socketerrors[$rs];
return($result);
}

function CheckCharacterPacket($char_id) {
$buf = pack("c", 1);
$buf .= pack("V", $char_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function SetCharacterLocationPacket($char_id,$xloc,$yloc,$z loc) {
$buf = pack("c", 2);
$buf .= pack("V", $char_id);
$buf .= pack("V", 1);
$buf .= pack("V", $xloc);
$buf .= pack("V", $yloc);
$buf .= pack("V", $zloc);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function SetBuilderCharacterPacket($char_id, $builder_level) {
$buf = pack("c", 3);
$buf .= pack("V", $char_id);
$buf .= pack("V", $builder_level);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function ChangeCharacterNamePacket($char_id,$new_char_name) {
$buf=pack("cV",4,$char_id);
$buf .= $this -> tounicode($new_char_name);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function KickCharacterPacket($char_id){
$buf = pack("cV",5,$char_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function AddSkillPacket($char_id, $skill_id, $skill_level) {
$buf=pack("cVVV",6,$char_id,$skill_id,$skill_level );
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function DelSkillPacket($char_id, $skill_id) {
$buf = pack("c", 7);
$buf .= pack("V", $char_id);
$buf .= pack("V", $skill_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function ModSkillPacket($char_id, $skill_id, $new_skill_level) {
$buf=pack("cVVV",8,$char_id,$skill_id,$new_skill_l evel);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function DelItemPacket($char_id, $item_warehouse, $item_uid, $amount) {
$buf = pack("cVVVV",13,$char_id,$item_warehouse,$item_uid ,$amount);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function ModCharPacket($char_id, $new_SP, $new_EXP, $new_Karma, $new_PK, $new_PKP, $new_PVP) {
$buf = pack("c", 15);
$buf .= pack("V", $char_id);
$buf .= pack("V", $new_SP);
$buf .= pack("V", $new_EXP);
$buf .= pack("V", $new_Karma);
$buf .= pack("V", $new_PK);
$buf .= pack("V", $new_PKP);
$buf .= pack("V", $new_PVP);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function ModChar2Packet($char_id, $gender, $race, $class, $face, $hair_shape, $hair_color) {
$buf = pack("c", 16);
$buf .= pack("V", $char_id);
$buf .= pack("V", $gender);
$buf .= pack("V", $race);
$buf .= pack("V", $class);
$buf .= pack("V", $face);
$buf .= pack("V", $hair_shape);
$buf .= pack("V", $hair_color);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function PunishCharPacket($char_id,$punish_id,$punish_time) {
$buf = pack("cVVV",18,$char_id,$punish_id,$punish_time);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function SetBuilderAccountPacket($account_name, $builder_level) {
$buf = pack("c", 19);
$buf .= $this -> tounicode($account_name);
$buf .= pack("V", $builder_level);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function DisableCharacterPacket($char_id) {
$buf = pack("c", 20);
$buf .= pack("V", $char_id);
$buf .= pack("V", 1);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function EnableCharacterPacket($char_id, $account_id) {
$buf = pack("c", 21);
$buf .= pack("V", $char_id);
$buf .= pack("V", $account_id);
return $this -> CacheDInteractive($buf);
}

function ModChar3Packet($char_id, $add_SP, $add_EXP, $add_Karma, $add_PK, $add_PKP, $add_PVP) {
$buf = pack("c", 29);
$buf .= pack("V", $char_id);
$buf .= pack("V", $add_SP);
$buf .= pack("V", $add_EXP);
$buf .= pack("V", $add_Karma);
$buf .= pack("V", $add_PK);
$buf .= pack("V", $add_PKP);
$buf .= pack("V", $add_PVP);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function MoveCharacterPacket($char_id,$new_account_id,$new_ account_name){
$buf=pack("cVVS",31,$char_id,$new_account_id,$this -> tounicode($new_account_name));
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function DeleteCharPacket($char_id) {
$buf = pack("cV",34,$char_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function PledgeChangeOwnerPacket($pledge_id, $new_leader_id) {
$buf = pack("cVV",37,$pledge_id,$new_leader_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}


function PledgeDeletePacket($pledge_id) {
$buf = pack("c", 38);
$buf .= pack("V", $pledge_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function BanCharPacket($char_id, $hours ) {
$buf = pack("c", 39);
$buf .= pack("V", $char_id);
$buf .= pack("V", $hours);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function SendHomePacket($char_id) {
$buf = pack("cV",45,$char_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function ChangePledgeLevelPacket($pledge_id, $new_level) {
$buf = pack("cVV",46,$pledge_id, $new_level);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function CreatePledgePacket($pledge_name, $leader_id) {
$buf = pack("c",47);
$buf .= $this -> tounicode($pledge_name);
$buf .= pack("V",$leader_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function SetSkillAllPacket($char_id) {
$buf = pack("cV",48,$char_id);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function RestoreCharToAccount($char_id,$new_char_name,$acco unt_id,$account_name) {
$buf = pack("c", 49);
$buf .= pack("V", $char_id);
$buf .= $this -> tounicode($new_char_name);
$buf .= pack("V", $account_id);
$buf .= $this -> tounicode($account_name);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function ManIntAnnouncePacket($text,$id,$interval) {
$buf = pack("c", 51);
$buf .= pack("V", 1);
$buf .= pack("V", $interval);
$buf .= pack("V", $id);
$buf .= tounicode($text);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

function DelItem2Packet($item_uid, $amount) {
$buf = pack("cVV", 54, $item_uid, $amount);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}

//no funciona con el item numero 1 (short sword?), por razones desconocidas
// puede que el orden o la lista de param este mal
function AddItem2Packet($char_id,$warehouse,$item_type,$ite m_amount,$enchant, $eroded, $bless, $wished) {
$buf = pack("c", 55);
$buf .= pack("V", $char_id);
$buf .= pack("V", $warehouse);
$buf .= pack("V", $item_type);
$buf .= pack("V", $item_amount);
$buf .= pack("V", $enchant);
$buf .= pack("V", $eroded);
$buf .= pack("V", $bless);
//$buf .= pack("V", $ident);
$buf .= pack("V", $wished);
$buf .= pack("V", 1);
$buf .= $this -> tounicode($this -> webadmin);
return $this -> CacheDInteractive($buf);
}


?>
Alamat is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 15:29.