Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02.05.2007, 11:34   #1
Eloims
Архивный участник
 
Join Date: May 2006
Posts: 6
Default [share] PHP <-> CacheD

While working on the user control panel we use at our server, I was fed up to always have to think about cached,
so I've done a PHP file, easy to include, who helped quite a lot.

I think many of you already did that, but no one shared it, so if it's usefull to someone (in fact part of the code is leeched from the cached topic in General, so don't blame me if you see something yours).

I contain 3 PHP classes: CacheD, CacheD_chatterbox and CacheD_color_chatterbox.
The first one output True and False, depending on the success or not of the packet.
The second and third one output a message.

If you're not familiar with PHP objects, here you have an example
Code:
include('cached.php');
$char_id = 743;

$cached = new CacheD;
echo (($cached -> CheckCharacterPacket($char_id)? 'The character is online':'The character is offline');

$cached2 = new CacheD_chatterbox;
echo $cached2 -> CheckCharacterPacket($char_id); //print 'ok' or 'Char not in game.'
If you want to change a name, you may do something like that:

Code:
include('cached.php');
$char_id = 743;
$newname = 'Eloims';

$cached = new CacheD;
if ($cached -> KickCharacterPacket($char_id)) {
     $cached -> ChangeCharacterNamePacket($char_id, $newname);
}
//if the character is correctly kicked (or wasn't online), then change his name
The supported packets are:
#1 CheckCharacterPacket
#2 SetCharacterLocationPacket
#3 SetBuilderCharacterPacket
#4 ChangeCharacterNamePacket
#5 KickCharacterPacket
#6 AddSkillPacket
#7 DelSkillPacket
#8 ModSkillPacket
#13 DelItemPacket
#15 ModCharPacket
#16 ModChar2Packet
#18 PunishCharPacket
#19 SetBuilderAccountPacket
#20 DisableCharacterPacket
#21 EnableCharacterPacket
#29 ModChar3Packet
#31 MoveCharacterPacket
#34 DeleteCharPacket
#37 PledgeChangeOwnerPacket
#38 PledgeDeletePacket
#39 BanCharPacket
#45 SendHomePacket
#46 ChangePledgeLevelPacket
#47 CreatePledgePacket
#48 SetSkillAllPacket
#49 RestoreCharToAccount
#51 ManIntAnnouncePacket
#55 AddItem2Packet
#69 SetSociality
#70 SetInstantAnnouncePacket
#89 ChangeSubJobPacket
#90 StopCharPacket
#101 SendPrivateAnnouncePacket
#104 EternalBanPacket


when I tested
#37 PledgeChangeOwnerPacket
#38 PledgeDeletePacket
#101 SendPrivateAnnouncePacket
nothing happened, but cached returns x1

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
cached.rar — 2460 байт
Eloims 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 22:16.