Переработано и добавлено от себя возможность видеть ники персонажей, а не просто их id.
Для работы скрипта вам необходимо предварительно создать пустой текстовый файл CombatLog.txt в папке /custom.
PHP код:
// Скрипт CombatLoger v1.0 (c) broveymimo 2010? оригинальный скрипт(c) BlowUminD
// Запуск /CombatLog START 0 <- Дополнительная информация
// Останов /CombatLog STOP
var start, stop, name, Charname, bodypart, CharID, dmgmsg, atkmsg1, atkmsg2, atkmsg3, FNameStat, CharIDstr : string;
PID, le, startl, stopl, namel, i, i1 : integer;
flag, flag2 : boolean;
MoveToSL, SLcharID : TStringList;
Procedure MsgInfo(msg : string);
begin
gSys.EnSendC(FormatPck('%hcdacha',***91;$0A02,05,0,'***91;!***93;'+FStr(16),Length(msg) + 2,$203A,msg+#0***93;));
MoveToSL.Add(msg);
end;
Procedure GetCombatMsg(cid : string;id1 : string;id2 : string;bp : integer;dmg :integer;tp : integer);
begin
case (bp) of
$00: bodypart:='торс';
$01: bodypart:='ноги';
$02: bodypart:='руки';
$03: bodypart:='ступни';
$04: bodypart:='голову';
else bodypart:='другое место';
end;
case (tp) of
$00: begin
atkmsg1:=' ударa ';
atkmsg2:=' удар ';
atkmsg3:=' урона ';
end;
$01: begin
atkmsg1:=' скилла ';
atkmsg2:=' скилл ';
atkmsg3:=' урона скиллом ';
end;
$02: begin
atkmsg1:=' магического каста ';
atkmsg2:=' магический каст ';
atkmsg3:=' магического урона ';
end;
$03: begin
atkmsg1:=' выстрела ';
atkmsg2:=' выстрел ';
atkmsg3:=' урона выстрелом ';
end;
end;
if StrCmp(id1,cid) then
begin
case (dmg) of
$0000: dmgmsg:=GetNamefromSL(id2)+' с легкостью увернулся от вашего'+atkmsg1+'в '+bodypart;
$FFFE: dmgmsg:=GetNamefromSL(id2)+' заблокировал ваш'+atkmsg2+'в '+bodypart;
$FFFF: dmgmsg:=GetNamefromSL(id2)+' увернулся от вашего'+atkmsg1+'в '+bodypart;
else dmgmsg:='Вы нанесли '+IntToStr(dmg)+atkmsg3+'в '+bodypart+' '+GetNamefromSL(id2);
end;
MsgInfo(dmgmsg);
end;
if StrCmp(id2,cid) then
begin
case (dmg) of
$0000: dmgmsg:='Вы с легкостью увернулись от'+atkmsg1+' '+GetNamefromSL(id1)+' в '+bodypart;
$FFFE: dmgmsg:='Вы заблокировали'+atkmsg2+' '+GetNamefromSL(id1)+' в '+bodypart;
$FFFF: dmgmsg:='Вы увернулись от'+atkmsg1+' '+GetNamefromSL(id1)+' в '+bodypart;
else dmgmsg:='Вам нанесли '+IntToStr(dmg)+atkmsg3+' '+GetNamefromSL(id1)+'в '+bodypart;
end;
MsgInfo(dmgmsg);
end;
if flag2 then
begin
if not (StrCmp(id1,cid)) and not (StrCmp(id2,cid)) then
begin
case (dmg) of
$0000: dmgmsg:=GetNamefromSL(id2)+' с легкостью увернулся от'+atkmsg1+GetNamefromSL(id1)+' в '+bodypart;
$FFFE: dmgmsg:=GetNamefromSL(id2)+' заблокировал'+atkmsg2+GetNamefromSL(id1)+' в '+bodypart;
$FFFF: dmgmsg:=GetNamefromSL(id2)+' увернулся от'+atkmsg1+GetNamefromSL(id1)+' в '+bodypart;
else dmgmsg:=GetNamefromSL(id1)+' нанес '+IntToStr(dmg)+atkmsg3+'в '+bodypart+' '+GetNamefromSL(id2);
end;
MsgInfo(dmgmsg);
end;
end;
end;
Procedure OnCreate;
begin
MoveToSL:=TStringList.create;
FNameStat:= _gCustomDir+'CombatLog.txt';
SLcharID:=TStringList.create;
le:=23;
start:='START';
startl:=length(start);
stop:='STOP';
stopl:=length(stop);
name:='CombatLog';
namel:=length(name);
flag:=false;
flag2:=false;
end;
Procedure OnDestroy;
begin
MoveToSL.free;
SLcharID.free;
end;
function GetNamefromSL(TargetID : string) : string;
begin
For i:= 0 to SLcharID.Count-1 do
begin
if StrCmp(copy(SLcharID***91;i***93;,1,4),TargetID) then Break
end;
if not (StrCmp(copy(SLcharID***91;i***93;,1,4),TargetID)) then result:='моб' else
begin
i1:= 0;
While GInt(SLcharID***91;i***93;,5+i1,1) <> 0 do Inc(i1);
result:= copy(SLcharID***91;i***93;,5,i1);
end;
end;
BEGIN
if length(_gBuff) < 4 then exit;
PID := GInt(_gBuff,3,2);
if (_gFromServ) then
case PID of
$0F01: CharID:=copy(_gBuff,7,4);
$1F03: begin
CharIDstr:= copy(_gBuff,7,4);
Charname:= copy(_gBuff,46,17);
SLcharID.Add(CharIDstr+Charname);
end;
end;
if not (_gFromServ) then
case PID of
$2903: if FileExists(FNameStat) then
begin
MoveToSL.SaveToFile(FNameStat);
MsgInfo('Успешно сохранено.');
end;
$0302: begin
if strcmp(copy(_gBuff,5,namel),name,) then
begin
if strcmp(copy(_gBuff,le,startl),start) then
begin
flag:=true;
MsgInfo('CombatInformer запущен');
end;
if strcmp(copy(_gBuff,le,stopl),stop) then
begin
flag:=false;
flag2:=false;
MsgInfo('CombatInformer остановлен');
end;
if strcmp(copy(_gBuff,(le+startl+1),1),'1') then
begin
flag2:=true;
MsgInfo('Дополнительная информация отображается');
end;
if strcmp(copy(_gBuff,(le+startl+1),1),'0') then
begin
flag2:=false;
MsgInfo('Дополнительная информация отключена');
end;
gBlockPacket;
end;
end;
end;
if _gFromServ and flag then
case PID of
$0705: begin
GetCombatMsg(CharID,copy(_gBuff,6,4),copy(_gBuff,17,4),GInt(_gBuff,10,1),GInt(_gBuff,21,2),0);
end;
$0805: begin
GetCombatMsg(CharID,copy(_gBuff,6,4),copy(_gBuff,25,4),GInt(_gBuff,14,1),GInt(_gBuff,29,2),1);
end;
$0905: begin
GetCombatMsg(CharID,copy(_gBuff,6,4),copy(_gBuff,21,4),GInt(_gBuff,16,1),GInt(_gBuff,25,2),2);
end;
$7A05: begin
GetCombatMsg(CharID,copy(_gBuff,6,4),copy(_gBuff,20,4),$05,GInt(_gBuff,24,2),3);
end;
end;
END.