cai' member thi` de~ rui` cai chu pt moi' kho em co cai scipit nay` chua test muon hoi may bac pro xem cai nay` duoc. chua vay. thx cac pac var state = ""; var ghost_count = 0; var DisconnectFlag = 0.9; var isAutoRegenOK = 0; var turn = 0; var petTurn = 0; var hpFraction = 0.8; var mySk = 10000; var petSk = 10000; var battle_count = 0; ts.Character.MAXSP = 176; ts.Character.MAXHP = 573; ts.CurrentPartner.MAXSP = 327; ts.CurrentPartner.MAXHP = 300; var id1 = ; var id2 = ; var id3 = ; var id4 = ; var pt1 = 0; var pt2 = 0; var pt3 = 0; var pt4 = 0; function InitBot() { Timer.Enabled = true; debug("Jerry is now OL" , 0x00FF00 ); EatHP(); EatSP(); } function NpcDialogMenu(DialogId) { debug(DialogId,0x0000FF) if(DialogId ==1 ) { ts.SelectChoice(1); ts.SendEnd(); } } function NpcDialog(DialogId) { debug(DialogId,0x0000FF) if(DialogId==14305) { ts.SendEnd(); } if(DialogId==19819) { ts.SendEnd(); } if(DialogId==19821) { ts.SendEnd(); } if(DialogId==19822) { ts.SendEnd(); } } function AcceptedParty(playerid) { if (playerid == id1) { ts.AcceptParty(playerid); pt1 = 1; } if (playerid == id2) { ts.AcceptParty(playerid); pt2 = 1; } if (playerid == id3) { ts.AcceptParty(playerid); pt3 = 1; } if (playerid == id4) { ts.AcceptParty(playerid); pt4 = 1; } if (playerid == id4) { ts.sena(playerid); //set Sena } if (pt1 == 1 && pt2 == 1 && pt3 == 1 && pt4 ==1) { debug("Party Full",0x00ff00); Start(); } } function PartyStop( playerid ) { if(playerid == id1 || playerid == id2 || playerid == id3 || playerid == id4) { debug("Dis by " + playerid + " dis",0xFF0000) ts.Disconect(); } } function MyAttack() { ts.delay(300); turn++; if (turn == 1) { sk=12003; ts.SendAttack(ts.Character.Row, ts.Character.Col, 0, 2, Sk) ; } if (turn >= 2) { ts.SendAttack(ts.Character.Row , ts.Character.Col , 0, 3, Sk); } } function MyPartnerAttack() { ts.delay(400); petTurn++; n = MonsterAlive() if ( n >= 5 ) { sk=10000; ts.SendAttack(ts.CurrentPartner.Row, ts.CurrentPartner.Col, 0, 2, sk); } if ( n < 5 ) { if (petTurn == 1) { ts.SendAttack(ts.CurrentPartner.Row, ts.CurrentPartner.Col, 0, 2, Sk); } if (petTurn >= 2) { ts.SendAttack(ts.CurrentPartner.Row , ts.CurrentPartner.Col , 0, 3, Sk); } } } function Start() { ts.walk(582,315); if(ts.Character.mapid==12063) { ts.delay(1000); ts.Warp(2) return } } function BattleStarted() { battle_count++; turn = 0; petTurn = 0; } function BattleStoped() { ts.delay(1000) if (battle_count == 2) { ts.walk(582,375); ts.delay(1000); start(); } } function onEvilGod() { debug("E V I L G O D."+"["+ghost_count+"]",0x0000FF) msg = "Wrong.Add(\""+ts.LastQuestion+"\",\""+ts.LastResponseAnswer+"\")" } function onLuckyGod() { debug("LUCKY G O D.",0xFF0000) if(!QA.Exists(ts.LastQuestion)) { ts.delay(6000); QA.Add(ts.LastQuestion,ts.LastResponseAnswer) msg = "QA.Add(\""+ts.LastQuestion+"\",\""+ts.LastResponseAnswer+"\")" } ts.delay(5000); } function OnTimer() { } function FinishAnswerFuckGod() { if(ghost_count>=2) { debug("Dis by Ghost",0xFF0000) ts.Disconect(); } } function CheckDisconnect() { if(ts.Character.HP < 20|| ts.CurrentPartner.HP < 20 ) { debug("Dis by lost HP",0xFF0000) ts.Disconect() } } function onAnswerWrong(q,a) { } function OnChat(PlayerName , Msg) { } 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 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) } } InitBot() ClearLog("Wrong.js")