📄 mainform.pas
字号:
mainfrm.statusbar1.Panels[3].Text:=makey;
if fileexists(filepath+'jpg/'+ copy(mapdata,0,pos('.',mapdata)-1)+'.jpg') then
begin
//读取显示地图jpeg文件
mainfrm.Image1.Picture.LoadFromFile(filepath+'jpg/'+ copy(mapdata,0,pos('.',mapdata)-1)+'.jpg');
mainfrm.Image1.Visible:=true;
end;
//读取地图消息
if MI.LoadMap (filepath+'map/'+mapdata) = False then
begin
mainfrm.RichView1.AddNL('['+TimeToStr(now)+'] '+'加载地图文件失败!!!',3,0);
mainfrm.RichView1.Format;
end
else
begin
mapx:=MI.GetMapWidth;
mapy:=MI.GetMapHeight;
px:=strtoint(makex)/mapx * mainfrm.image1.Width;
py:=strtoint(makey)/mapy * mainfrm.image1.Height;
mainfrm.Shape1.Left:=Trunc(px)+mainfrm.Image1.Left;
mainfrm.shape1.top:=Trunc(py);
mainfrm.Shape1.Visible:=true;
end;
//设定吃药类可以点击
mainfrm.CheckBox1.Enabled:=true;
mainfrm.checkbox3.Enabled:=true;
mainfrm.CheckBox18.Enabled:=true;
end;
10: begin //出现NPC 或MONSTER
mainfrm.ListView2.Items.Add;
if (mainfrm.combobox4.itemindex=0) or(mainfrm.combobox4.itemindex=2)or (mainfrm.ComboBox4.ItemIndex=3) then
mainfrm.ListView2.Items.Item[mainfrm.ListView2.Items.Count-1].Caption:=monster
else
mainfrm.ListView2.Items.Item[mainfrm.ListView2.Items.Count-1].Caption:=monsterTW;
mainfrm.ListView2.Items.Item[mainfrm.ListView2.Items.Count-1].SubItems.clear;
mainfrm.ListView2.Items.Item[mainfrm.ListView2.Items.Count-1].SubItems.add('');
mainfrm.ListView2.Items.Item[mainfrm.ListView2.Items.Count-1].SubItems.add(monster1);
for i:=0 to mainfrm.ListBox2.Count-1 do
begin
if mainfrm.ComboBox4.ItemIndex<>1 then
begin
if monster=mainfrm.ListBox2.Items.Strings[i] then
mainfrm.ComboBox5.Items.Add(monster1);
end;
if mainfrm.ComboBox4.ItemIndex=1 then
begin
if monstertw=mainfrm.ListBox2.Items.Strings[i] then
mainfrm.ComboBox5.Items.Add(monster1);
end;
end;
end;
11: begin //从showgoods list里面删除死了得NPC
discover(npcdie1);
for i:=0 to mainfrm.ComboBox5.Items.Count-1 do
begin
if mainfrm.ComboBox5.Items.Strings[i]=npcdie1 then
mainfrm.ComboBox5.Items.Delete(i);
end;
end;
//聊天类
12: if mainfrm.others.Checked=false then
begin
mainfrm.RichView4.AddNL('['+TimeToStr(now)+'] '+goods2,4,0); // mainfrm.RichEdit1.Lines.Add('['+TimeToStr(now)+'] '+goods2);
mainfrm.RichView4.Format;
if mainfrm.checkbox13.Checked=true then
begin
SendMessage(mainfrm.richview4.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
// SendMessage(mainfrm.richview1.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
//战斗移动的坐标
{ 15: begin
mainfrm.statusbar1.Panels[2].Text:=inttostr(selfx);
mainfrm.statusbar1.Panels[3].Text:=inttostr(selfy);
px:=(selfx/mapx) * mainfrm.image1.Width;
py:=(selfy/mapy) * mainfrm.image1.Height;
mainfrm.Shape1.Left:=Trunc(px)+mainfrm.Image1.Left;
mainfrm.shape1.top:=Trunc(py);
end; }
//人物遇到障碍返回的坐标?
16: begin
mainfrm.StatusBar1.Panels[2].Text:=inttostr(selfx);
mainfrm.StatusBar1.Panels[3].Text:=inttostr(selfy);
end;
22: begin
if (mainfrm.CheckBox2.Checked=true)and(ackmonster=true) then //判断条件 武功设定好了就自动反击
sendfb(attackmonster(npcattack));
end;
23: begin
mainfrm.basicattribe.Items.Item[2].Caption:='浩然';
mainfrm.basicattribe.Items.Item[2].SubItems.clear;
mainfrm.basicattribe.Items.Item[2].SubItems.add(inttostr(haoran));
if mainfrm.basicattribe.Items.Item[10].Caption='' then
mainfrm.basicattribe.Items.Item[10].Caption:='技能值';
mainfrm.basicattribe.Items.item[10].SubItems.clear;
mainfrm.basicattribe.Items.Item[10].SubItems.add(inttostr(jinengzhi));
end;
//怪物的血值显示
27: begin
for i:=0 to mainfrm.ListView2.Items.Count-1 do
begin
if pos(monstername,mainfrm.ListView2.Items.Item[i].SubItems.Text)>0 then
mainfrm.ListView2.Items.Item[i].SubItems.Strings[0]:= monsterlife1;
end;
end;
28: begin //地图出现某物品
mainfrm.ListView2.Items.Add;
mainfrm.ListView2.Items[mainfrm.ListView2.Items.Count-1].Caption:=goods3;
mainfrm.ListView2.Items[mainfrm.ListView2.Items.Count-1].SubItems.clear;
mainfrm.ListView2.Items[mainfrm.ListView2.Items.Count-1].SubItems.add(goods31x+':'+goods31y);
mainfrm.ListView2.Items[mainfrm.ListView2.Items.Count-1].SubItems.add(goods31);
ts := TStringList.Create ;
ts.Clear;
ts.DelimitedText:=goods3;
// mainfrm.Memo1.Lines.Add(goodsset); 测试掉落物品的代码比如是门石 跳点 还是物品
if (mainfrm.CheckBox5.Checked=true)and ((goodsset='0102')or (goodsset='0802')) then //and(abs(strtoint(goods31x)-strtoint(makex))<3)and(abs(strtoint(goods31y)-strtoint(makey))<3) then
begin
sfgetgoods:=1;
for j:=0 to ts.Count-1 do
begin
for i:=0 to mainfrm.ListBox1.Items.Count-1 do
begin
if mainfrm.checkbox6.Checked=true then
begin
if copy(ts.Strings[j],1,length(mainfrm.ListBox1.Items.Strings[i]))=mainfrm.ListBox1.Items.Strings[i] then
begin
sfgetgoods:=2;
end;
end;
if mainfrm.checkbox6.Checked=false then
begin
if copy(ts.Strings[j],1,length(mainfrm.ListBox1.Items.Strings[i]))=mainfrm.ListBox1.Items.Strings[i] then
begin mainfrm.goodsget.Items.Add(goods31); sendfb(clickmonster(goods31)); end;
end;
end;
if (sfgetgoods=1)and (mainfrm.CheckBox6.Checked=true) then begin mainfrm.goodsget.Items.Add(goods31);sendfb(clickmonster(goods31));end;
end;
end;
ts.Destroy;
//这里加个参数试看
end;
30: begin //物品消失 从showgoods list里面删除
discover(disgoods1);
for i:=0 to mainfrm.goodsget.Items.Count-1 do
begin
if mainfrm.goodsget.Items.Strings[i]=disgoods1 then
begin mainfrm.goodsget.Items.Delete(i);exit; end;
end;
end;
32: begin mainfrm.statusbar1.Panels[1].Text:=usegongfu1; end; //使用得武功
34: begin //基本武功类
if mainfrm.baseView.Items.Count-1<basicskillnum then
mainfrm.baseView.Items.Add;
mainfrm.baseview.items.item[basicskillnum].caption:=basic1;
if basiclevel='0' then basiclevel:='';
mainfrm.baseview.Items.Item[basicskillnum].SubItems.clear;
mainfrm.baseview.Items.Item[basicskillnum].SubItems.Add(basiclevel);
end;
47: begin
mainfrm.listview2.items.add;
mainfrm.ListView2.Items[mainfrm.ListView2.Items.Count-1].Caption:=balkname;
mainfrm.listview2.Items[mainfrm.listview2.Items.Count-1].caption:=balkname; //障碍显示 由于障碍显示问题暂定名字为此
mainfrm.listview2.Items[mainfrm.listview2.Items.Count-1].SubItems.Add(balksite); //设定活力段为空
mainfrm.listview2.Items[mainfrm.listview2.Items.Count-1].SubItems.Add(balknum); //设定代码段值
//将障碍也加入显示
for i:=0 to mainfrm.ListBox2.Count-1 do
begin
// if mainfrm.ComboBox4.ItemIndex<>1 then
// begin
if balkname=mainfrm.ListBox2.Items.Strings[i] then
mainfrm.ComboBox5.Items.Add(balknum);
// end;
{ if mainfrm.ComboBox4.ItemIndex=1 then
begin
if monstertw=mainfrm.ListBox2.Items.Strings[i] then
mainfrm.ComboBox5.Items.Add(monster1);
end;
}
end;
end;
48: discover(balkdis1); //清楚障碍得数据
//公告栏
50: begin
mainfrm.RichView1.AddNL('['+TimeToStr(now)+'] '+'公告部分',2,0);
mainfrm.RichView1.Format;
sleep(300);
sendfb('(BENJNNNNNNN\N>^wNEVNSzuNyhBKP`bFty=TXPUrSANNNVWNNN>tsKwNU?XwNNNN)');
if mainfrm.checkbox13.Checked=true then
begin
SendMessage(mainfrm.richview1.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
// mainfrm.speedbutton3.visible:=true;
mainfrm.CheckBox21.Visible:=true;
end;
//祝福类公告
54: begin
if mainfrm.gonggao.Checked=false then
begin
mainfrm.RichView1.AddNL('['+TimeToStr(now)+'] '+happly1,2,0);
mainfrm.RichView1.Format;
if mainfrm.checkbox13.Checked=true then
begin
SendMessage(mainfrm.richview1.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
// SendMessage(mainfrm.richview1.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
end;
61: begin //2层武功
if mainfrm.twogestView.Items.Count-1<twogestnum then
mainfrm.twogestView.Items.Add;
mainfrm.twogestview.items.item[twogestnum].caption:=twogestskill;
if twogestlevel='0' then twogestlevel:='';
mainfrm.twogestview.Items.Item[twogestnum].SubItems.clear;
mainfrm.twogestview.Items.Item[twogestnum].SubItems.Add(twogestlevel);
end;
//人物镜子
62: begin
mainfrm.basicattribe.items.item[3].caption:='镜界';
mainfrm.basicattribe.items.item[3].subitems.clear; //先清除原来得镜子值
mainfrm.basicattribe.items.item[3].subitems.add(gestglassname); //添加镜子值
end;
//交易商传来的消息
67: begin
ts := TStringList.Create ;
mainfrm.tradelist.Items.Clear;
ts.Delimiter:= ',' ;
ts.DelimitedText:=trademenustr;
for i:=0 to ts.Count-1 do
begin
mainfrm.tradelist.Items.Add(copy(ts.Strings[i],0,pos(':',ts.Strings[i])-1));
end;
end;
//技能类别名字
68: begin
mainfrm.basicattribe.Items.Item[10].Caption:=makeskillstr;
end;
70: begin //技能物品
if mainfrm.skillview.Items.Count-1 <techgoodsnum then
mainfrm.skillView.Items.Add;
mainfrm.skillview.items.item[techgoodsnum].caption:=techgoodsname;
if techgoodslevel='0' then techgoodslevel:='';
mainfrm.skillview.Items.Item[techgoodsnum].SubItems.clear;
mainfrm.skillview.Items.Item[techgoodsnum].SubItems.Add(techgoodslevel);
case techgoodsnum of
0 : mainfrm.skilledit1.Text:=techgoodsname+':'+techgoodslevel;
1 : mainfrm.skilledit2.Text:=techgoodsname+':'+techgoodslevel;
2 : mainfrm.skilledit3.Text:=techgoodsname+':'+techgoodslevel;
3 : mainfrm.skilledit4.Text:=techgoodsname+':'+techgoodslevel;
4 : mainfrm.skilledit5.Text:=techgoodsname+':'+techgoodslevel;
end;
end;
76: begin //掌风
if mainfrm.palmwindView.Items.Count-1 <palmwindnum then
mainfrm.palmwindView.Items.Add;
mainfrm.palmwindview.items.item[palmwindnum].caption:=palmwindskill;
if palmwindlevel='0' then palmwindlevel:='';
mainfrm.palmwindview.Items.Item[palmwindnum].SubItems.clear;
mainfrm.palmwindview.Items.Item[palmwindnum].SubItems.Add(palmwindlevel);
end;
83:if mainfrm.zhitiao.Checked=false then
begin
mainfrm.richview2.AddNL('['+TimeToStr(now)+'] '+zhitia,5,0); //纸条信息
mainfrm.RichView2.Format;
if mainfrm.checkbox13.Checked=true then
begin
SendMessage(mainfrm.richview3.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
if (mainfrm.checkbox10.Checked=true)and(pos('>',zhitia)<>0 ) then
sendfb(sayanswer('@纸条 '+copy(zhitia,0,pos('>',zhitia)-1)+' '+mainfrm.edit1.Text));
if mainfrm.CheckBox22.Checked=true then mainfrm.PageControl2.ActivePageIndex:=1;
end;
//物品消耗部分
84: if mainfrm.others.Checked=false then
begin
mainfrm.RichView1.AddNL('['+TimeToStr(now)+'] '+item1,5,0);
mainfrm.RichView1.Format;
if mainfrm.checkbox13.Checked=true then
begin
SendMessage(mainfrm.richview1.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
end;
86: begin //三层
if mainfrm.threegestview.Items.Count-1 <threegestnum then
mainfrm.threegestview.Items.Add;
mainfrm.threegestview.items.item[threegestnum].caption:=threegestskill;
if threegestlevel='0' then threegestlevel:='';
mainfrm.threegestview.Items.Item[threegestnum].SubItems.clear;
mainfrm.threegestview.Items.Item[threegestnum].SubItems.Add(threegestlevel);
end;
87: begin
mainfrm.basicattribe.Items.Item[4].Caption:='真气';
mainfrm.basicattribe.Items.Item[4].SubItems.clear;
mainfrm.basicattribe.Items.Item[4].SubItems.add(realgasnum);
end;
//ip以及端口重新设定
253: begin
answerstop :=true;
answerok:=true;
mainfrm.RichView1.AddNL('['+TimeToStr(now)+'] '+'连接到帐号游戏服务器',2,0);
mainfrm.RichView1.Format;
if mainfrm.ClientSocket1.Active=true then mainfrm.ClientSocket1.Active:=false;
mainfrm.clientsocket1.Host:=ipresetaddr;
mainfrm.clientsocket1.Port:=ipresetport;
try
mainfrm.clientsocket1.Active:=true;
except
end;
if mainfrm.checkbox13.Checked=true then
begin
SendMessage(mainfrm.richview1.Handle,WM_VSCROLL, SB_PAGEDOWN,0) ;
end;
mainfrm.SpeedButton1.Visible:=true;
mainfrm.SpeedButton2.Visible:=false;
end;
end;//对应case
end;
procedure myrecv (buf:pchar; len:integer);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -