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[i]),2) + ' 00 ';
end;
function OpenPrivateStoreSell(itemList: array of Integer; msg: string; packageSale: Boolean): boolean;
var
packet: string;
i, j, t: Integer;
l: Extended;
item: TL2Item;
begin
packet := '97 ';
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[i], 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([5591, 50, 5000, 5592, 50, 10000, 7575, 1, 50000000], 'message', true);
end.
Kinda old post I'm replying to but it might help someone else. Engine.OpenPrivateStore doesn't seem to work so I wrote this real quick cause I needed to use that function.
OpenPrivateStoreSell(array of Integers (itemId, amount, price), string message, boolean packagesale);
Price and amount are 32 bit, didn't bother making a 64 bit version of the BetterIntToHex function, which I'm so glad I wrote because it returns the proper formatting that Lineage 2 uses for it's packets.
Also there aren't any checks like if you actually have the item in your inventory or the amount you are selling or if the adena you gain will go over the adena max (2.147b bit in interlude, 99b in gracia through h5, 999b in classic) so make sure you call the function correctly. If I fell like it I will add those checks and maybe some configuration ini or something but I don't think many people will need this script at all.