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
Old 31.10.2006, 13:44   #1
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default [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 байт
hel is offline  
Old 31.10.2006, 13:59   #2
Majesty
Архивный участник
 
Join Date: Mar 2006
Posts: 22
Default

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.
Majesty is offline  
Old 31.10.2006, 14:07   #3
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

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(
hel is offline  
Old 31.10.2006, 14:23   #4
Majesty
Архивный участник
 
Join Date: Mar 2006
Posts: 22
Default

Quote:
Originally Posted by hel View Post
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)
Majesty is offline  
Old 31.10.2006, 14:42   #5
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Quote:
Originally Posted by Majesty View Post
"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.
hel is offline  
Old 31.10.2006, 14:51   #6
Majesty
Архивный участник
 
Join Date: Mar 2006
Posts: 22
Default

Quote:
Originally Posted by hel View Post
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...
Majesty is offline  
Old 31.10.2006, 15:39   #7
Ameron
Архивный участник
 
Join Date: May 2005
Posts: 85
Default

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
Ameron is offline  
Old 31.10.2006, 15:45   #8
barabashka
Архивный участник
 
Join Date: Jan 2006
Posts: 55
Default

13 DeleteItemPacket works fine. but when function return error, just repeat sending packet 1-2 times.
barabashka is offline  
Old 31.10.2006, 19:43   #9
zlopi
Архивный участник
 
Join Date: Sep 2006
Posts: 31
Default

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

return 01
zlopi is offline  
Old 31.10.2006, 20:05   #10
Majesty
Архивный участник
 
Join Date: Mar 2006
Posts: 22
Default

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.
Majesty is offline  
Old 31.10.2006, 21:14   #11
paul
Архивный участник
 
Join Date: Feb 2005
Posts: 390
Default

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.
paul is offline  
Old 01.11.2006, 00:44   #12
astrid
Архивный участник
 
Join Date: May 2006
Posts: 55
Default

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.
astrid is offline  
Old 01.11.2006, 04:02   #13
poltomb
Архивный участник
 
Join Date: Sep 2006
Posts: 81
Default

Quote:
Originally Posted by hel View Post
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.
poltomb is offline  
Old 01.11.2006, 10:09   #14
paul
Архивный участник
 
Join Date: Feb 2005
Posts: 390
Default

nevermind my post i got it workin (i'm an idiot and didn't load itemcache hehe)
paul is offline  
Old 01.11.2006, 10:11   #15
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

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?
hel is offline  
Old 01.11.2006, 10:38   #16
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

Hel can u make kick before send command.
Rus: Можешь сделать чтобы перед каждой командой кикало принудительно и банило на 1-2 минуты? И когда используешь модифицировать перса выбераешь ID чара - далее вылетает окно которое щас вылетает и там сразу показывается имя чара его тип волос его класс далее меняешь что надо и далее жмешь применить и всё меняется? или если я оставляю поле пустым оно не меняется? допустим мне надо сменить только класс перса вбиваю только class остальное пустое оставляю - поменяется только класс?
Domzelan is offline  
Old 01.11.2006, 10:42   #17
zlopi
Архивный участник
 
Join Date: Sep 2006
Posts: 31
Default

Quote:
Originally Posted by Majesty View Post
2 hel:
$buf .= tounicode ( "GM" );
GM must be in online
zlopi is offline  
Old 01.11.2006, 11:10   #18
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Quote:
Originally Posted by Domzelan View Post
Hel can u make kick before send command.
Rus: Можешь сделать чтобы перед каждой командой кикало принудительно и банило на 1-2 минуты? И когда используешь модифицировать перса выбераешь ID чара - далее вылетает окно которое щас вылетает и там сразу показывается имя чара его тип волос его класс далее меняешь что надо и далее жмешь применить и всё меняется? или если я оставляю поле пустым оно не меняется? допустим мне надо сменить только класс перса вбиваю только class остальное пустое оставляю - поменяется только класс?
Of course, not so hard...
Посмотрю... Но только после того, как отдохну после написания этого скрипта.
hel is offline  
Old 01.11.2006, 11:30   #19
Majesty
Архивный участник
 
Join Date: Mar 2006
Posts: 22
Default

Quote:
Originally Posted by zlopi View Post
GM must be in online
hmm... Then GM is offline, all functions is working too.
Majesty is offline  
Old 02.11.2006, 00:26   #20
astrid
Архивный участник
 
Join Date: May 2006
Posts: 55
Default

Quote:
Originally Posted by hel View Post
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 для адена например.
astrid is offline  
Old 02.11.2006, 03:20   #21
top-gear
Архивный участник
 
Join Date: Aug 2005
Posts: 605
Default

it would be better if we could ad a user/pass field with ip verification so none can exploit the scripts
top-gear is offline  
Old 02.11.2006, 05:28   #22
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Quote:
Originally Posted by astrid View Post
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!
hel is offline  
Old 02.11.2006, 07:14   #23
Kenjiro
Архивный участник
 
Join Date: Apr 2006
Posts: 120
Default

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.
Kenjiro is offline  
Old 02.11.2006, 08:03   #24
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Quote:
Originally Posted by Kenjiro View Post
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:
hel is offline  
Old 02.11.2006, 08:56   #25
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

Ready to test new build
Domzelan 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:02.