Procedure OnDeCode;
var le : integer;
s : string;
begin
if _dFromServ and (_gAbsNumPkt = 2) then begin
if (gSys.TrafType = 2) then begin
le := length(_dBuff);
if (le in [$15,$18,$19,$1A,$1C]) then begin
s := copy(_dBuff,5,8)+ HStr('C8279301A16C3197');
gSys.Kci := s; gSys.Kco := s; gSys.Ksi := s; gSys.Kso := s;
gSys.tKeyType := 3;
if le = $19 then gSys.tKeyType := 4;
gSys.tPDecode := 2;
writelogln(format('KeyInit corrected. KT: %d',[gSys.tKeyType]));
end;
end;
end;
end;
begin
end.
Скопируйте код в блокнот и сохраните как Corrector-1.fsc или скачайте готовый файл
>> demo_la2endecGS4m2.fsc (Скрипт для декодирования трафика LineAgeII)
procedure _DecGS(var bf : string;var ke : string; tk : integer);
var i,j,b,i1,sz,sk : integer;
begin
sz := length(bf);
sk := length(ke);
if sk = 0 then exit;
b := 0; j := 1;
for i := 3 to sz do begin
i1 := ord(bf[i]);
bf[i] := chr(i1 xor ord(ke[j]) xor b);
b := i1;
Inc(j,1);
if j > sk then j := 1;
end;
case tk of
1: PInt(ke,GInt(ke,1,4)+sz-2,1,4);
2: PInt(ke,GInt(ke,1,8)+sz-2,1,8);
3: PInt(ke,GInt(ke,9,8)+sz-2,9,8);
4: PInt(ke,GInt(ke,9,8)+sz-2,9,8);
end;
end;
procedure _EncGS(var bf : string;var ke : string; tk : integer);
var i,j,b,i1,sz,sk : integer;
begin
sz := length(bf);
sk := length(ke);
if sk = 0 then exit;
i1 := 0; j := 1;
for i := 3 to sz do begin
bf[i] := chr(ord(bf[i]) xor ord(ke[j]) xor i1);
i1 := ord(bf[i]);
Inc(j,1);
if j > sk then j := 1;
end;
case tk of
1: PInt(ke,GInt(ke,1,4)+sz-2,1,4);
2: PInt(ke,GInt(ke,1,8)+sz-2,1,8);
3: PInt(ke,GInt(ke,9,8)+sz-2,9,8);
4: PInt(ke,GInt(ke,9,8)+sz-2,9,8);
end;
end;
procedure _pseudo_srand(seed : integer);
begin
_seed := seed;
end;
function _pseudo_rand: integer;
var
a : integer;
begin
a := (Int64(_seed) * $343fd + $269EC3) and $FFFFFFFF;
_seed := a;
result := (_seed shr $10) and $7FFF;
end;
procedure _init_tables(seed: integer);
var
i : integer;
x : byte;
rand_pos : integer;
cur_pos : integer;
begin
_1_byte_table := '';
_2_byte_table := '';
for i := 0 to $D0 do begin
_1_byte_table := _1_byte_table + chr(i);
end;
for i := 0 to $4D do begin
_2_byte_table := _2_byte_table + chr(i) + #$0;
end;
_pseudo_srand(seed);
for i := 2 to $D1 do begin
rand_pos := (_pseudo_rand mod i) + 1;
x := GInt(_1_byte_table, rand_pos, 1);
PInt(_1_byte_table, GInt(_1_byte_table, i, 1), rand_pos, 1);
PInt(_1_byte_table, x, i, 1);
end;
cur_pos := 3;
for i := 2 to $4E do begin
rand_pos := _pseudo_rand mod i;
x := GInt(_2_byte_table, rand_pos * 2 + 1 , 2);
PInt(_2_byte_table, GInt(_2_byte_table, cur_pos, 2), rand_pos * 2 + 1, 2);
PInt(_2_byte_table, x, cur_pos, 2);
cur_pos := cur_pos + 2;
end;
cur_pos := Pos(#$12, _1_byte_table);
x := GInt(_1_byte_table, $13, 1);
PInt(_1_byte_table, $12, $13, 1);
PInt(_1_byte_table, x, cur_pos, 1);
cur_pos := Pos(#$B1, _1_byte_table);
x := GInt(_1_byte_table, $B2, 1);
PInt(_1_byte_table, $B1, $B2, 1);
PInt(_1_byte_table, x, cur_pos, 1);
end;
procedure _decode_ID(var buff:string);
var
p: integer;
begin
PInt(buff, GInt(_1_byte_table, GInt(buff, 3, 1) + 1, 1) , 3, 1);
if GInt(buff, 3, 1) = $D0 then begin
PInt(buff, GInt(_2_byte_table, GInt(buff, 4, 1) * 2 + 1, 1) , 4, 1);
end;
end;
procedure _encode_ID(var buff:string);
var
p: integer;
begin
if GInt(buff, 3, 1) = $D0 then begin
p:= pos(Chr(GInt(buff, 4, 1)), _2_byte_table);
PInt(buff, ((p + 1) shr 1) - 1, 4, 1);
end;
p := pos(Chr(GInt(buff, 3, 1)), _1_byte_table);
PInt(buff, p-1, 3, 1);
end;
Procedure Trafic_Detector;
var _s : string;
begin
le := length(_dBuff);
if (gSys.TrafType = 0) and (_gAbsNumPkt = 1) then begin
case le of
$0B,$9B,$AB,$BA: begin
gSys.TrafType := 2;
gSys.isLS := 1;
if le = $0B then gSys.tKeyType := 1 else gSys.tKeyType := 2;
end;
$107: begin
gSys.TrafType := 2;
gSys.isGS := 1;
end;
$07: begin
gSys.TrafType := 2;
gSys.isGS := 2;
end;
else if le >= $107 then begin
if pos(HStr('05 52 05 54 07 51 51 55 07 02 53 53 00 52 05 52'),_dBuff) <> 0 then begin
gSys.TrafType := 2;
gSys.isGS := 2;
end;
if StrCmp(copy(_dBuff, 3, 5), HStr('0E 3C 03 00 00')) then begin
writelogln('CT1 traffic detected');
gSys.TrafType := 2;
gSys.isGS := 3;
end;
end;
end;
if gSys.TrafType = 2 then gSys.SetIDposlen(3,1);
if gSys.isGS > 0 then gSys.Protocol := gInt(_dBuff,4,4);
if gSys.Protocol >= 828 then gSys.isGS := 3;
end;
if (_gAbsNumPkt = 2) then
if (gSys.TrafType = 2) and (gSys.isGS > 0) and _dFromServ then begin
if (le = 12) then gSys.tKeyType := 1;
if (le = 16) then gSys.tKeyType := 2;
if (le = $1A) then gSys.tKeyType := 3;
if (le = $1C) then gSys.tKeyType := 3;
if (le = $15) then gSys.tKeyType := 3;
if (le = $19) then gSys.tKeyType := 4;
if gSys.tKeyType > 0 then begin
s := copy(_dBuff,5,16);
if gSys.tKeyType < 3 then s := copy(s,1,4)+Hstr('A1 6C 54 87');
if gSys.tKeyType = 3 then s := copy(s,1,8)+Hstr('C8 27 93 01 A1 6C 31 97');
if gSys.tKeyType = 4 then begin
s := copy(s,1,8)+Hstr('C8 27 93 01 A1 6C 31 97');
_id_mix := true;
_init_tables(GInt(_dBuff, $16, 4));
writelogln('kamael+ trafic detected');
end;
Kci := s; Kco := s; Ksi := s; Kso := s;
scode := true;
writelogln('key:');writeloghexb(s);
end else writelogln('неопознанный ключевой пакет GS LA2 протокола')
end;
end;
Procedure OnDeCode;
begin
if _gAbsNumPkt < 6 then Trafic_Detector;
if scode and (_gAbsNumPkt > 2) then begin
if _dFromServ then
_DecGS(_dBuff,Ksi,gSys.tKeyType)
else begin
_DecGS(_dBuff,Kci,gSys.tKeyType);
writelogHexB(_dBuff);
if _id_mix then _decode_id(_dBuff);
end;
_dOutBuff := _dBuff;
end;
end;
Procedure OnEnCode;
begin
if scode and (_gAbsNumPkt > 2) then begin
// кодируем пакет, ручная реализация стандартного алгоритма
if _dFromServ then
_EncGS(_dBuff,Kco,gSys.tKeyType)
else begin
if _id_mix then _encode_id(_dBuff);
_EncGS(_dBuff,Kso,gSys.tKeyType);
end;
_dOutBuff := _dBuff;
end;
end;
procedure SendMsg(msg : string);
begin
if (gSys.isGS > 0) and (gSys.TrafType = 2) then // проверка на трафик LA2 GS
gSys.EnSendC(FormatPck('%cddss',[#$4A,0,10,#0,msg+#0]));
end;
BEGIN
if ID = $0B then begin
ScanPck5(_gBuff, 4, 's-99-99-04d' ,CharName, temp_seed, null, null, null);
writelogln(format('reseting id tables on CharSelected; Seed = %x',[temp_seed]));
_init_tables(temp_seed);
end;
END.
Скопируйте код в блокнот и сохраните как demo_la2endecGS4m2.fsc или скачайте готовый файл
Fix-Скрипты для WPF PPC:
>> FixError.sc: (Если возникает ошибка PacketError)
Скрытый текст требуется (5 сообщение(ий), сейчас у вас 10):
BEGIN
if (_gbuff=#$03+#0+#$F9) then gBlockPacket;
If (_gBuff=#$02+#0) then gBlockPacket;
if (length(_gbuff) <> Gint(_gbuff,1,2)) and Gint(_gBuff,1,2)<> 2 then _gOutBuff:=Hpck(BufToHex(Copy(_gBuff,3,length(_gbu ff)-2)));
if (length(_gbuff) <> Gint(_gbuff,1,2)) and (Gint(_gBuff,1,2) = 2) then _gOutBuff:=Copy(_gBuff,3,length(_gbuff)-2);
end;
Скопируйте код в блокнот и сохраните как FixError.sc или скачайте готовый файл
>> FixMove.fsc: (Если бот вылетает при попытке к движению)
Скрытый текст требуется (5 сообщение(ий), сейчас у вас 10):
Код:
begin
if (length(_gBuff)<3) or (not (gsys.isgs>0)) then exit;
if (not _gFromServ) and strcmp(_gBuff[3],#$0F) then
if (length(_gBuff)<>31) then
_gOutBuff:=hstr('1F 00')+copy(_gBuff,3,25)+hstr('01 00 00 00');
end.
Скопируйте код в блокнот и сохраните как FixMove.fsc или скачайте готовый файл
>> FixDialogs.fsc: (Если не открываются продолжения диалогов с НПЦ)
Скрытый текст требуется (20 сообщение(ий), сейчас у вас 10):
У вас нет прав чтобы видеть скрытый текст, содержащейся здесь.
>> FixParty.fsc: (Если некорректно отображаются параметры HP/MP/CP у сопартийцев)
Не все скрипты нужны для каждого Камаэль сервера! Прежде чем скачивать файлы, убедитесь, что они вам нужны!
>> Мануал по подключению:
1) Допустим вы нашли ИП, порт, версию протокола своего сервера. Как это делать ищите на форуме. (Стандартно Port=2106 Protocol=828)
Создаем сет.ини Вот пример сет.ини:
[DEFAULT]
CountryList=Groza.ru;
DefaultCountry=0
DefaultServer=0
DefaultCharacter=0
DefaultAccount=allcheats
DefaultPassWord=allcheat s
[Groza.ru]
LoginServerIP=83.167.24.205
LoginServerPort=2106
Proto colVersion=828
ServerList=[1]Bartz;
2) Запускаем WSS (Он должен лежать в паке с ботом вместе с файлом patcher.ini). Ставим галочку "Патчить автоматически", из списка серверов выбираем нужный (IP и версия протокола заполнятся автоматически из файла Set.ini бота). Если у вас в папке с ботом и с WSS нет файла patcher.ini, то создаем его и вписываем как показано в ПРИЛОЖЕНИИ.
3) Запускаем ВПФ и открываем в нем П-Ц панель. В открывшемся окне в выпадающей менюшке ищем свой сервер (который прописан в сет.ини). Как выбрали, жмем кнопку "Добавить". Если список серверов пустой, то жмем "Добавить" и редактируем запись полностью вручную. Сервер добавиться в поле под менюшкой. Выделяем строку со своим сервером. Затем кликаем по полю для скриптов (состоит из 3х строчек). Затем жмем кнопочку "[...] - файл скрипта" и выбираем нужный скрипт. 1-ым скриптом должен быть CODEC-скрипт, если трафик правильно не декодируется силами самого WPF. Если представленные CODEC-скрипты не помогли, то на вашем сервере стоит антибот или просто кодирование трафика идет нестандартно. Все, впф можно свернуть в трей (перед этим проверив, что в нем запущен прокси, например 127.0.0.1:1777)
4) Возвращаемся в окно бота. Вводим свои логин и пароль. Затем жмем Setup->Option Вводим в поля IP и Port ип и порт прокси впф (стандартно 127.0.0.1 1777). Поля ид и пароль оставляем пусыми. Жмем кнопку "add". В выпадающих менюшках выше выбираем чтото типо: 127.0.0.1:1777:: и ставим рядом 2 галочки.
Все! Закрываем окошко и жмем логин. Видим чтото типо:
21:40:31 »¶У*К№УГРРХЯЎЈ
21:40:31 Link LoginServer Succeed.
21:40:35 Login LoginServer Success.
21:40:35 服务器[01]当前 2312;线率:2.50%,能否登 ;陆:能
21:40:37 Link GameServer Succeed.
21:40:42 ->Enter Char[1].
21:40:46 Welcome to the World of Lineage II.
21:40:46 $s2 Copyright 2004-2008
21:40:46 Seven Signs: This is the seal validation period. A new quest event period begins next Monday.
21:40:46 $s2 A brand new Lineage II event, Trick or Transmutation, will begin on February 20th! Players must find materials needed to craft one of six different Philosopher's Stones. Philosopher's Stones are used
21:40:46 $s2 Hearts will stop dropping on February 18. Sprockets the Cat will remain in the villages until February 27.
Здесь присутствуют: 1 (пользователей: 0, гостей: 1)