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

Thảo luận trong 'Lập trình & Đồ hoạ' bắt đầu bởi *Soledad*, 31/7/06.

  1. *Soledad*

    *Soledad* Youtube Master Race

    Tham gia ngày:
    23/7/06
    Bài viết:
    68
    Đâ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:
     
  2. Dark_XIII

    Dark_XIII T.E.T.Я.I.S

    Tham gia ngày:
    17/4/03
    Bài viết:
    688
    Đâ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
     
  3. xXNorthFaceXx

    xXNorthFaceXx Youtube Master Race

    Tham gia ngày:
    25/4/06
    Bài viết:
    62
    Nơi ở:
    rừng
    dùng extremem đi giờ ai dùng legn@ nữa đâu
     
  4. *Soledad*

    *Soledad* Youtube Master Race

    Tham gia ngày:
    23/7/06
    Bài viết:
    68
    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
     
  5. Nhiu 1 chục

    Nhiu 1 chục Mr & Ms Pac-Man

    Tham gia ngày:
    3/4/06
    Bài viết:
    217
    Nơi ở:
    -= Đặc khu KP7 =-
    học C thì giáo trình C chứ giáo trình nào giờ, chẳng nhẽ pascal, ...
     
  6. Dark_XIII

    Dark_XIII T.E.T.Я.I.S

    Tham gia ngày:
    17/4/03
    Bài viết:
    688
    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.
     
  7. *Soledad*

    *Soledad* Youtube Master Race

    Tham gia ngày:
    23/7/06
    Bài viết:
    68
    thank you so much! :hug::hug::hug:
     
  8. satthugiaumat1986

    satthugiaumat1986 C O N T R A

    Tham gia ngày:
    25/9/02
    Bài viết:
    1,506
    Nơi ở:
    The Hell
    chưa biết gì mà đòi làm bot à :| , muốn thông thạo cũng lâu đó :|
     
  9. yulgang

    yulgang Youtube Master Race

    Tham gia ngày:
    9/8/06
    Bài viết:
    32
    ủ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 ???
     

Chia sẻ trang này