Jump to content

L2 Adrenaline Scripts.


Recommended Posts

1 minute ago, adr.bot said:

hmm i never see dialog like that, seems there is no bypass strings xd

 

Any idea for a workaround? Ive been hours already thinking of it. Maybe something to identify dialog position and inject click/selection to it?

Link to comment
Share on other sites

3 minutes ago, nhaka said:

 

Any idea for a workaround? Ive been hours already thinking of it. Maybe something to identify dialog position and inject click/selection to it?

i have no ideas for that

Link to comment
Share on other sites

On 1/8/2018 at 7:07 AM, Vinter said:

Yeah np if you have any problems hit me up on PMs. I tested this on protocol 152 so it might not work on your version depending if the packets have changed or not. I also didn't make a buy store script cause I usually find myself doing it manually, but it can be easily modified to add buy store aswell.

Again make sure you have the items in your inventory and that you have the amount or you're gonna send a bad packet to the server which might do nothing or straight up ban you right there and then.  

Also because the packet uses objectId instead of itemId, if you have 2 items that are not stackable (ex a +16 B grade bow and a +0 B grade bow) the script will pick the first one it finds in your inventory, so be careful about that too. I know pretty shoddy code but that's how I roll.

 

Tnks to vinter a little improve for gracia final (protocol 87) all credits to him:

Quote

 


uses SysUtils;
function BetterInt32ToHex(input: Integer): string;
var
  i, j: integer;
  p: string;
  bbI : array[1.. sizeof(integer)] of byte;
begin
  p := '';
  Move(input, bbI[1], SizeOf(Integer));
  for j := Low(bbI) to High(bbI) do
  begin
    p := p + IntToHex(bbI[j],2) + ' ';
  end;
  Result := p;
end;

function StringToHex(S: String): string;
var I: Integer;
begin
  Result:= '';
  for I := 1 to length (S) do
    Result:= Result+IntToHex(ord(S),2) + ' 00 ';
end;
//97=SetPrivateStoreMsgSell:s(StoreMsg)
//D04A00=SetPrivateStoreWholeMsg:h(subID)s(Msg)
//31=SetPrivateStoreListSell:d(IsPackageSale)d(ListSize:Loop.01.0003)d(ObjectID)q(Count)q(Price)
function OpenPrivateStoreSell(itemList: array of Integer; msg: string; packageSale: Boolean): boolean;
var
  packet: string;
  i, j, t: Integer;
  l: Extended;
  item: TL2Item;
begin
  Engine.SendToServer('56 3D 00 00 00 00 00 00 00 00');
  packet := '97 ';    // Message: 97 for (vendor) or D04A00 for (packageSale)
  packet := packet + StringToHex(msg) + '00 00';
  Print(packet);
  Engine.SendToServer(packet);
  packet := '31 '; // Packet ID
  if(packageSale) then packet := packet + BetterInt32ToHex(1) else packet := packet + BetterInt32ToHex(0); // Package Sale
  l := Length(itemList);
  packet := packet + BetterInt32ToHex(Length(itemList) div 3);
  for i := 0 to Length(itemList) - 1 do
  begin
    j := i + 1;
    t := i + 2;
    if(Inventory.User.ByID(itemList, item)) then
    begin
      packet := packet + BetterInt32ToHex(item.OID);
      packet := packet + BetterInt32ToHex(itemList[j]) + '00 00 00 00 '; // Max 2.1b
      packet := packet + BetterInt32ToHex(itemList[t]) + '00 00 00 00 '; // Max 2.1b
    end;
    i := i +2;
  end;
  Print(packet);
  Engine.SendToServer(packet);
end;

begin
OpenPrivateStoreSell([1061, 50, 5000], 'Message', false); //OpenPrivateStoreSell(array of Integers (itemId, amount, price), string message, boolean packagesale);  
end.

 

 

Edited by catamen
Link to comment
Share on other sites

On 7/29/2016 at 3:55 PM, adr.bot said:

well, here is example, i found it on internet, just saying if server got smartguard it will not work


uses SysUtils;
 
function ShellExecuteW(hwnd: integer; lpOperation, lpFile, lpParameters, lpDirectory: PChar;  nShowCmd: integer): integer; stdcall;
  external 'Shell32.dll';
 
function keybd_event(bVk, bScan: byte; dwFlags, dwExtraInfo: integer): integer; stdcall;
  external 'user32.dll';
 
procedure disconnectMonitor;
const
  login = 'lgn';
  password = 'pwd';
  gamePath = 'F:\l2gf\system\l2.exe';
begin
  while Delay(3000) do begin  
    if Engine.Status = lsOffline then begin
      print('dc');
      Engine.FaceControl(0, false);
      Delay(1000);
      Engine.GameClose;
      Delay(1000);
      ShellExecuteW(0, 'open', PChar(gamePath), nil, nil, 0);
      Delay(10000);
      enterText(login);
      Engine.UseKey('Tab');
      Delay(300);
      enterText(password);
      Delay(300);
      Engine.UseKey('Enter');
      Delay(2000);
      Engine.UseKey('Enter');
      Delay(2000);
      Engine.UseKey('Enter');
      Delay(2000);
      Engine.UseKey('Enter');
      Delay(10000);
      Engine.FaceControl(0, true);
    end;
  end;
end;
 
procedure enterText(const text: string);
var
  i: cardinal;
  upperCase: boolean;
begin
  for i:= 1 to length(text) do begin
    if isDigit(text[i]) then
      Engine.UseKey(text[i])
    else begin
      upperCase:= text[i] = UpCase(text[i]);
      if upperCase then begin
          keybd_event(20, 0, 1, 0);
          keybd_event(20, 0, 2, 0);
          Engine.UseKey(text[i]);
          delay(10);
          keybd_event(20, 0, 1, 0);
          keybd_event(20, 0, 2, 0);
      end else
        Engine.UseKey(text[i]);
    end;
    Delay(50);
  end;
end;
 
function isDigit(ch: char): boolean;
const
  digits = '013456789';
var
  i: cardinal;
begin
  result:= false;
  for i:= 0 to length(digits) do
    if digits[i] = ch then begin
      result:= true;
      exit;
    end;
end;
                        
begin
  Script.NewThread(@disconnectMonitor);
end. 

 

why this script is not working anymore ? after l2 is opened he doesn't write account and password, only pressing TAB button.

Link to comment
Share on other sites

8 hours ago, kiduu93 said:

 

why this script is not working anymore ? after l2 is opened he doesn't write account and password, only pressing TAB button.

function keybd_event(bVk, bScan: byte; dwFlags, dwExtraInfo: integer): integer; stdcall;
  external 'user32.dll';

this is blocked by smart guard, try use

engine.entertext('text');

 

Link to comment
Share on other sites

Hello,

 

Does anyone know how to detect if char have any skill to learn (by checking the skill list from NPC and comparing to a list of skills ID to be learnt or something like that) and then proceed to learn skills if SP>required for new skill?

 

I know its possible, but I cant figure out how to identify the new skills from the learn skill list, also not if the SP ammount needed is available (so it doesnt keep on loop if not enough SP).

 

Atm I'm using something like this:

 

if user.inrange(143966, 24193, -2120, 150) and (user.classID = 34) and (user.level>=52) then                                
              begin                                
              if (SkillList.ByID(144, skill)) and (skill.level<15) then //Weapon                                
                begin                                
                  Print('Getting skills from 52');                                                          
                  Engine.LearnSkill (223); //Sting        

 

It works, but I need to write every single skill from every single level for every single class. Plus it does not "confirm" if all skills learned (for instance: SP lower than required or some lag that jumped one skill).

 

Thanks in advance.

Edited by nhaka
Link to comment
Share on other sites

                     var item:tl2item;
            begin
while true do begin
delay(1000);
if not inventory.user.byid(49684, item) or (item.count<10000) then begin
Engine.SetTarget(35453);
Engine.DlgOpen;
Engine.DlgSel (3);
Delay(1000);
Engine.DlgSel(4);
Delay(1000);
Engine.NPCExchange(49684,1);
Print('OK');
Delay(36000000);
end;
end;
 end.

 

 

not work  ...... NPCExchange    Why? What wrong? Help mp please

 

Link to comment
Share on other sites

2 hours ago, gorntana said:

                     var item:tl2item;
            begin
while true do begin
delay(1000);
if not inventory.user.byid(49684, item) or (item.count<10000) then begin
Engine.SetTarget(35453);
Engine.DlgOpen;
Engine.DlgSel (3);
Delay(1000);
Engine.DlgSel(4);
Delay(1000);
Engine.NPCExchange(49684,1);
Print('OK');
Delay(36000000);
end;
end;
 end.

 

 

not work  ...... NPCExchange    Why? What wrong? Help mp please

 

Hi,

 

1) Added some delay between actions so it will be sure to open and select each option. If they are too much, you can lower them later on to make it faster. Code below;

 


var
item:tl2item;

begin
while true do begin
delay(1000);
if not inventory.user.byid(49684, item) or (item.count<10000) then begin
Engine.SetTarget(35453);
delay(1000);
Engine.DlgOpen;
delay(1000);
Engine.DlgSel (3);
Delay(1000);
Engine.DlgSel(4);
Delay(1000);
Engine.NPCExchange(49684,1);
Print('OK');
Delay(36000000);
end;
end;
end.

 

2) As I see, this command (Engine.NPCExchange) is for exchange windows like the ones for newbie guide for adventurer weapons (does not work for grocer sell/buy windows). If you are buying from buy windows like grocer NPC, change the command line for this: Engine.NPCTrade(false,[49684, 1]);

 

3) Double check if this ID (49684) is correct;

 

4) Last but not least, this script wont work for interlude chronicles (buy/sell from NPC does not work). I've played on GF servers that those commands dont work too.

Edited by nhaka
Link to comment
Share on other sites

  • 2 weeks later...

 

 

c'mon guys   help me the poor guy to improve his game...i think is not hard for all you the developers to share some info with us...60% of the script is visible on 0:30 in this video...Thanx for your help

Edited by takoulas
Link to comment
Share on other sites

5 hours ago, takoulas said:

 

 

c'mon guys   help me the poor guy to improve his game...i think is not hard for all you the developers to share some info with us...60% of the script is visible on 0:30 in this video...Thanx for your help

http://www.delphibasics.co.uk/RTL.asp?Name=copy copy that value from dialog and use how u like

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...