Can some body bring me an example of package to change character name using PHP and CacheD please. Best Regards
Name changes on retail were processed on a weekly basis, after every maitenance server reboot. So, I dont think CacheD is able to handle that, and it certainly doesnt care about it, all it use is account_ids.
Actually name change CAN be done via cached and php. I have it working on a modified admin panel I've been privately working on. You must issue a character kick from game before issuing the name change. cached packet for name change: Code: define('ChangeCharacterName', 4); // dS - charId, newName (char must be offline!) code snippet for php example of how to send packet (assuming you already have a cached class set up in php) Code: if ($c_name_new!="") { if (strcasecmp($c_name_new, $c_name)!=0) { if ($l2w->is_char_exists($c_name_new)) $err_str="A character with that name already exists."; //check if new name exists } else $err_str="Current and new character names must be different."; //check if current and new names are the same } else $err_str="A new character name was not specified."; //check if new name is blank if ($err_str=="") { $cached=cached_connect($sid); $result=$cached->sendPacket(KickCharacter, $c_id); //kick char out of game if ($result) //if kick successful proceed with name change { $result=$cached->sendPacket(ChangeCharacterName, $c_id, $c_name_new); //send packet to change name if ($result) { $info_str="Character $c_name has been renamed to $c_name_new"; //if change successful show success $log->to_file("Character $c_name has been renamed to $c_name_new. Additional information: server_id=$sid, char_id=$c_id.", "change_char_name"); //log not necessary if not using log files (but you should be) if ($func=="info_char") $tpl->assign("C_NAME", $c_name_new); $op_dlg=false; } else $err_str="Unable to rename the character."; //error msg if unable to rename } else $err_str="Could not kick character from the game."; //error msg if could not kick from game } l2w=lin2world class cached=cached class
But the package to change is this? pack("cVV",4,$_char_id, $new_name).tounicode('webadmin') Thats correct?
It is possible.. i has been doing it for years... This is a simplified version of how to use: Code: function CacheDInteractive($buf) { $fp = fsockopen("localhost", 2012, $errno, $errstr, 2); if (!$fp) return($GLOBALS['socketerrors'][-1]); fwrite($fp, pack("s", (strlen($buf)+2)).$buf); $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); if($GLOBALS['socketerrors'][$rs] != null) return $GLOBALS['socketerrors'][$rs]; else return $rs; } #4 ChangeCharacterNamePacket("dSS") function ChangeCharacterNamePacket($char_id, $new_charname) { $buf = pack("c", 4); $buf .= pack("i", $char_id); $buf .= tounicode($new_charname); return CacheDInteractive($buf); } Like has been said before.. you need to kick the player first or it will fail.