double DisconnectFlag = 0.3; // Disconnect when current HP is below 30%
double hpFractionEat = 0.9; //Eat HP when current HP<= 80%
double spFractionEat = 0.8;
double hpFraction = 1.0; //Eat until current HP >= 95 %
double spFraction = 0.95;
byte DisconFai = 00; // Faith of warrior to disconnect
byte battle_count = 0;
byte NS_count = 0;
byte party = 0;
int time = 0;
int nhanQ = 0;
uint A = 0;
/***** Chinh sua ID chu Party o day *****/
uint idchupt1 = 2435787;
uint idchupt2 = 2435847;
uint idchupt3 = 2435858;
uint idchupt4 = 2435872;
uint idchupt5 = 2435887;
uint idchupt6 = 2435945;
/*************************************/
/*********************** My Attack *************************/
public override void MyAttack()
{
CharacterInfo MyChar = ts.Character;
ts.SendAttack(MyChar.Row, MyChar.Col, 0, 2, 17001);
}
/******************* My Partner Attack *********************/
public override void MyPartnerAttack()
{
CharacterInfo MyWarrior = ts.CurrentPartner;
ts.SendAttack(MyWarrior.Row, MyWarrior.Col, 0, 2, 10000);
}
/********************* Battle Started **********************/
public override void BattleStarted()
{
battle_count++;
time = 0;
}
/********************* Battle Stoped ***********************/
public override void BattleStopped()
{
AutoEatFood();
ProcessInventoryAction();
time = 0;
}
/********************* Nhan Quest ***********************/
void NhanQuest()
{
if (ts.Character.mapid == 18021 && nhanQ == 0) {
ts.delay(500);
ts.Walk(462,675);
ts.ClickOnNPC(4);
}
}
/******************* Receive Question *********************/
public override void doRecvQuestion()
{
NS_count++;
}
/******************** Response Answer **********************/
public override void ResponseAnswer()
{
string tmp=ts.LastQuestion.Replace("=?","");
int ans=ts.Eval(tmp);
byte ans_index=Convert.ToByte(ts.LastAnswers[ans.ToString()]);
ts.Answer(ans_index);
}
/******************** NPC Dialog Menu **********************/
public override void NpcDialogMenu(ushort DialogId)
{
debug("Dialog Menu ID = "+DialogId.ToString());
if (DialogId == 4) {ts.SelectChoice(1);ts.SendEnd();}
}
/********************* NPC Dialog ID ***********************/
public override void NpcDialog(ushort DialogId)
{
debug("Dialog ID = "+DialogId.ToString());
if(DialogId==13952) {ts.SendEnd();}
if(DialogId==13953) {ts.SendEnd();}
if(DialogId==13954) {ts.SendEnd();}
if(DialogId==13955) {ts.SendEnd();}
if(DialogId==14523) {ts.SendEnd();nhanQ = 1;ts.ClickOnNPC(100);}
if(DialogId==13956) {ts.SendEnd();nhanQ = 1;ts.ClickOnNPC(100);ts.RequestParty(A);}
if(DialogId==13957) {ts.SendEnd();nhanQ = 1;ts.ClickOnNPC(100);ts.RequestParty(A);}
}
/************************ On Timer *************************/
public override void OnTimer()
{
time++;
}
/************************* Start ***************************/
public override void Start()
{
ts.RequestParty(A);
}
/************************** Stop ***************************/
public override void Stop()
{
debug("************************************************** **********************",255) ;
debug(" Số trận đánh : " + battle_count ,255) ;
debug(" HP của "+ts.Character.CharName+" = " + ts.Character.HP +" "+ "/" +" "+ ts.Character.MAXHP,255);
debug(" HP của "+ts.CurrentPartner.CharName +" = " + ts.CurrentPartner.HP + " "+"/" +" "+ ts.CurrentPartner.MAXHP +" "+" FAI = " + ts.CurrentPartner.fai,255);
debug(" Số con ma : " + ts.Character.ghost ,255) ;
}
/************************** Player Online ***************************/
public override void PlayerOnline(uint playerid,ushort mapid)
{
if (playerid == idchupt1 ||playerid == idchupt2 ||playerid == idchupt3 ||playerid == idchupt4 ||playerid == idchupt5 ||playerid == idchupt6 && nhanQ == 0 && ts.Character.mapid != 18021) {debug("ChuPT Online, Request Party .......");party = 1;ts.RequestParty(playerid);A = playerid;}
}
/*********************** Party Stop ************************/
public override void PartyStop(uint playerid)
{
if (playerid == idchupt1 ||playerid == idchupt2 ||playerid == idchupt3 ||playerid == idchupt4 ||playerid == idchupt5 ||playerid == idchupt6) {NhanQuest();}
}
/********************* Fishish Answer **********************/
public override void FinishAnswer()
{
ts.delay(100);
NhanQuest();
}
/********************** Warp Finished **********************/
public override void warpFinish()
{
NhanQuest();
}
/************************ Init Bot *************************/
public override void InitBot()
{
NhanQuest();
AutoEatFood();
ts.SetReconnectTime(1);
ts.SetMaxIdleTime(15);
ts.SetTimerOnOff(true);
Stop();
time = 0;
ts.RequestParty(A);
}