Ai chơi TSOnline có bít chương trình lập trình này?

*Soledad*

Youtube Master Race
Tham gia ngày
23/7/06
Bài viết
68
Reaction score
0
Computer_Angel nói:
Hi các bạn,

Dưới đây là phiên bản 1.0.2.61 của Legna. Tính năng của phiên bản này gồm:

+Sử dụng tập tin main.cs làm tập tin cơ sở.
+Thêm hàm Include(filename) (chỉ có tác dụng trong main.cs)
Với các phiên bản trước, các bạn chỉ cần chép thêm file main.cs vào chung thư mục với phiên bản cũ.

+Thêm hàm WriteLog(string filename, string msg)
Cho phép tạo tập tin để lưu trữ thông tin chỉ định,vd về cách sử dụng:

Mã:
public override void InitBot()
{
	WriteLog("a.txt","Thu viet ghi tap tin log!!");	
}
+Bảo vệ password trong profile.ini (credited to MIP).

Password lưu trong profile.ini sẽ được mã hóa, tránh tình trạng mất pass vì "để quên" file profile.ini ở đâu đó. Để sử dụng tính năng mới này, bạn nên vào menu "Hệ thống", chọn "Lưu thông tin" để lưu lại thông tin mới vào profile.ini.
+Cải thiện tốc độ hiển thị
+Thiết lập cơ chế tự động Send End ở các trạng thái ẩn.
Với cơ chế này, sẽ không cần phải thêm SendEnd() khi BattleStopped hay SendEnd sau khi ClickOnNPC() ở hầu hết các bot Gate và bot NPC.
Để sử dụng hiệu quả,các bạn cần hiệu chỉnh lại script cũ bỏ các SendEnd dư ở các version trước đi.
+Giảm tình trạng ăn ma,disconnect
Cải thiện tình trạng bị dính ma khi reply BTQ đối với member cũng như hay bị disconnect của member.

Các hàm, sự kiện:
+Sửa tham số hàm ts.Equipment(slotno)
Trang bị đồ (áo, nón, vk ..) cho nhân vật. Slotno: slot chứa đồ cần trang bị.
+Thêm hàm ts.EquipmentPartner(order,slotno)
Trang bị đồ (áo, nón, vk ..) cho võ tướng. order: thứ tự của võ tướng, Slotno: slot chứa đồ cần trang bị.
+Thêm hàm ts.UnEquipmentPartner(type,order,slotno)
Tháo trang bị của võ tướng, type: loại trang bị: 1-6, order: thứ tự võ tướng, slotno: slot trống để bỏ đồ vào.
+Thêm hàm ts.Sleep()
Hỗ trợ packet đồng ý ngủ ở khách sạn


Software cần thiết:
+ Windows Installer 3.1
+Framework 2.0

Xin vui lòng đừng post bất kì câu hỏi,bình luận nào trong topic này
Đây là phần giới thiệu về bản bot legn@ trong box TSOnline, em xin hỏi mọi người đây là chương trình thuộc hệ lập trình nào, và đây là 1 ví dụ về script trong legn@:
Mã:
var state = "" 
var ghost_count = 0; 
var god_count = 0; 
var hpFraction = 0.9; 
var spFraction = 0.9;
var warp_back = 0;
var flag_stop = 0;
var check = 0;
var turn1 = 0;
var turn2 = 0;
var counter = 0;
var time1 = 0;
var time2 = 0;
var delay1 = 1000;
var delay2 = 500;

//my vars
//Chinh sua o duoi !!!
var mapid1 = 12013;
var mapid2 = 12521;
var warpid1 = 1;
var warpid2 = 5;
var id_chupt = 1111111; // Điền Id của chủ Pt vào đây
var id_ptmem1 = 222222;// Id của các thành viên trong Pt
var id_ptmem2 = 333333;
var id_ptmem3 = 444444;
var id_ptmem4 = 555555;
var id_quansu = *******;// Điền lại Id của Quân sư

function MyAttack(){ 
turn1++;
if (turn1 == 1) {
sk = SkillID("Attack"); // Đặt skill của tướng, thông tin về Id của skill tham khảo thêm

ts.SendAttack( 
ts.Character.Row 
, ts.Character.Col 
, 0 
, 2 
, sk // vị trí đánh của tướng 0 tưong ứng với hàng sau, 2 tương ứng với vị trí đánh, 0,2 tức là hàng sau, vị trí thứ 2 tính từ trái qua phải 
) 
} 
if (turn1 >= 2) {
sk = SkillID("Attack"); 

ts.SendAttack( 
ts.Character.Row 
, ts.Character.Col 
, 0 
, 4
, sk 
) 
} 
}

function MyPartnerAttack(){ 
turn2++;
if (turn2 == 1) {
sk = SkillID("Fire Arrow");

ts.SendAttack( 
ts.CurrentPartner.Row 
, ts.CurrentPartner.Col 
, 0 
, 2 
, sk 
) 
} 
if (turn2 >= 2) {
sk = SkillID("Defend");

ts.SendAttack( 
ts.CurrentPartner.Row 
, ts.CurrentPartner.Col 
, ts.CurrentPartner.Row 
, ts.CurrentPartner.Col 
, sk 
) 
} 
}

function BattleStarted(){ 
check = 0;
turn1 = 0;
turn2 = 0;
warp_back = 0;
flag_stop = 0;
time1 = 0;
time2 = 0;
} 
function BattleStoped(){ 
check = 1;
SaveWarrior(); 
EatHP();
EatSP();
//DoSendItem()
DoDropItem()
time1 = 0;
time2 = 0;
} 

function EatHP(){ 
if (ts.Character.HP < (ts.Character.MAXHP * hpFraction)){ 
doEatHP(0,(ts.Character.MAXHP * hpFraction)-ts.Character.HP) 
} 
if (ts.CurrentPartner.HP < (ts.CurrentPartner.MAXHP * hpFraction)){ 
doEatHP(ts.CurrentPartner.Order,(ts.CurrentPartner .MAXHP * hpFraction)-ts.CurrentPartner.HP) 
} 
} 

function EatSP(){ 
if (ts.Character.SP < (ts.Character.MAXSP * spFraction)){ 
doEatSP(0,(ts.Character.MAXSP * spFraction)-ts.Character.SP) 
} 
if (ts.CurrentPartner.SP < (ts.CurrentPartner.MAXSP * spFraction)){ 
doEatSP(ts.CurrentPartner.Order,(ts.CurrentPartner .MAXSP * spFraction)-ts.CurrentPartner.SP) 
} 
} 

function SaveWarrior(){ 
if(ts.CurrentPartner.HP< 10){ 
frm.mnuEnableReconnect.Checked = false;
ts.Disconect(); 
debug(" Cuu nguoi tren het! Disconnect nha! : ",0x0000FF)
} 
} 


function onEvilGod(){ 
ghost_count++ 
debug("E V I L G O D."+"["+ghost_count+"]",0x0000FF) 
} 

function onLuckyGod(){ 
god_count++;
debug("LUCKY G O D.",0xFF0000) 
if(!QA.Exists(ts.LastQuestion)){ 
QA.Add(ts.LastQuestion,ts.LastResponseAnswer) 
msg = "QA.Add(\""+ts.LastQuestion+"\",\""+ts.LastRespons eAnswer+"\")" 
WriteLog("QA.js",msg) 
} 
} 

function NpcDialogMenu(DialogId){ 
debug("Menu "+DialogId,0x0000FF)
ts.SelectChoice(1);
ts.SendEnd();
} 

function NpcDialog(DialogId) {
debug("Dialog "+DialogId,0x0000FF)
ts.SendEnd() 
}

function FinishAnswerFuckGod(){ 
if (check = 1) { if (ts.Character.mapid==mapid1) {ts.Walk(1522,175);ts.delay(delay1);ts.delay(500); ts.warp(warpid1);};
if ((ts.Character.mapid==mapid2) && (flag_stop == 0)) {ts.Walk(60,1630);ts.delay(delay2);ts.delay(500);t s.warp(warpid2);}
}
if(ghost_count>=2){ 
debug("2 con ma rui! Disconnect thoi!",0x00aaaa) 
ts.Disconect(); 
} 
} 

function doEatHP(order,difHp){ 
for(var i = 1;i<= 25 ;i++){ 
var oSlot = ts.MyItems.Item(i) 
var oItem = ITEMS.Item(oSlot.itemid) 
if (oSlot.itemid == 0){ continue; } 
if(oItem.isHPItem()){ 
if (oItem.itemvalue > difHp){ continue; } 
var eatHpAmt = (difHp - (difHp % oItem.itemvalue)) / oItem.itemvalue 
if (eatHpAmt> 0){ 
if (eatHpAmt > oSlot.num){eatHpAmt = oSlot.num; } 
ts.EatItem(i,eatHpAmt,order) 
debug( "?"+oItem.itemname+" HP "+oItem.itemvalue+"at slot "+i+" decrease "+eatHpAmt+"?" ,0xC08008 ) 
difHp = difHp - eatHpAmt * oItem.itemvalue 
} 
} 
} 
} 

function doEatSP(order,difSp){ 
for(var i = 1;i<= 25 ;i++){ 
var oSlot = ts.MyItems.Item(i) 
var oItem = ITEMS.Item(oSlot.itemid) 
if (oSlot.itemid == 0){ continue; } 
if(oItem.isSPItem()){ 
if (oItem.itemvalue > difSp){ continue; } 
var eatSpAmt = (difSp - (difSp % oItem.itemvalue)) / oItem.itemvalue 
if (eatSpAmt> 0){ 
if (eatSpAmt > oSlot.num){eatSpAmt = oSlot.num; } 
ts.EatItem(i,eatSpAmt,order) 
debug( "?"+oItem.itemname+" SP "+oItem.itemvalue+"at slot "+i+" decrease "+eatSpAmt+"?" ,0xC08008 ) 
difSp = difSp - eatSpAmt * oItem.itemvalue 
} 
} 
} 
} 

function DoDropItem() {
for(var i=1;i<=25;i++){ 
var oSlot = ts.MyItems(i); 
if( oSlot.itemid == 0){ continue; } 
var oItem = ITEMS.Item(oSlot.itemid); 
var itemname = oItem.getName(); 
if( (itemname == "AutoAttackPill" 
|| itemname == "Honey pill" 
|| itemname == "AutoTonicPill" 

|| itemname == "Saltedshoots" 
|| itemname == "ZhuoScroll" 
|| itemname == "HasteScroll")){ 
ts.DropItem(oSlot.slot,oSlot.num); 
}
} 
}
/*function DoSendItem() {
for(var i=1;i<=25;i++){ 
var oSlot = ts.MyItems(i); 
if( oSlot.itemid == 0){ continue; } 
var oItem = ITEMS.Item(oSlot.itemid); 
var itemname = oItem.getName(); 
if( (itemname == "AutoAttackPill" 
|| itemname == "Honey pill" 
|| itemname == "AutoTonicPill" 
|| itemname == "Yellow wine" 
|| itemname == "Saltedshoots" 
|| itemname == "ZhuoScroll" 
|| itemname == "HasteScroll") && oSlot.num ==50){ 
ts.SendItemTo(75909,oSlot.slot,oSlot.num); 
} else { if ((itemname == "Blood tonic" 
|| itemname == "6HerbPotion"
|| oSlot.itemid == 27035
|| itemname == "ZhongYuanDew"
|| itemname == "RefreshPill") && oSlot.num ==50)
{ts.SendItemTo(75909,oSlot.slot,oSlot.num);} 
}
} 
}*/



function Start(){ 
flag_stop = 0;
time1 = 0;
time2 = 0;
if (ts.Character.mapid==mapid1) {ts.Walk(1522,175);ts.delay(delay1);ts.warp(warpid 1);}
if (ts.Character.mapid==mapid2) {ts.Walk(60,1630);ts.delay(delay2);ts.warp(warpid2 );}
} 

function Stop(){ 
flag_stop = 1;
} 

function InitBot(){ 
debug("login okie", 0x00FF00)
ts.Horse();
EatHP();
EatSP();
if (ts.Character.mapid==12012) {flag_stop = 1;ts.warp(2);}
if (ts.Character.mapid==mapid2) {flag_stop = 1;ts.warp(warpid2);}
frm.mnuAutoEat.Checked = false;
frm.mnuEnableReconnect.Checked = true;
Timer.Enabled = true;
} 


function OnTimer(){
counter++;
if (counter == 30) {
ts.AcceptParty(id_ptmem4);
ts.AcceptParty(id_ptmem3);
ts.AcceptParty(id_ptmem2);
ts.AcceptParty(id_ptmem1);
ts.sena(id_quansu);
ts.Warp(warpid1);
}
if (counter==1000) {counter=counter-900};
if (ts.Character.mapid==mapid2) {time1++; if (time1 == 10) {time1 = 0;flag_stop = 0;check = 1;ts.warp(warpid2);}}
if (ts.Character.mapid==mapid1) {time2++; if (time2 == 120) {time2 = 0;flag_stop = 0;check = 1;ts.warp(warpid1);}}
}

function PartyStop( playerid ){ 
if(playerid == id_chupt || playerid == id_ptmem1 || playerid == id_ptmem2 || playerid == id_ptmem3 || playerid == id_ptmem4){
ts.Disconect();
} 
}

function warpFinish(){ 
if ((check == 1) && flag_stop==0) { if (ts.Character.mapid==mapid1) {ts.Walk(1522,175);ts.delay(delay1);ts.warp(warpid 1);};}
if (ts.Character.mapid==mapid2) {ts.Walk(60,1630);ts.delay(delay2);ts.warp(warpid2 );}
if (ts.Character.mapid==10952) {ts.Walk(902,875);ts.delay(1000);ts.delay(1000);ts .warp(1);}
} 


InitBot()
debug("Ti`nh trang hien nay: " + ts.Character.Ghost + " con ma!",0xFF9933)
Ngoài ra còn common nữa, vậy muốn viết script trên legn@ thì phải cần hệ lập trình gì và một số giới thiệu cơ bản về hệ lập trình đó?
Mong mọi người chỉ giáo, thx :hug:
 
Đây là chương trình được viết bằng C# 2.0. Chạy trên nền .NET framework 2.0. Công cụ cần thiết dể dịch chương trình có thể dùng các bản Visual Studio 2005
 
dùng extremem đi giờ ai dùng legn@ nữa đâu
 
Dark_XIII nói:
Đây là chương trình được viết bằng C# 2.0. Chạy trên nền .NET framework 2.0. Công cụ cần thiết dể dịch chương trình có thể dùng các bản Visual Studio 2005
rất cảm ơn bác, vậy bác có thể chỉ cho em muốn lập trình theo C 2.0 thì ta có thể học theo những giáo trình cần thiết nào, thx
 
*Soledad* nói:
rất cảm ơn bác, vậy bác có thể chỉ cho em muốn lập trình theo C 2.0 thì ta có thể học theo những giáo trình cần thiết nào, thx
học C thì giáo trình C chứ giáo trình nào giờ, chẳng nhẽ pascal, ...
 
*Soledad* nói:
rất cảm ơn bác, vậy bác có thể chỉ cho em muốn lập trình theo C 2.0 thì ta có thể học theo những giáo trình cần thiết nào, thx
C# (see sharp) chứ không phải C.
Đầu tiên phải kiếm bộ visual studio 2005 về. Rồi kiếm mấy quyển ebooks C# dễ dễ 1 tí. Xong phần này rồi thì cũng tạm ổn.
Nếu bạn muốn viết bot thì lưu ý thêm phần lập trình sockets.
 
thank you so much! :hug::hug::hug:
 
chưa biết gì mà đòi làm bot à :| , muốn thông thạo cũng lâu đó :|
 
ủa làm thế nào để edit file .exe
bản legna gốc ko có keylog sao mình thấy mấy đứa khác lại nói: nó send cho tao legna có keylog là sao ???
 
Back
Top