PDA

Просмотр полной версии : Юникод VS шифт вещей


supernewbie
11.07.2010, 14:37
Как всегда хочется все облегчить и поэтому человек бла-бла-бла, короче,
сразу к делу)
При написании скрипта на шифт вещей обнаружил, что фаст скрипт или юникод или там яхз кто против символа  и . Решил вживить их с помощью HStr'а. У  Hex 08 00 09 00, у  1B 00. Сломал весь мозг и пришел сюда :)

var
id:integer;
id2:string;
b2,b3:string;

procedure Init; //Вызывается при включении скрипта
begin

end;

procedure Free; //Вызывается при выключении скрипта
begin

end;

//основная часть скрипта
//вызывается при приходе каждого пакета если скрипт включен
begin
if fromClient and (pck[1]=#$19) then
begin
id:=ReadD(2);
pck:='';
b3:=HStr('1B 00 08 00 09 00');
b2:=HStr('1B 00');
buf:=HStr('49 08 00 09 00');
WriteS('Type=1 ID='+(vartostr(id))+' Color=0 Underline=0 Title='+b2);
buf[(length(buf) * 2 + 2 - 2)]:='';
buf[(length(buf) * 2 + 2 - 1)]:='';
WriteS('Name Item');
buf[(length(buf) * 2 + 2 - 2)]:='';
buf[(length(buf) * 2 + 2 - 1)]:='';
WriteS(b3);
WriteD(0);
SendToServer;
end;


end.

alexteam
11.07.2010, 14:58
var
text : string;
begin
id:=ReadD(2);

text := 'Type=1 ID='+inttostr(id)+' Color=0 Underline=0 Title='

buf := #$49; // [49] //id


writed($90008); //[49] [08 00 09 00
writes(text); //[49] [08 00 09 00+uText+00 00
writec($1B, length(buf)-1); //[49] [08 00 09 00+uText+1B 00
writes('ItemName'); //[49] [08 00 09 00+uText+1B 00+uItemName+00 00
writec($1B, length(buf)-1); //[49] [08 00 09 00+uText+1B 00+uItemName+1B 00
writed($90008); //[49] [08 00 09 00+uText+1B 00+uItemName+1B 00 + 08 00 09 00
writeh(0); //[49] [08 00 09 00+uText+1B 00+uItemName+1B 00 + 08 00 09 00 + 00 00] //text
writed(0); //[49] [08 00 09 00+uText+1B 00+uItemName+1B 00 + 08 00 09 00 + 00 00] [00 00 00 00] //type

supernewbie
11.07.2010, 15:07
упс, оказывается  это 1B 00 09 00

alexteam
11.07.2010, 15:09
готовый пакет покажи.

supernewbie
11.07.2010, 15:35
все пздц) пробелов понатыкали

готовый скрипт)
const
Name='1';

var
id,i,iditem:integer;
text : string;
ItemsName:TStringList;
itemsid:array [0..80] of integer;
itemsobjid:array [0..80] of integer;


procedure Init; //Вызывается при включении скрипта
begin
ItemsName:=TStringList.Create;
ItemsName.LoadFromFile('settings\itemsid.ini');
for i:=0 to 80 do
itemsobjid[i]:=0;
for i:=0 to 80 do
itemsid[i]:=0;
end;

procedure Free; //Вызывается при выключении скрипта
begin

end;

procedure InventoryCreate;
var
i,offset,CurrentInvRazmer : integer;

begin
offset:= 64;
CurrentInvRazmer:=ReadH(4);
for i:=0 to CurrentInvRazmer do
begin
itemsid[i]:=ReadD(i*offset+12);
itemsobjid[i]:=ReadD(i*offset+8);
end;

end;

//основная часть скрипта
//вызывается при приходе каждого пакета если скрипт включен
begin
if fromClient and (ConnectName=Name) and (pck[1]=#$19) then
begin
id:=ReadD(2);
for i:=0 to 80 do
if id=itemsobjid[i] then
begin
iditem:=itemsid[i];
end;


text := 'Type=1 ID='+inttostr(id)+' Color=0 Underline=0 Title=';

buf := #$49; // id


writed($90008); //[08] [00 09 00
writes(text); //[08] [00 09 00+uText+00 00
writec($1B, length(buf)-1); //[08] [00 09 00+uText+1B 00
writes(ItemsName.Values(vartostr(iditem))); //[08] [00 09 00+uText+1B 00+uItemName+00 00
writec($1B, length(buf)-1); //[08] [00 09 00+uText+1B 00+uItemName+1B 00
writed($90008); //[08] [00 09 00+uText+1B 00+uItemName+1B 00 + 08 00 09 00
writeh(0); //[08] [00 09 00+uText+1B 00+uItemName+1B 00 + 08 00 09 00 + 00 00] //text
writed(0); //[08] [00 09 00+uText+1B 00+uItemName+1B 00 + 08 00 09 00 + 00 00] [00 00 00 00] //type
SendToServerEx(Name);
pck:='';
end;

if fromServer and (ConnectName=Name) and (pck[1]=#$11) then InventoryCreate;


end.