nixer Posted November 12, 2023 Report Share Posted November 12, 2023 Если уже было, то сорян, не нашел похожей темы 😃 Скрипт покупает предметы путем отправки заготовленного пакета. К сожалению на бесплатном адрике не заработал, видимо не реализована функция SendToServer, или называется по другому? Скрипт использует стандартный PacketUnit из документации адрика - https://adrenalinebot.com/ru/api/example/packetunit-ready-unit-working-packets-adrenaline-bot Плюсы: работает в режиме боя EN: The script buys items by sending a prepared Network packet. Unfortunately on cracked adrenaline didn't work, apparently SendToServer function is not implemented, or is it called differently? The script uses the standard PacketUnit from the adrenaline documentation. Pros: Works in combat mode. BuyItemsExample.txt Uses PacketUnit, SysUtils; procedure BuyFromConsumbales(Offset: integer; Number: cardinal); const MinOffset = 1; MaxOffset = 48; var Pck: TNetworkPacket; begin Engine.Say('.buy'); // to open required multissell dialog, from my tests it's required only after login Engine.Delay(1000); // increase this if you have very slow internet, // and propably add additional .say statement // You can buy only items in specific offset ranges if not (Offset in [MinOffset..MaxOffset]) then begin Engine.Msg('BuyFromConsumbales', format('%d offset is not in allowed range: %d - %d', [Offset, MinOffset, MaxOffset]), $000080); Exit; end; Pck:= TNetworkPacket.Create; // Packet Structure was reverse-ingenered, so be carefull! // Here no any logic behind this packets structure Pck.WriteC($A7); Pck.WriteH($E0F7); Pck.WriteH($05F5); // Offset & number of items Pck.WriteD(Offset); Pck.WriteQ(Number); Pck.WriteD(0); // was required to send same packet size // Buy items from server Pck.SendToServer; Pck.Free; end; begin // Invalid items examples BuyFromConsumbales(0, 1); BuyFromConsumbales(110, 1); // I reccomend to parametrize this, to save offsets, get offest from some array of records // offset = ItemsToBuy['SummonCry'].offset, something like this // AND combine with this script: https://adrenalinebot.com/ru/api/example/counting-the-number-of-items-in-the-inventory // but this is just simplest example BuyFromConsumbales(1, 1); // 1 Mana potion BuyFromConsumbales(2, 1); // 1 Summon cry BuyFromConsumbales(11, 1); // 1 Elixir of CP (S-grade) BuyFromConsumbales(15, 2); // 2 SOE BuyFromConsumbales(15, 2); // 2 Ressurecition scroll BuyFromConsumbales(29, 20); // 20 Healing potions BuyFromConsumbales(30, 1); // 1 Spirit Ore BuyFromConsumbales(40, 1); // 1 Scroll of recovery S-Grade end. PacketUnit.txt - It's important to use this filename unit PacketUnit; interface type TNetworkPacket = class public Current: Integer; procedure WriteQ(value: Int64); procedure WriteD(value: Cardinal); procedure WriteH(value: Word); procedure WriteC(value: Byte); procedure WriteS(value: String); function ReadQ(): Int64; function ReadD(): Cardinal; function ReadH(): Word; function ReadC(): Byte; function ReadS(): String; function ToHex(): String; function SendToServer(): Boolean; function SendToClient(): Boolean; constructor Create(pData: PChar; size: Word); overload; constructor Create(); overload; private data: Array[0..10240] of Byte; end; implementation uses SysUtils; constructor TNetworkPacket.Create(pData: PChar; size: Word); begin inherited Create; Move(pData^, PChar(@data[0])^, size); end; constructor TNetworkPacket.Create(); begin inherited Create; end; function TNetworkPacket.ReadQ; begin Result:= PInt64(@data[Current])^; Current:= Current + SizeOf(Int64); end; function TNetworkPacket.ReadD; begin Result:= PCardinal(@data[Current])^; Current:= Current + SizeOf(Cardinal); end; function TNetworkPacket.ReadH; begin Result:= PWord(@data[Current])^; Current:= Current + SizeOf(Word); end; function TNetworkPacket.ReadC; begin Result:= PByte(@data[Current])^; Current:= Current + SizeOf(Byte); end; function TNetworkPacket.ReadS; begin Result:= String(PChar(@data[Current])); Current:= Current + (Length(Result) + 1) * SizeOf(Char); end; procedure TNetworkPacket.WriteQ; begin (PInt64(@data[Current])^):= value; Current:= Current + SizeOf(Int64); end; procedure TNetworkPacket.WriteD; begin (PCardinal(@data[Current])^):= value; Current:= Current + SizeOf(Cardinal); end; procedure TNetworkPacket.WriteH; begin (PWord(@data[Current])^):= value; Current:= Current + SizeOf(Word); end; procedure TNetworkPacket.WriteC; begin (PByte(@data[Current])^):= value; Current:= Current + SizeOf(Byte); end; procedure TNetworkPacket.WriteS; begin Move(value^, PChar(@data[Current])^, (Length(value) + 1) * SizeOf(Char)); Current:= Current + (Length(value) + 1) * SizeOf(Char); end; function TNetworkPacket.ToHex; var i: Cardinal; begin Result:= ''; for i:= 0 to Current-1 do Result:= Result + IntToHex(data[i], 2); end; function TNetworkPacket.SendToServer; begin Engine.SendToServer(Self.ToHex); end; function TNetworkPacket.SendToClient; begin Engine.SendToClient(Self.ToHex); end; end. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now