Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Source - Delphi]Symply Monster Editor (MB)

NN - Nord & Noob
Loyal Member
Joined
Jul 15, 2004
Messages
1,207
Reaction score
689
Just another my unfinished OLD and Sh!ty source code xD

Code:
unit uMonsters;

interface

uses
 Classes, SysUtils, FMainFrm;

const
  max = 1000;

  procedure LoadMonstersTxt (s: TFileName);
  procedure LoadMonstersNames (s: TFileName);
  procedure LoadMapNames (s: TFileName);

var
MonsterList: Array [0..max - 1] of record
MobProperty: Array[0..2,0..27]of string;
end;

num: Word = 0;
MNames: Word = 0;
MapNames: Word = 0;

implementation
{==============================================================================


===============================================================================}
function CheckString (s: String):Boolean;
begin
Result := True;
 if (Length(S)  >0) then
  begin
Result := (Ord(s[1]) = $20) or (Ord(s[1]) = $2F) or (Ord(s[1]) = $45) or (s[1] = 'e') or (s[1] = 'E') or (s = '')  or (Ord(s[1]) = $09) or (Length(s) <=1)
  end;
end;
{==============================================================================


===============================================================================}
procedure LoadMonstersTxt (s: TFileName);
var
List, DelList: TStringList;
i: integer;
Check: String;
begin
  List := TStringList.Create;
  DelList := TStringList.Create;
  DelList.Delimiter := #9;
  DelList.QuoteChar := #34;
   try
     List.LoadFromFile(s);
       for i := 0 to List.Count -1 do
        begin
          Check := List[i];
          if not CheckString(Check) then
           begin
             DelList.DelimitedText := List[i];
             MonsterList[num].MobProperty[0,0]  := DelList[0];
             MonsterList[num].MobProperty[0,1]  := DelList[1];
             MonsterList[num].MobProperty[0,2]  := DelList[2];
             MonsterList[num].MobProperty[0,3]  := DelList[3];
             MonsterList[num].MobProperty[0,4]  := DelList[4];
             MonsterList[num].MobProperty[0,5]  := DelList[5];
             MonsterList[num].MobProperty[0,6]  := DelList[6];
             MonsterList[num].MobProperty[0,7]  := DelList[7];
             MonsterList[num].MobProperty[0,8]  := DelList[8];
             MonsterList[num].MobProperty[0,9]  := DelList[9];
             MonsterList[num].MobProperty[0,10] := DelList[10];
             MonsterList[num].MobProperty[0,11] := DelList[11];
             MonsterList[num].MobProperty[0,12] := DelList[12];
             MonsterList[num].MobProperty[0,13] := DelList[13];
             MonsterList[num].MobProperty[0,14] := DelList[14];
             MonsterList[num].MobProperty[0,15] := DelList[15];
             MonsterList[num].MobProperty[0,16] := DelList[16];
             MonsterList[num].MobProperty[0,17] := DelList[17];
             MonsterList[num].MobProperty[0,18] := DelList[18];
             MonsterList[num].MobProperty[0,19] := DelList[19];
             MonsterList[num].MobProperty[0,20] := DelList[20];
             MonsterList[num].MobProperty[0,21] := DelList[21];
             MonsterList[num].MobProperty[0,22] := DelList[22];
             MonsterList[num].MobProperty[0,23] := DelList[23];
             MonsterList[num].MobProperty[0,24] := DelList[24];
             MonsterList[num].MobProperty[0,25] := DelList[25];
             MonsterList[num].MobProperty[0,26] := DelList[26];
             MonsterList[num].MobProperty[0,27] := DelList[27];
             inc(Num);
           end;
        end;
   finally
     List.Free;
     DelList.Free;
   end;
end;
{==============================================================================


===============================================================================}
procedure LoadMonstersNames (s: TFileName);
var
List, DelList: TStringList;
i: integer;
Check: String;
begin
  List := TStringList.Create;
  DelList := TStringList.Create;
  DelList.Delimiter := #9;
  DelList.QuoteChar := #34;
   try
     List.LoadFromFile(s);
       for i := 0 to List.Count -1 do
        begin
          Check := List[i];
         DelList.DelimitedText := List[i];
     if not CheckString(Check) then
         begin
         MonsterList[MNames].MobProperty[1,0]  := DelList[0];
         MonsterList[MNames].MobProperty[1,1]  := DelList[1];
         inc(MNames);
         end;
        end;
   finally
     List.Free;
     DelList.Free;
   end;
end;
{==============================================================================


===============================================================================}
procedure LoadMapNames (s: TFileName);
var
List, DelList: TStringList;
i: integer;
Check: String;
begin
  List := TStringList.Create;
  DelList := TStringList.Create;
  DelList.Delimiter := #9;
  DelList.QuoteChar := #34;
   try
     List.LoadFromFile(s);
       for i := 0 to List.Count -1 do
        begin
          Check := List[i];
         DelList.DelimitedText := List[i];
      if not CheckString(Check) then
           begin
         MonsterList[MapNames].MobProperty[2,0]  := DelList[0];
         MonsterList[MapNames].MobProperty[2,1]  := DelList[1];
         inc(MNames);
         end;
        end;
   finally
     List.Free;
     DelList.Free;
   end;
end;
{==============================================================================


===============================================================================}

end.


Code:
unit FMainFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ComCtrls, StdCtrls, Mask, AdvSpin, ExtCtrls, jpeg, AdvTrackBar, About;

const
 MBase0 = '%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'//%s'+#9+'%s';
 MBase1 = '%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'//%s'+#9+'%s';
 MonsterTxt = '%s'+#9+'%s'+#9+'"%s"'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s'+#9+'%s';
 Header = '/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////';
 Header2 ='//                              Made with "SymplyMOB" txt editor';
 Header3 ='//';
 Header4 ='//';
 Header5 ='//';
 Header6 ='//';
 Header7 ='/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////';
 Header8 ='//index'+#9+'rate'+#9+'name'+#9+'Level'+#9+'HP'+#9+'MP'+#9+'damagemin'+#9+'damagemax'+#9+'defence'+#9+'magicdefence'+#9+'attackrating'+#9+'successfulbloking'+#9+'moverange'+#9+'attacktype'+#9+'attackrange'+#9+'viewrange'+#9+'movespeed'+#9+'attackspeed'+#9+'regentime'+#9+'attribute'+#9+'itemrate'+#9+'moneyrate'+#9+'maxItemlevel'+#9+'skill'+#9+'¾óĄ½'+#9+'µ¶'+#9+'¹ų°³'+#9+'ŗŅ';


type
  TMainFrm = class(TForm)
    Open: TOpenDialog;
    MainMenu: TMainMenu;
    N1: TMenuItem;
    Load1: TMenuItem;
    Save1: TMenuItem;
    Exit2: TMenuItem;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    Panel2: TPanel;
    Bevel1: TBevel;
    MonsterIDLabel: TLabel;
    MnameLabel: TLabel;
    Mobname: TLabel;
    Panel1: TPanel;
    ELvl: TAdvSpinEdit;
    EHp: TAdvSpinEdit;
    EMp: TAdvSpinEdit;
    EMinDmg: TAdvSpinEdit;
    EMaxDmg: TAdvSpinEdit;
    Edef: TAdvSpinEdit;
    EMDef: TAdvSpinEdit;
    EARate: TAdvSpinEdit;
    EASpeed: TAdvSpinEdit;
    EARange: TAdvSpinEdit;
    EAtype: TAdvSpinEdit;
    Emovespeed: TAdvSpinEdit;
    EMovRange: TAdvSpinEdit;
    ERespawn: TAdvSpinEdit;
    EName: TLabeledEdit;
    EDefRate: TAdvSpinEdit;
    EWievRange: TAdvSpinEdit;
    SaveBtn: TButton;
    MobView: TListView;
    Bevel2: TBevel;
    MBaseView: TListView;
    FilterTypeBox: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    FilterBox: TComboBox;
    ImportMonsterBasetxt1: TMenuItem;
    Format1: TMenuItem;
    ConvertMonsterNames1: TMenuItem;
    Label3: TLabel;
    Panel3: TPanel;
    MobPic: TImage;
    MBaseMenu: TPopupMenu;
    Showpositiononmap1: TMenuItem;
    TabSheet3: TTabSheet;
    Bevel3: TBevel;
    ZoomMap: TImage;
    MapPosLabel: TLabel;
    ZoomTimer: TTimer;
    zInBtn: TButton;
    zOutBtn: TButton;
    Label4: TLabel;
    Bevel4: TBevel;
    Bevel5: TBevel;
    NormalView: TListView;
    SpotView: TListView;
    PanelImage: TPanel;
    map: TImage;
    SX: TAdvSpinEdit;
    SY: TAdvSpinEdit;
    EX: TAdvSpinEdit;
    EY: TAdvSpinEdit;
    MBaseBtn: TButton;
    Button2: TButton;
    EDistance: TAdvSpinEdit;
    EDirection: TAdvSpinEdit;
    ETotal: TAdvSpinEdit;
    ExportMonsterSetBasetxt1: TMenuItem;
    Itemtxt1: TMenuItem;
    DL1: TMenuItem;
    DLSUM1: TMenuItem;
    N9111: TMenuItem;
    About1: TMenuItem;
    MonsterSetBasetxt1: TMenuItem;
    Formatname1: TMenuItem;
    procedure Load1Click(Sender: TObject);
    procedure MobViewSelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure SaveBtnClick(Sender: TObject);
    procedure Save1Click(Sender: TObject);
    procedure Exit2Click(Sender: TObject);
    procedure FilterTypeBoxChange(Sender: TObject);
    procedure FilterBoxChange(Sender: TObject);
    procedure ImportMonsterBasetxt1Click(Sender: TObject);
    procedure ConvertMonsterNames1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure MobViewCompare(Sender: TObject; Item1, Item2: TListItem;
      Data: Integer; var Compare: Integer);
    procedure MBaseViewSelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure Showpositiononmap1Click(Sender: TObject);
    procedure ZoomTimerTimer(Sender: TObject);
    procedure mapMouseEnter(Sender: TObject);
    procedure mapMouseLeave(Sender: TObject);
    procedure mapMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure zInBtnClick(Sender: TObject);
    procedure zOutBtnClick(Sender: TObject);
    procedure mapMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    procedure FormDestroy(Sender: TObject);
    procedure MBaseBtnClick(Sender: TObject);
    procedure mapClick(Sender: TObject);
    procedure NormalViewSelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure ExportMonsterSetBasetxt1Click(Sender: TObject);
    procedure FormatbyMAPs1Click(Sender: TObject);
    procedure FormatbyType1Click(Sender: TObject);
    procedure SpotViewSelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure SpotViewClick(Sender: TObject);
    procedure NormalViewClick(Sender: TObject);
    procedure ImportItemXXXtxt1Click(Sender: TObject);
    procedure About1Click(Sender: TObject);
    procedure Formatname1Click(Sender: TObject);
 private
    Loaded, Folow: Boolean;
    Zoom : Boolean;
    zX,zY : Integer;
    NewMap: Boolean;
    BmpH, BmpV : TBitmap;
    OldX, OldY: Integer;
  public
    procedure MonsterProperty (s: String);
    procedure UpdateProperty (s: String);
    procedure UpdateNames;
    procedure LoopMonsterBaseArr(s: String);
    procedure ReNameMobs;
    procedure Parse(Column: TListColumn);
    procedure LoadMap;
    procedure Cross(X, Y: Integer);
  end;


var
  MainFrm: TMainFrm;
  Clx,ClY: Integer;
  SortColumn: integer;
  SortReverse: boolean;
  xZoom : Integer = 3;
  RectSaved : boolean = false;
  normal: Boolean = False;

implementation

uses
 uMonsters, uMonstersBasepas, uSave, uItems, uSkills;

{$R *.dfm}
procedure test(out Sx,Sy,Ex,Ey:String);
var
tmp,tmp1,tmp2,tmp3:  Integer;
begin
tmp  := StrToInt(Sx);
tmp1 := StrToInt(Sy);
tmp2 := StrToInt(Ex);
tmp3 := StrToInt(Ey);
  if tmp < tmp2 then
  begin
   Sx := Inttostr(tmp2);
   Ex := Inttostr(tmp);
  end;
  if tmp1 < tmp3 then
   begin
   Sy := Inttostr(tmp3);
   Ey := Inttostr(tmp1);
   end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Cross(X, Y: Integer);
begin
  Map.Canvas.Pen.Color := clRed shl 8;
  if RectSaved then
  begin
    Map.Canvas.CopyRect(Rect(OldX - 1, 0, OldX + 1, BmpV.Height),
    BmpV.Canvas, Rect(0,0,BmpV.Width,BmpV.Height));
    Map.Canvas.CopyRect(Rect(0, OldY - 1, BmpH.Width, OldY + 1),
    BmpH.Canvas, Rect(0,0,BmpH.Width,BmpH.Height));
    BmpH.Free;
    BmpV.Free;
  end;
  BmpH := TBitmap.Create;
  BmpH.Width := Map.Width;
  BmpH.Height := 2;
  BmpH.Canvas.CopyRect(Rect(0,0,BmpH.Width,BmpH.Height),
  Map.Canvas,Rect(0, Y - 1, BmpH.Width, Y + 1));
  BmpV := TBitmap.Create;
  BmpV.Width := 2;
  BmpV.Height := Map.Height;
  BmpV.Canvas.CopyRect(Rect(0,0,BmpV.Width,BmpV.Height),
  Map.Canvas,Rect(X - 1, 0, X + 1, BmpV.Height));
  Map.Canvas.MoveTo(0, Y);
  Map.Canvas.LineTo(Map.Width, Y);
  Map.Canvas.MoveTo(X, 0);
  Map.Canvas.LineTo(X, Map.Height);
  RectSaved := true;
  OldX := X;
  OldY := Y;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.LoadMap;
var
i: Integer;
begin
i := MBaseView.ItemIndex;
 if MBaseView.Items.Item[i].Selected and Newmap then
    try
     Map.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'Data\Images\Maps\'+MBaseView.Items.Item[i].SubItems[3]+'.Bmp');
   except
     on E: EFOpenError do
      Map.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'Data\Images\Maps\NoImg.Bmp');
   end;
   NewMap := False;
end;
{==============================================================================


===============================================================================}
function MakeRectangle(W,H: Integer; BorderColor: TColor; FillColor: TColor; txt: String): TBitmap;
begin
  Result := TBitmap.Create;
  Result.Width := W;
  Result.Height := H;
  Result.Canvas.Pen.Width := 1;
  Result.Canvas.Pen.Color := BorderColor;
  Result.Canvas.Rectangle(0,0,W,H);
  Result.Canvas.Brush.Color := FillColor;
  Result.Canvas.FillRect(Rect(1,1,W - 1,H - 1));
  Result.Canvas.TextOut(5, 10,txt);
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.LoopMonsterBaseArr(s: string);
var
i,j,e: Integer;
begin
e:=0;
 if FilterTypeBox.Text = 'Map ID' then
  begin
  e := 1;
  s := MapToId(s);
  end;
 if FilterTypeBox.Text = 'Monster ID' then
  e := 0;
 for j:= 0 to 4 do
  begin
  for i := 0 to arr -1 do
   if (MonsterBaseList[i].MobProperty[j,e] = s) then
  begin
   with MBaseView.Items.Add do
    begin
    if FilterTypeBox.Text = 'Monster ID' then
    Caption := MonsterList[StrToInt(FilterBox.Text)].MobProperty[1,1]
    else
    Caption := MonsterList[StrToInt(MonsterBaseList[i].MobProperty[j,0])].MobProperty[1,1];
    SubItems.Add(MonsterBaseList[i].MobProperty[j,0]);
    SubItems.Add(SpotType(j));
    SubItems.Add(IdToMap(StrToInt(MonsterBaseList[i].MobProperty[j,1])));
    SubItems.Add(MonsterBaseList[i].MobProperty[j,1]);
    SubItems.Add(MonsterBaseList[i].MobProperty[j,3]);
    SubItems.Add(MonsterBaseList[i].MobProperty[j,4]);
    if (j = 0) or (j = 2) or (j = 4) then
     begin
     SubItems.Add('');
     SubItems.Add('');
     SubItems.Add('');
     SubItems.Add(IntToStr(i)); //Num
     SubItems.Add(IntToStr(J)); //Type
     SubItems.Add(MonsterBaseList[i].MobProperty[j,2]);  //Rad
     SubItems.Add(MonsterBaseList[i].MobProperty[j,5])   //Str
     end
     else
     SubItems.Add(MonsterBaseList[i].MobProperty[j,5]);
     SubItems.Add(MonsterBaseList[i].MobProperty[j,6]);
     SubItems.Add(MonsterBaseList[i].MobProperty[j,8]);
     SubItems.Add(IntToStr(i));
     SubItems.Add(IntToStr(J));
     SubItems.Add(MonsterBaseList[i].MobProperty[j,7]);  //Dir
     SubItems.Add(MonsterBaseList[i].MobProperty[j,8])   //Count
    {SubItems.Add   (MonsterBaseList[i].MobProperty[j,0]+' '+
                    MonsterBaseList[i].MobProperty[j,1]+' '+
                    MonsterBaseList[i].MobProperty[j,2]+' '+
                    MonsterBaseList[i].MobProperty[j,3]+' '+
                    MonsterBaseList[i].MobProperty[j,4]+' '+
                    MonsterBaseList[i].MobProperty[j,5]+' '+
                    MonsterBaseList[i].MobProperty[j,6]+' '+
                    MonsterBaseList[i].MobProperty[j,7]+' '+
                    MonsterBaseList[i].MobProperty[j,8])}
    end;
   end;
  end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.mapClick(Sender: TObject);
begin
 if Folow then
  Folow := False
  else
  Folow := True
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.mapMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
//
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.mapMouseEnter(Sender: TObject);
begin
Zoom := True;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.mapMouseLeave(Sender: TObject);
begin
Zoom := False;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.mapMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
IsMonster: TPoint;
i: Integer;
begin
 MapPosLabel.Caption := Format('Position: X:%d-Y:%d',[X,Y]);

 if Folow then
 begin
   Cross(X,Y);
   SX.Text := IntToStr(X);
   SY.Text := IntToStr(Y);
 end;

  IsMonster := Map.screentoclient(mouse.CursorPos);
    for i:= 0 to MonsterPosCount -1 do
  if isMob(p[i],2,IsMonster) then
label4.Caption:=(Format('Mob: %s at X:[%s] Y:[%s]',[MonsterPos[i].CordXY[0,0],MonsterPos[i].CordXY[0,1],MonsterPos[i].CordXY[0,2]]));
map.ShowHint := true;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.UpdateProperty(s: string);
var
i:integer;
begin
if num >0 then
 begin
  for i := 0 to num -1 do
   if (MonsterList[i].MobProperty[0,0] = s) then
  begin
    MonsterList[i].MobProperty[0,2]  := EName.Text;
    MonsterList[i].MobProperty[0,3]  := ELvl.Text;
    MonsterList[i].MobProperty[0,4]  := EHp.Text;
    MonsterList[i].MobProperty[0,5]  := EMp.Text;
    MonsterList[i].MobProperty[0,6]  := EMinDmg.Text;
    MonsterList[i].MobProperty[0,7]  := EMAxDmg.Text;
    MonsterList[i].MobProperty[0,8]  := EDef.Text;
    MonsterList[i].MobProperty[0,9]  := EMDef.Text;
    MonsterList[i].MobProperty[0,10] := EARate.Text;
    MonsterList[i].MobProperty[0,11] := EDefRate.Text;
    MonsterList[i].MobProperty[0,12] := EMovRange.Text;
    MonsterList[i].MobProperty[0,13] := EAtype.Text;
    MonsterList[i].MobProperty[0,14] := EARange.Text;
    MonsterList[i].MobProperty[0,15] := EWievRange.Text;
    MonsterList[i].MobProperty[0,16] := Emovespeed.Text;
    MonsterList[i].MobProperty[0,17] := EASpeed.Text;
    MonsterList[i].MobProperty[0,18] := ERespawn.Text;
  end;
  Load1Click(Self);
 end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.zInBtnClick(Sender: TObject);
begin
 inc(xZoom);
zOutBtn.Enabled := True;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.ZoomTimerTimer(Sender: TObject);
var
  Srect,Drect,PosForme:TRect;
  iWidth,iHeight,DmX,DmY:Integer;
  iTmpX,iTmpY:Real;
  C:TCanvas;
  hDesktop: Hwnd;
  Kursor:TPoint;
begin
if Zoom then
 If not IsIconic(Application.Handle) then begin
  hDesktop:= GetDesktopWindow;
  GetCursorPos(Kursor);
  If not PtInRect(PosForme,Kursor) then
   begin

    zX := Kursor.X;
    zY := Kursor.Y;

 	  iWidth:=ZoomMap.Width;
    iHeight:=ZoomMap.Height;
    Drect:=Rect(0,0,iWidth,iHeight);

    iTmpX:=iWidth / (xZoom * 4);
    iTmpY:=iHeight / (xZoom * 4);

    Srect:=Rect(zx,zy,zx,zy);
    InflateRect(Srect,round(iTmpX),round(iTmpY) );
    // move Srect if outside visible area of the screen
    If Srect.Left<0 then OffsetRect(Srect,-Srect.Left,0);
    If Srect.Top<0 then OffsetRect(Srect,0,-Srect.Top);
    If Srect.Right>Screen.Width then OffsetRect(Srect,-(Srect.Right-Screen.Width),0);
    If Srect.Bottom>Screen.Height then OffsetRect(Srect,0,-(Srect.Bottom-Screen.Height));

   C:=TCanvas.Create;
   try
     C.Handle:=GetDC(GetDesktopWindow);
     ZoomMap.Canvas.CopyRect(Drect,C,Srect);
    finally
      ReleaseDC(hDesktop, C.Handle);
      C.Free;
    end;

    	with ZoomMap.Canvas do begin
      pen.Color := ClRed;
      DmX:=xZoom * 2 * (zX-Srect.Left);
      DmY:=xZoom * 2 * (zY-Srect.Top);
      MoveTo(DmX - (iWidth div 4),DmY); // -
      LineTo(DmX + (iWidth div 4),DmY); // -
    	MoveTo(DmX,DmY - (iHeight div 4)); // |
      LineTo(DmX,DmY + (iHeight div 4)); // |
      end; // with image1.Canvas
    end; // show crosshair
  	Application.ProcessMessages;
	end // Cursor not inside form
   else begin  // cursor inside form
  end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.zOutBtnClick(Sender: TObject);
begin
dec(xZoom);
if (xZoom = 3) then
 begin
  zOutBtn.Enabled := False;
 end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.MonsterProperty (s: String);
var
i:integer;
begin
if num >0 then
 begin
  for i := 0 to num -1 do
   if (MonsterList[i].MobProperty[0,0] = s) then
  begin
    Mobname.Caption := MonsterList[i].MobProperty[0,2];
    Label3.Caption  := MonsterList[i].MobProperty[0,0];
    EName.Text      := MonsterList[i].MobProperty[0,2];
    ELvl.Text       := MonsterList[i].MobProperty[0,3];
    EHp.Text        := MonsterList[i].MobProperty[0,4];
    EMp.Text        := MonsterList[i].MobProperty[0,5];
    EMinDmg.Text    := MonsterList[i].MobProperty[0,6];
    EMAxDmg.Text    := MonsterList[i].MobProperty[0,7];
    EDef.Text       := MonsterList[i].MobProperty[0,8];
    EMDef.Text      := MonsterList[i].MobProperty[0,9];
    EARate.Text     := MonsterList[i].MobProperty[0,10];
    EDefRate.Text   := MonsterList[i].MobProperty[0,11];
    EMovRange.Text  := MonsterList[i].MobProperty[0,12];
    EAtype.Text     := MonsterList[i].MobProperty[0,13];
    EARange.Text    := MonsterList[i].MobProperty[0,14];
    EWievRange.Text := MonsterList[i].MobProperty[0,15];
    Emovespeed.Text := MonsterList[i].MobProperty[0,16];
    EASpeed.Text    := MonsterList[i].MobProperty[0,17];
    ERespawn.Text   := MonsterList[i].MobProperty[0,18];
  end;
 end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.NormalViewClick(Sender: TObject);
begin
  normal := True;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.NormalViewSelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
var
i: integer;
begin
i:=item.index;
  if Selected then
  begin
     Cross(StrToInt(NormalView.Items.Item[i].SubItems[2]),StrToInt(NormalView.Items.Item[i].SubItems[1]));
     TBitmap(Map.Picture.Graphic).Canvas.Pixels[StrToInt(NormalView.Items.Item[i].SubItems[2]),StrToInt(NormalView.Items.Item[i].SubItems[1])] := ClRed;

     SX.Text         :=  NormalView.Items.Item[i].SubItems[1];
     SY.Text         :=  NormalView.Items.Item[i].SubItems[2];
     EDirection.Text :=  NormalView.Items.Item[i].SubItems[6];
     EDistance.Text  :=  NormalView.Items.Item[i].SubItems[5];

     EX.Text     := '';
     EY.Text     := '';
     ETotal.Text := '';

     EDistance.Enabled := True;

     EX.Enabled     := False;
     EY.Enabled     := False;
     ETotal.Enabled := False;
  end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Save1Click(Sender: TObject);
var
List : TStrings;
i: integer;
begin
if num <=0 then
 begin
MessageDlg('nehuja!! first import - "Monster.txt" ', mtError, [mbOK], 0);
 exit;
end;
  List := TStringList.Create;
 try
  List.Add(Header);
  List.Add(Header2);
  List.Add(Header3);
  List.Add(Header4);
  List.Add(Header5);
  List.Add(Header6);
  List.Add(Header7);
  List.Add(Header8);
  for i := 0 to num - 1 do
   begin
  List.Add(Format(MonsterTxt,[MonsterList[i].MobProperty[0,0],MonsterList[i].MobProperty[0,1],MonsterList[i].MobProperty[0,2],
  MonsterList[i].MobProperty[0,3],MonsterList[i].MobProperty[0,4],MonsterList[i].MobProperty[0,5],MonsterList[i].MobProperty[0,6],
  MonsterList[i].MobProperty[0,7],MonsterList[i].MobProperty[0,8],MonsterList[i].MobProperty[0,9],MonsterList[i].MobProperty[0,10],
  MonsterList[i].MobProperty[0,11],MonsterList[i].MobProperty[0,12],MonsterList[i].MobProperty[0,13],MonsterList[i].MobProperty[0,14],
  MonsterList[i].MobProperty[0,15],MonsterList[i].MobProperty[0,16],MonsterList[i].MobProperty[0,17],MonsterList[i].MobProperty[0,18],
  MonsterList[i].MobProperty[0,19],MonsterList[i].MobProperty[0,20],MonsterList[i].MobProperty[0,21],MonsterList[i].MobProperty[0,22],
  MonsterList[i].MobProperty[0,23],MonsterList[i].MobProperty[0,24],MonsterList[i].MobProperty[0,25],MonsterList[i].MobProperty[0,26],
  MonsterList[i].MobProperty[0,27]]));
   end;
  List.Add('end');
  List.SaveToFile(ExtractFilePath(Application.ExeName)+'\NewMonster.txt');
  Application.MessageBox('Saved as NewMonster.txt','Finished', MB_ICONINFORMATION+MB_OK);
 finally
   List.Free;
 end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.SaveBtnClick(Sender: TObject);
begin
UpdateProperty(Label3.Caption);
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Showpositiononmap1Click(Sender: TObject);
var
  MyRectangle : TBitmap;
  i: integer;
begin
  i := MBaseView.ItemIndex;
  if MBaseView.Items.Item[i].Selected then
   LoadMap;
   if (MBaseView.Items.Item[i].SubItems[1] = 'Guards / NPC / Traps') or
      (MBaseView.Items.Item[i].SubItems[1] = 'Normal Monster') or
      (MBaseView.Items.Item[i].SubItems[1] = 'Blood Castle Monsters / Gate / Others') or
      (MBaseView.Items.Item[i].SubItems[6] = '')
   then
     begin
 AddMonsterSpot(MBaseView.Items.Item[i].Caption,MBaseView.Items.Item[i].SubItems[5],MBaseView.Items.Item[i].SubItems[4]);
 TBitmap(Map.Picture.Graphic).Canvas.Pixels[StrToInt(MBaseView.Items.Item[i].SubItems[5]),StrToInt(MBaseView.Items.Item[i].SubItems[4])] := ClRed;
  with NormalView.Items.Add do
   begin
     Caption := MBaseView.Items.Item[i].Caption;         // Name
     SubItems.Add(MBaseView.Items.Item[i].SubItems[0]);  // Monster Id
     SubItems.Add(MBaseView.Items.Item[i].SubItems[4]);  // Y
     SubItems.Add(MBaseView.Items.Item[i].SubItems[5]);  // X
     SubItems.Add(MBaseView.Items.Item[i].SubItems[9]);  // i arr
     SubItems.Add(MBaseView.Items.Item[i].SubItems[10]); // J arr
     SubItems.Add(MBaseView.Items.Item[i].SubItems[11]); // Dir
     SubItems.Add(MBaseView.Items.Item[i].SubItems[12]); // Str
     SubItems.Add(MBaseView.Items.Item[i].SubItems[3]);  // mapId
   end;
 end
 else
 begin
 AddMonsterRangeSpot(MBaseView.Items.Item[i].Caption,MBaseView.Items.Item[i].SubItems[4],MBaseView.Items.Item[i].SubItems[5],MBaseView.Items.Item[i].SubItems[6],MBaseView.Items.Item[i].SubItems[7],MBaseView.Items.Item[i].SubItems[8]);
 try
 MyRectangle := MakeRectangle(StrToInt(MBaseView.Items.Item[i].SubItems[7])+1-StrToInt(MBaseView.Items.Item[i].SubItems[5]),StrToInt(MBaseView.Items.Item[i].SubItems[6])+1-StrToInt(MBaseView.Items.Item[i].SubItems[4]),clMaroon,clRed,MBaseView.Items.Item[i].Caption+' Spot. Count:'+MBaseView.Items.Item[i].SubItems[8]);
 map.Canvas.Draw(StrToInt(MBaseView.Items.Item[i].SubItems[5]),StrToInt(MBaseView.Items.Item[i].SubItems[4]),MyRectangle,150);
   with SpotView.Items.Add do
   begin
     Caption := MBaseView.Items.Item[i].Caption;         // Name
     SubItems.Add(MBaseView.Items.Item[i].SubItems[0]);  // Monster Id
     SubItems.Add(MBaseView.Items.Item[i].SubItems[4]);  // SY
     SubItems.Add(MBaseView.Items.Item[i].SubItems[5]);  // SX
     SubItems.Add(MBaseView.Items.Item[i].SubItems[6]);  // EY
     SubItems.Add(MBaseView.Items.Item[i].SubItems[7]);  // EX
     SubItems.Add(MBaseView.Items.Item[i].SubItems[11]); // Dir
     SubItems.Add(MBaseView.Items.Item[i].SubItems[12]); // Str
     SubItems.Add(MBaseView.Items.Item[i].SubItems[3]);  // mapId
   end;
 except
    on E: EoutOfResources do
MessageDlg('Wrong spot - range! from X:'+MBaseView.Items.Item[i].SubItems[4]+' - Y:'+MBaseView.Items.Item[i].SubItems[5]+' to X:'+MBaseView.Items.Item[i].SubItems[6]+' - Y:'+MBaseView.Items.Item[i].SubItems[7], mtError, [mbOk], 0)
 end;
 end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.SpotViewClick(Sender: TObject);
begin
  normal := False;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.SpotViewSelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
var
i: integer;
begin
i:=item.index;
  if Selected then

  SX.Text         :=  SpotView.Items.Item[i].SubItems[1];
  SY.Text         :=  SpotView.Items.Item[i].SubItems[2];
  EX.Text         :=  SpotView.Items.Item[i].SubItems[3];
  EY.Text         :=  SpotView.Items.Item[i].SubItems[4];
  EDirection.Text :=  SpotView.Items.Item[i].SubItems[5];
  ETotal.Text     :=  SpotView.Items.Item[i].SubItems[6];

  EDistance.Text  :=  '';

  EDistance.Enabled := False;
  EX.Enabled     := True;
  EY.Enabled     := True;
  ETotal.Enabled := True;

end;
{==============================================================================


===============================================================================}
procedure TMainFrm.FilterBoxChange(Sender: TObject);
begin
NewMap    := True;
RectSaved := False;

ClearMonsterSpot;

MBaseView.Clear;
NormalView.Clear;

LoopMonsterBaseArr(FilterBox.Text);
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.FilterTypeBoxChange(Sender: TObject);
var
i:integer;
begin
FilterBox.clear;
  if FilterTypeBox.Text = 'Monster ID' then
   begin
     for i := 0 to 1000 do
      FilterBox.items.Add(IntToStr(i))
   end;
     if FilterTypeBox.Text = 'Map ID' then
   begin
     for i := 0 to 72 do
      FilterBox.items.Add(idtomap(i))
   end;
FilterBox.ItemIndex := 0;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.FormatbyMAPs1Click(Sender: TObject);
begin
MainMenu.Items.Items[2].Items[1].Checked := True;
MainMenu.Items.Items[2].Items[0].Checked := False;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.FormatbyType1Click(Sender: TObject);
begin
MainMenu.Items.Items[2].Items[0].Checked := True;
MainMenu.Items.Items[2].Items[1].Checked := False;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Formatname1Click(Sender: TObject);
begin
  if MainMenu.Items.Items[1].Items[0].Checked then
  MainMenu.Items.Items[1].Items[0].Checked := false
  else
  MainMenu.Items.Items[1].Items[0].Checked := True;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.FormCreate(Sender: TObject);
begin
 PanelImage.DoubleBuffered := true;
try
 LoadMonstersNames(ExtractFilePath(Application.ExeName)+'Data\Files\MonsterNames.txt');
 LoadMapNames(ExtractFilePath(Application.ExeName)+'Data\Files\MapNames.txt');
 LoadItemNames(ExtractFilePath(Application.ExeName)+'Data\Files\ItemNames.txt');
 LoadSkillNames(ExtractFilePath(Application.ExeName)+'Data\Files\SkilNames.txt');
except
on E: EFOpenError do
if MessageDlg(E.Message, mtError, [mbOK,mbClose], 0) = MrClose then
application.Terminate
else
 MainMenu.Items.Items[1].Enabled := False;
end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.FormDestroy(Sender: TObject);
begin
 ClearMonsterSpot;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.ImportItemXXXtxt1Click(Sender: TObject);
begin
 Open.Filter := 'item(Jpn).txt|item(Jpn).txt|item(Kor).txt|item(Kor).txt|item(Chs).txt|item(Chs).txt';
 if Open.Execute then
  begin
   case Open.FilterIndex of
    1: showmessage('under construction =)');
    2: LoadItemsKor(Open.FileName);
    3: showmessage('under construction =)');
   end;
  end;
  SaveItems;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.ImportMonsterBasetxt1Click(Sender: TObject);
begin
 Open.Filter := 'MonsterSetBase.txt|MonsterSetBase.txt';
 if Open.Execute then
  LoadMonstersBaseTxt(Open.FileName)
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.UpdateNames;
var
i,e: Integer;
begin
if (num  > 0) then
 begin
 for e := 0 to mobview.Items.Count - 1 do
 for i := 0 to num - 1 do
    begin
      if Comparestr(MonsterList[i].MobProperty[0,0],mobview.Items.Item[e].SubItems[0])>1 then
    MonsterList[e].MobProperty[0,2] := mobview.Items.Item[e].Caption;
    end;
  end;
  Load1Click(self)
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.ReNameMobs;
var
i,e: Integer;
begin
if (num  > 0) then
 begin
 for e := 0 to MNames - 1 do
 for i := 0 to num - 1 do
    begin
      if ((MonsterList[i].MobProperty[0,0]) = (MonsterList[e].MobProperty[1,0])) then
      if MonsterList[e].MobProperty[1,1] = '' then
       mobview.Items.Item[i].Caption := MonsterList[i].MobProperty[0,2]
       else
    mobview.Items.Item[i].Caption := MonsterList[e].MobProperty[1,1];
    end;
  end;
  UpdateNames;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.MBaseBtnClick(Sender: TObject);
var
i: Integer;
begin
i := NormalView.ItemIndex;
 if NormalView.Items.Item[i].Selected and normal then
  begin
    MonsterBaseList[StrToInt(NormalView.Items.Item[i].SubItems[3])].MobProperty[StrToInt(NormalView.Items.Item[i].SubItems[4]),2]  := EDistance.Text;
    MonsterBaseList[StrToInt(NormalView.Items.Item[i].SubItems[3])].MobProperty[StrToInt(NormalView.Items.Item[i].SubItems[4]),3]  := SY.Text;
    MonsterBaseList[StrToInt(NormalView.Items.Item[i].SubItems[3])].MobProperty[StrToInt(NormalView.Items.Item[i].SubItems[4]),4]  := SX.Text;
    MonsterBaseList[StrToInt(NormalView.Items.Item[i].SubItems[3])].MobProperty[StrToInt(NormalView.Items.Item[i].SubItems[4]),5]  := EDirection.Text;
  end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.About1Click(Sender: TObject);
var
ab: TAboutBox;
begin
 ab := TAboutBox.Create(self);
 ab.ShowModal;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.ConvertMonsterNames1Click(Sender: TObject);
begin
ReNameMobs;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Exit2Click(Sender: TObject);
begin
close;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.ExportMonsterSetBasetxt1Click(Sender: TObject);
var
List : TStrings;
i,j: integer;
begin
if arr <=0 then
 begin
MessageDlg('nehuja!! first import - "MonsterSetBase.txt" ', mtError, [mbOK], 0);
 exit;
end;
  List := TStringList.Create;
 if MainMenu.Items.Items[1].Items[0].Checked then
 begin
    SaveByMapName;
 end
 else
 try
  List.Add(Header);
  List.Add(Header2);
  List.Add(Header3);
  List.Add(Header4);
  List.Add(Header5);
  List.Add(Header6);
  List.Add(Header7);
 for j := 0 to 4 do
  begin
   case j of
    0: begin
        List.Add('//0 - Type: Guards / NPC / Traps');
        List.Add('//Mob'+#9+'Map'+#9+'Rad'+#9+'X'+#9+'Y'+#9+'Str'+#9+'Description');
        List.Add('0');
   for i := 0 to arr0 - 1 do
   begin
        List.Add(Format(MBase0,[MonsterBaseList[i].MobProperty[j,0],MonsterBaseList[i].MobProperty[j,1],MonsterBaseList[i].MobProperty[j,2],
                                MonsterBaseList[i].MobProperty[j,3],MonsterBaseList[i].MobProperty[j,4],MonsterBaseList[i].MobProperty[j,5],
                                idtomap(StrToInt(MonsterBaseList[i].MobProperty[j,1])),MonsterList[StrToInt(MonsterBaseList[i].MobProperty[j,0])].MobProperty[1,1]]));
            end;
        List.Add('end');
       end;
       1: begin
        List.Add('//1 - Type: Spots');
        List.Add('1');
        List.Add('//Mob'+#9+'Map'+#9+'Rad'+#9+'X'+#9+'Y'+#9+'X2'+#9+'Y2'+#9+'Dir'+#9+'Count'+#9+'Description');
   for i := 0 to arr1 - 1 do
   begin
        List.Add(Format(MBase1,[MonsterBaseList[i].MobProperty[j,0],MonsterBaseList[i].MobProperty[j,1],MonsterBaseList[i].MobProperty[j,2],
                                MonsterBaseList[i].MobProperty[j,3],MonsterBaseList[i].MobProperty[j,4],MonsterBaseList[i].MobProperty[j,5],
                                MonsterBaseList[i].MobProperty[j,6],MonsterBaseList[i].MobProperty[j,7],MonsterBaseList[i].MobProperty[j,8],
                                idtomap(StrToInt(MonsterBaseList[i].MobProperty[j,1])),MonsterList[StrToInt(MonsterBaseList[i].MobProperty[j,0])].MobProperty[1,1]]));
         end;
        List.Add('end');
       end;
       2: begin
        List.Add('//2 - Type: Normal Monster');
        List.Add('//Mob'+#9+'Map'+#9+'Rad'+#9+'X'+#9+'Y'+#9+'Str'+#9+'Description');
        List.Add('2');
   for i := 0 to arr2 - 1 do
   begin
        List.Add(Format(MBase0,[MonsterBaseList[i].MobProperty[j,0],MonsterBaseList[i].MobProperty[j,1],MonsterBaseList[i].MobProperty[j,2],
                                MonsterBaseList[i].MobProperty[j,3],MonsterBaseList[i].MobProperty[j,4],MonsterBaseList[i].MobProperty[j,5],
                                idtomap(StrToInt(MonsterBaseList[i].MobProperty[j,1])),MonsterList[StrToInt(MonsterBaseList[i].MobProperty[j,0])].MobProperty[1,1]]));
            end;
        List.Add('end');
       end;
       3: begin
        List.Add('//3 - Type: Bone King / Golden Monsters');
        List.Add('3');
        List.Add('//Mob'+#9+'Map'+#9+'Rad'+#9+'X'+#9+'Y'+#9+'X2'+#9+'Y2'+#9+'Dir'+#9+'Count'+#9+'Description');
   for i := 0 to arr3 - 1 do
   begin
        List.Add(Format(MBase1,[MonsterBaseList[i].MobProperty[j,0],MonsterBaseList[i].MobProperty[j,1],MonsterBaseList[i].MobProperty[j,2],
                                MonsterBaseList[i].MobProperty[j,3],MonsterBaseList[i].MobProperty[j,4],MonsterBaseList[i].MobProperty[j,5],
                                MonsterBaseList[i].MobProperty[j,6],MonsterBaseList[i].MobProperty[j,7],MonsterBaseList[i].MobProperty[j,8],
                                idtomap(StrToInt(MonsterBaseList[i].MobProperty[j,1])),MonsterList[StrToInt(MonsterBaseList[i].MobProperty[j,0])].MobProperty[1,1]]));
         end;
        List.Add('end');
       end;
       4: begin
        List.Add('//4 - Type: Blood Castle Monsters / Gate / Others');
        List.Add('//Mob'+#9+'Map'+#9+'Rad'+#9+'X'+#9+'Y'+#9+'Str'+#9+'Description');
        List.Add('4');
   for i := 0 to arr4 - 1 do
   begin
        List.Add(Format(MBase0,[MonsterBaseList[i].MobProperty[j,0],MonsterBaseList[i].MobProperty[j,1],MonsterBaseList[i].MobProperty[j,2],
                                MonsterBaseList[i].MobProperty[j,3],MonsterBaseList[i].MobProperty[j,4],MonsterBaseList[i].MobProperty[j,5],
                                idtomap(StrToInt(MonsterBaseList[i].MobProperty[j,1])),MonsterList[StrToInt(MonsterBaseList[i].MobProperty[j,0])].MobProperty[1,1]]));
            end;
        List.Add('end');
        end;
      end;
    end;
    List.SaveToFile(ExtractFilePath(Application.ExeName)+'\NewMonsterSetBase.txt');
  Application.MessageBox('Saved as NewMonsterSetBase.txt','Finished', MB_ICONINFORMATION+MB_OK);
 finally
   List.Free;
 end;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Load1Click(Sender: TObject);
var
i: Integer;
begin
 Open.Filter := 'Monster.txt|Monster.txt';
  if not Loaded and Open.Execute then LoadMonstersTxt(Open.FileName);
 try
  MobView.Clear;
    for i := 0 to num - 1 do
      begin
     with MobView.Items.Add do
      begin
        Caption := MonsterList[i].MobProperty[0,2];
        SubItems.Add(MonsterList[i].MobProperty[0,0])
      end;
     end;
     Parse(MobView.Column[1]);
 except
MessageDlg('Errors! nu nezinu..! Varbut tu luznis nemaz i ne-importeji "Monster.txt"?', mtError, [mbOK], 0);
    end;
    Loaded := true;
//    Load1.Enabled := False;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.Parse(Column: TListColumn);
begin
  SortColumn := MobView.Column[1].Index;
  MobView.CustomSort(nil, 0);
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.MBaseViewSelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
begin
//
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.MobViewCompare(Sender: TObject; Item1, Item2: TListItem;
  Data: Integer; var Compare: Integer);
var
  i1, i2: integer;
begin
  case SortColumn of
    0: Compare := AnsiCompareStr(Item1.Caption, Item2.Caption);
    1, 2:
      begin
        i1 := StrToIntDef(Item1.SubItems[SortColumn-1], 0);
        i2 := StrToIntDef(Item2.SubItems[SortColumn-1], 0);
        if i1 < i2 then
          Compare := -1
        else if i1 > i2 then
          Compare := 1
        else Compare := 0;
      end;
  end;
  if SortReverse then Compare := 0 - Compare;
end;
{==============================================================================


===============================================================================}
procedure TMainFrm.MobViewSelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
var
i: integer;
begin
i:=item.index;
  if Selected then
  begin
   MonsterProperty(MobView.Items.Item[i].SubItems[0]);
   try
     MobPic.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'Data\Images\Mobs\'+MobView.Items.Item[i].SubItems[0]+'.Jpg');
   except
     on E: EFOpenError do
      MobPic.Picture := nil;
   end;
  end;
end;
{==============================================================================


===============================================================================}
end.
 
Back
Top