Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [Share]L2 admin on php (https://postpacific.loc-online.com/showthread.php?t=6121)

hel 31.10.2006 13:44

[Share]L2 admin on php
 
L2 Admin 0.4.1 - Lineage2 administration tool, writen on php by hel.

---------------------------Changelog---------------------------
fixed:
-- DeleteItem (not fully tested)
-- A lot of optimizing in code, since last version (tested)
-- Tested and fixed some modules
added:
-- see specifications list from 10 to 14, and 16.
-- Basic ip-security.

---------------------------Specifications list---------------------------
1. Check user, online or not (tested)
2. Change user nickname (tested)
3. Kicking user (tested)
4. Add item with enchant (tested)
5. Delete item from user (not tested ingame, but theoreticaly working)
6. Modify user face, hairs, race, class, etc (tested)
7. Punish user (tested)
8. Move user to another account (tested)
9. Change clan owner to selected user (not working)
10. Increasing user sp, exp, karma, pk, pvp (tested)
11. Setting user sp, exp, karma, pk, pvp (tested)
12. Show announce (tested)
13. Set user sociality (be care with it, it's crashing cached!)
14. Set GM rights to user (not tested ingame, but theoreticaly working)
15. Getting char id by char name, directly from db. (tested)
16. Showing char invertory and warehouse by char id, directly from db. (tested)

---------------------------Tips---------------------------
"not tested ingame, but theoreticaly working" - it's mean, that's cached return OK (1). But not tested ingame.

---------------------------Other---------------------------
*. Basic ip security. For change - open functions.php via notepad and edit:
-- $list_allow=array("127.0.0.1","1xx.xx8.0.1");

---------------------------How to install---------------------------
You must have Apache newer than 1.3.32 version and PHP newer than 4.0.1 version, with uncommented module php_mssql.dll.
1. Extract archive L2_Admin_0.4.rar in any folder on web-server.
2. Edit white list of IPs, for allow view L2Admin page, in functions.php (see --other-- section in readme).
3. Edit file "config.php".
4. Now you can use this script, for do it you can go on http://www.myhost.ru/path_to_script/index.php.


---------------------------Thanks---------------------------
Thanks to all contributors and helpers.
Especially to Barabashka, Astrid, ZeonDi, Kenjiro and others, actively helping...

Any bug reports and solutions will be very nice...

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
L2_Admin_0.4.1.zip — 69906 байт

Majesty 31.10.2006 13:59

You also expecting problems with "delete item from user" packet?
Which packet are you used? I'm used 54 DelItem2Packet("ddS"), and didn't get any results. Cached returns "01", item not deleted.

hel 31.10.2006 14:07

Majesty:
Same problem as your...
But I'm using DelItemPacket [13]...
But if player online, and I'm using that packet - it returns me 1, but don't delete item. 8(

Majesty 31.10.2006 14:23

Quote:

Originally Posted by hel (Post 71140)
Majesty:
Same problem as your...
But I'm using DelItemPacket [13]...
But if player online, and I'm using that packet - it returns me 1, but don't delete item. 8(

"1" or "01" ?
For really working, tested functions return are "1". (kick_char, etc)

hel 31.10.2006 14:42

Quote:

Originally Posted by Majesty (Post 71143)
"1" or "01" ?
For really working, tested functions return are "1". (kick_char, etc)

If char offline, script returns 01 and don't delete item.
But if char online, script returns 1 and don't delete item.

Majesty 31.10.2006 14:51

Quote:

Originally Posted by hel (Post 71145)
If char offline, script returns 01 and don't delete item.
But if char online, script returns 1 and don't delete item.

IMHO, char must be offline.
Two packets, two functions - and same errors...

Ameron 31.10.2006 15:39

Well, I use 54 DelItem2Packet also, but sometimes it delete item, sometime not :(
why - dunno.
hel, if you wanna help - contact me.
Have a desire to write normal L2-admin :)

barabashka 31.10.2006 15:45

13 DeleteItemPacket works fine. but when function return error, just repeat sending packet 1-2 times.

zlopi 31.10.2006 19:43

4. Add item with enchant (adding item, when user offline) (tested)
5. Delete item from user (deleting item) (bugged?)
not work :-(

return 01

Majesty 31.10.2006 20:05

2 hel:

PHP Code:

function delete_item($id,$item_warehouse,$item_id,$item_amount,$char_name){

  
kick_char($id,$char_name);
  
    
$buf = pack("c", 13); // 
$buf .= pack("i", $id); //char_id
$buf .= pack("i", $item_warehouse); 
$buf .= pack("i", $item_id);
$buf .= pack("i", $item_amount);  
$buf .= tounicode ( "GM" ); 

$answ=cached_new($buf);
    
  if(
$answ==="x1")return "Item was successfully deleted.";
  else return 
"<font color=red>Error:</font><font class=log_text>$answ</font> deleting item.";
} 

Don't know, why my function didn't work 4 hours ago. Now, working fine.

paul 31.10.2006 21:14

Intresting program =D

I'm having problems with the add item code though. It just wont do it. Cached shows a connection then throws out error 997 everytime i try.

astrid 01.11.2006 00:44

hel, you use item id (item type 57 for adena f.e.) or item uid (unique identity from user_item table) in del item packet?

it should be item uid from database and user must be offline in time of use this packet.

poltomb 01.11.2006 04:02

Quote:

Originally Posted by hel (Post 71137)
7. Punish user (founded only one punish type - stopsay... worked, when user online) (tested)

There is a command (don't know function name) //char_stop. If you can fid a function for this command then you can stop the user from moving (only can chat) for a period of time.

paul 01.11.2006 10:09

nevermind my post i got it workin (i'm an idiot and didn't load itemcache hehe)

hel 01.11.2006 10:11

poltomb:
It's not StopCharPacket?

astrid:
O_O
Wasn't know it earlier...
Do you know, how to get unique id, using itemdata id (or item_pch)?
But... Additem uses item_id from itemdata?

Domzelan 01.11.2006 10:38

Hel can u make kick before send command.
Rus: Можешь сделать чтобы перед каждой командой кикало принудительно и банило на 1-2 минуты? И когда используешь модифицировать перса выбераешь ID чара - далее вылетает окно которое щас вылетает и там сразу показывается имя чара его тип волос его класс далее меняешь что надо и далее жмешь применить и всё меняется? или если я оставляю поле пустым оно не меняется? допустим мне надо сменить только класс перса вбиваю только class остальное пустое оставляю - поменяется только класс?

zlopi 01.11.2006 10:42

Quote:

Originally Posted by Majesty (Post 71163)
2 hel:
$buf .= tounicode ( "GM" );

GM must be in online

hel 01.11.2006 11:10

Quote:

Originally Posted by Domzelan (Post 71207)
Hel can u make kick before send command.
Rus: Можешь сделать чтобы перед каждой командой кикало принудительно и банило на 1-2 минуты? И когда используешь модифицировать перса выбераешь ID чара - далее вылетает окно которое щас вылетает и там сразу показывается имя чара его тип волос его класс далее меняешь что надо и далее жмешь применить и всё меняется? или если я оставляю поле пустым оно не меняется? допустим мне надо сменить только класс перса вбиваю только class остальное пустое оставляю - поменяется только класс?

Of course, not so hard...
Посмотрю... Но только после того, как отдохну после написания этого скрипта.

Majesty 01.11.2006 11:30

Quote:

Originally Posted by zlopi (Post 71208)
GM must be in online

hmm... Then GM is offline, all functions is working too.

astrid 02.11.2006 00:26

Quote:

Originally Posted by hel (Post 71203)
astrid:
O_O
Wasn't know it earlier...
Do you know, how to get unique id, using itemdata id (or item_pch)?
But... Additem uses item_id from itemdata?

make simple query to user_item table.

something like:
Code:

SELECT user_item.item_id as uid FROM user_item INNER JOIN user_data ON user_item.char_id = user_data.char_id WHERE (user_item.item_type = "+itemid+") AND (user_data.char_id = "+charid+") and user_item.warehouse="+warehouse
i suggest you to make stored procedure in db if you use it often.

//rus
с моим английским хрен что поймешь наверно :) короче просто нужно сделать запрос что я привел выше (синтаксис не пхпшный но я думаю понятна суть). если используешь часто заведи сторед процедуру в БД.
additem2 использует просто итемид (тип предмета) 57 для адена например.

top-gear 02.11.2006 03:20

it would be better if we could ad a user/pass field with ip verification so none can exploit the scripts

hel 02.11.2006 05:28

Quote:

Originally Posted by astrid (Post 71264)
make simple query to user_item table.

something like:
Code:

SELECT user_item.item_id as uid FROM user_item INNER JOIN user_data ON user_item.char_id = user_data.char_id WHERE (user_item.item_type = "+itemid+") AND (user_data.char_id = "+charid+") and user_item.warehouse="+warehouse
i suggest you to make stored procedure in db if you use it often.

//rus
с моим английским хрен что поймешь наверно :) короче просто нужно сделать запрос что я привел выше (синтаксис не пхпшный но я думаю понятна суть). если используешь часто заведи сторед процедуру в БД.
additem2 использует просто итемид (тип предмета) 57 для адена например.

Will be in next build. Thanks!

Kenjiro 02.11.2006 07:14

Working delete2 function:

Code:

function l2_delitem2 ( $item_id, $amount ) {
  // 54 - DelItem2, item_id, amount
  $cached_op = pack ( "cVVV", 54, $item_id, $amount, 1 );
  $cached_op .= ansi2unicode ( "webadmin" );
  $ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );
  return ( $ret_string );
}

Variable $item_id is from user_item table.

hel 02.11.2006 08:03

Quote:

Originally Posted by Kenjiro (Post 71276)
Working delete2 function:

Code:

function l2_delitem2 ( $item_id, $amount ) {
  // 54 - DelItem2, item_id, amount
  $cached_op = pack ( "cVVV", 54, $item_id, $amount, 1 );
  $cached_op .= ansi2unicode ( "webadmin" );
  $ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );
  return ( $ret_string );
}

Variable $item_id is from user_item table.

Thanks!
Will add this function in the next build!
PS: Got it from L2z? ;)

Could anyone explain, how different "V" and "i" in pack() function? :wave:

Domzelan 02.11.2006 08:56

Ready to test new build :)


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