IronQueen
Youtube Master Race
- 30/1/05
- 97
- 0
Mã:
var state = ""
var ghost_count = 0;
var god_count = 0;
var die_count = 0;
var pet_die_count = 0;
var battle_count = 0;
var DisconnectFlag = 0.3;
var HealingFlag = 0.5;
var hpFraction = 0.8;
var spFraction = 0.7;
var MyMapID = 15802;
var battle_round;
var myParty = new Array(11111,22222,33333,44444,55555); //ca'c id trong pt
pt_leader = myParty[0]; //id chu pt
pt_sena = myParty[1]; //id quan su
//*****Hàm attack cua nguoi choi*****//
function MyAttack(){
m = SelectF1Target();
// hoac:
// m = findMonster(); (nhu tdck thuo`ng)
battle_round++;
sk = 12003; //skill
ts.SendAttack(
ts.Character.Row
, ts.Character.Col
, m.Row
, m.Col
, sk
);
}
//****Hàm attack cua PET*****//
function MyPartnerAttack(){
m = SelectF1Target();
sk = 10000;
ts.SendAttack(
ts.CurrentPartner.Row
, ts.CurrentPartner.Col
, m.Row
, m.Col
, sk
)
}
//*****Hàm auto sent*****//
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 == "Roborant pill"
|| itemname == "Baohe pill"
|| itemname == "HasteScroll"
|| itemname == "AutoAttackPill"
|| itemname == "Red date"
|| itemname == "Morale pill"
|| itemname == "Honey pill"
|| itemname == "HerbalPill"
|| itemname == "PainKiller"
|| itemname == "AutoTonicPill"
|| itemname == "Small apple"
|| itemname == "Strawberry") && oSlot.num ==50){
ts.SendItemTo("AnhXiKe",oSlot.slot,oSlot.num);
}
}
}
//**********Tu An HP va SP**********//
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 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 ;
}
}
}
}
//**********TRA LOI BTQ**********//
function onEvilGod(){
ghost_count++
debug("E V I L G O D."+"["+ghost_count+"]",0x0000FF)
msg = "Wrong.Add(\""+ts.LastQuestion+"\",\""+ts.LastResponseAnswer+"\")"
WriteLog("Wrong.js",msg)
}
function onLuckyGod(){
debug("LUCKY G O D.",0xFF0000)
if(!QA.Exists(ts.LastQuestion)){
QA.Add(ts.LastQuestion,ts.LastResponseAnswer)
msg = "QA.Add(\""+ts.LastQuestion+"\",\""+ts.LastResponseAnswer+"\")"
WriteLog("QA.js",msg)
}
}
//********** MAIN **********//
//****Hàm hiên trang thái sau tran đánh*****//
function ViewState(){
debug("************************************",0xFF0000)
debug(" Battle Count : " + battle_count ,0xFF0000)
debug(" Dead Count : " + die_count ,0xFF0000)
debug(" Ghost Count : " + ts.Character.Ghost ,0xFF0000)
debug(" Warrior's FAI : " + ts.CurrentPartner.CharName +" : " + ts.CurrentPartner.fai,0xFF0000)
debug("************************************",0xFF0000)
}
//*****Hàm Dis khi HP cua PET het*****//
function SaveWarrior(){
if(ts.CurrentPartner.HP == 1){
ts.Disconect();
debug(" SAVE THE FAI DISCONNECT NOW! : ",0x0000FF);
}
}
//*****Hàm tra loi BTQ xong th? đánh tiep*****//
function FinishAnswerFuckGod(){
if(ghost_count>=3){
ts.Disconect();
}
}
//*****Hàm neu chet 3 lan th? Dis*****//
function CheckDisconnect(){
if(ts.Character.HP == 1){
die_count++
}
if(die_count>3){
ts.Disconect();
}
}
//*****Hàm AuTo party*****//
function PlayerOnline(playerid){
if(getPlayerName(playerid) == "HiepSongGiet" // nick ch? party
){
ts.RequestParty(playerid)
}
}
//*****Hàm BOT*****//
function InitBot(){
debug("my BOT", 0x00FF00)
EatHP();
EatSP();
}
//*****Hàm bat dau tran đánh*****//
function BattleStarted(){
battle_count++;
battle_round=0;
}
//****Hàm khi tran đánh ket thúc*****//
function BattleStoped(){
SaveWarrior();
CheckDisconnect();
DoSendItem();
ViewState();
EatHP();
EatSP();
doEatHP(order,difHp)();
doEatSP(order,difHp)();
PlayerOnline(playerid);
}
//*****Hàm OnTime*****//
function OnTimer(){
if(ts.Character.mapid == 12301){ // Trong Hoàng Cung --> Di ra ngoai
WarpLink(12063 ,2 , 12301 ,1)
}
if(ts.Character.mapid == 12062){ // Out of MAP
WarpLink(12062 ,2 , 12301 ,1)
}
if (ts.CurrentParty == 0) ts.RequestParty(11111);
}
//*****Hàm Start****//
function Start(){
}
//*****Hàm Stop*****//
function Stop(){
}
InitBot()
ai xem giùm mình cái Script này bị gì mà úynh ở hoàng cung diệp thành khoảng 6 trận là dis , ko bít nguyên do vì sao dí luôn
, sữa mọi cách vẫn vậy , pó tay rùi . có gì thấy ko ổn làm ơn cho mình cái Script của nhưng member party ở hoàng cung đó , chỉ cần auto sent , auto Hp và SP , auto parrty , auto login là được rùi . cám ơn nhìu !! 
giờ đổi cái var spFraction = 0.7; thành spFraction = 0.7 hẻ đổi thành 0.4 được ko nhỉ
