double DisconnectFlag = 0.3; // Disconnect when current HP is below 30%
double hpFractionEat = 0.8; //Eat HP when current HP<= 80%
double spFractionEat = 0.8;
double hpFraction = 0.95; //Eat until current HP >= 95 %
double spFraction = 0.95;
byte DisconFai = 00; // Faith of warrior to disconnect
byte step = 0;byte nextstep=0;
byte next = 0;
uint ID = 2418641;
public override void MyAttack()
{
CharacterInfo MyChar = ts.Character;
if(step == 3) ts.SendAttack(MyChar.Row, MyChar.Col, 0, 2, 17001); else ts.Disconnect();
}
public override void MyPartnerAttack()
{
CharacterInfo MyWarrior = ts.CurrentPartner;
ts.SendAttack(MyWarrior.Row, MyWarrior.Col, 0, 2, 17001);
}
public override void BattleStarted()
{
next=0;
}
public override void BattleStopped()
{
ts.StopParty();
}
string state="";
byte ghost = 0;
public override void doRecvQuestion()
{
state="BTQ";
ghost++;
}
public override void ResponseAnswer()
{
string tmp=ts.LastQuestion.Replace("=?","");
int ans=ts.Eval(tmp);
byte ans_index=Convert.ToByte(ts.LastAnswers[ans.ToString()]);
debug("Answer choice:"+ans_index.ToString());
ts.Answer(ans_index);
if (ghost == 3){ts.SendEnd();}
}
public override void Start()
{
}
public override void Stop()
{
ts.Chat(1,"Disconnect1234");
ts.Chat(1,"*");
}
public override void NpcDialogMenu(ushort DialogId)
{
debug("Menu ID = "+DialogId.ToString());
ts.SelectChoice(1);
ts.SendEnd();
}
public override void NpcDialog(ushort DialogId)
{
debug("dialog menu ID = "+DialogId.ToString());
if(DialogId==10476||DialogId==10456){ts.SendEnd();ts.delay(200);step =1;debug(" Step " + step.ToString() ,0xFF0000) ; nextstep=1;}
if(DialogId==16355||DialogId==16369){ts.SendEnd();ts.SendEnd();}
if(DialogId==16378){ts.SendEnd();ts.delay(200);step =2;debug(" Step " + step.ToString() ,0xFF0000) ; nextstep=1;}
if(DialogId==16381){ts.SendEnd();ts.StopParty();ts.delay(200);step =4;debug(" Step " + step.ToString() ,0xFF0000) ; nextstep=1;}
if(DialogId==16379){ts.SendEnd();ts.delay(200);step =5;debug(" Step " + step.ToString() ,0xFF0000) ; nextstep=1;}
else {ts.SendEnd();}
}
public override void warpFinish()
{
DiGiaiMa();
}
void DropItem(){
for(byte ii=0;ii<25;ii++){
Slot oSlot = (Slot)ts.MyItems[ii];
Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()];
if(oSlot.itemid == 0){ return; }
debug("Drop" + " at " + oSlot.slot.ToString() + " with " + oSlot.itemid.ToString(),0xC08008);
ts.DropItem(oSlot.slot,oSlot.num);
}
}
void DiGiaiMa(){
if (ts.Character.mapid >= 10800 && ts.Character.mapid <= 10820 && step == 0) {ts.Walk(1287,764);ts.delay(200);ts.ClickOnNPC(4);}
if (ts.Character.mapid >= 10850 && ts.Character.mapid <= 10870 && step == 0) {ts.Walk(1222,255);ts.delay(200);ts.ClickOnNPC(2);}
if (ts.Character.mapid >= 10850 && ts.Character.mapid <= 10870 && step == 1) {ts.Chat(ID.ToString(),mem);DropItem();ts.delay(200);ts.Warp(2);}
if (ts.Character.mapid == 12003 && step == 1) {DropItem();ts.Warp(1); }
if (ts.Character.mapid == 12002 && step == 1) {DropItem();ts.Warp(3); }
if (ts.Character.mapid == 12304 && step == 1) {ts.ClickOnNPC(4);}
if (ts.Character.mapid == 12304 && step == 2) {ts.Warp(1);}
if (ts.Character.mapid == 12002 && step == 2) {ts.Warp(2); }
if (ts.Character.mapid == 12001 && step == 2) {ts.Warp(1); }
if (ts.Character.mapid == 12000 && step == 2) {ts.Warp(22); }
if (ts.Character.mapid == 12801 && step == 2) {ts.Warp(2); }
if (ts.Character.mapid == 12804 && step == 2) {ts.Warp(2); }
if (ts.Character.mapid == 12805 && step == 2) {ts.Walk(642,215);ts.delay(200);}
if (ts.Character.mapid == 12805 && step == 3) {ts.Walk(1342,315);ts.delay(200);ts.ClickOnNPC(11);}
if (ts.Character.mapid == 12805 && step == 4) {ts.Warp(1);}
if (ts.Character.mapid == 12804 && step == 4) {ts.Warp(1); }
if (ts.Character.mapid == 12801 && step == 4) {ts.Warp(1); }
if (ts.Character.mapid == 12000 && step == 4) {ts.Warp(12); }
if (ts.Character.mapid == 12001 && step == 4) {ts.Warp(12); }
if (ts.Character.mapid == 12002 && step == 4) {ts.Warp(3); }
if (ts.Character.mapid == 12304 && step == 4) {ts.ClickOnNPC(4);}
if (ts.Character.mapid == 12304 && step == 5) {ts.Warp(1); }
if (ts.Character.mapid == 12002 && step == 5) {ts.Warp(2); }
if (ts.Character.mapid == 12001 && step == 5) {ts.Warp(3); }
if (ts.Character.mapid == 12802 && step == 5) {ts.Warp(2); }
if (ts.Character.mapid == 12803 && step == 5) {DropItem();ts.delay(200);Stop();}
}
public override void OnTimer(){
if(nextstep==1) {ts.delay(400);DiGiaiMa();nextstep=0;}
// next++;
// debug(" Next " + next.ToString() ,0xFF0000) ;
// if (next>Lagdelay && ts.Character.mapid != 12805) {next=1;Stop();}
// if (next>HPdelay && ts.Character.HP < 50) {next=1;Stop();}
// if (next>Nothingdelay) {next=1;Stop();}
}
public override void RequestPartyAcceptFrom(uint PlayerId){
if(PlayerId==mem){ts.AcceptParty(PlayerId);ts.delay(300);step =3;debug(" Step " + step.ToString() ,0xFF0000) ; nextstep=1;}
}
public override void InitBot()
{
ts.SetTimerOnOff(true);
step = 0;
next=0;
nextstep=0;
debug(" Step " + step.ToString() ,0xFF0000) ;
DiGiaiMa();
ts.SetReconnectTime(1);
ts.SetMaxIdleTime(20);
}