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;
double TimeSale = 0;
byte DisconFai = 00; // Faith of warrior to disconnect
byte battle_count = 0;
byte myturn = 0;
byte peturn = 0;
/***** Chinh sua ID chu Party o day *****/
uint uidchupt = 75740;
/*************************************/
/*********************** My Attack *************************/
public override void MyAttack()
{
myturn++;
if (myturn == 1)
{
CharacterInfo MyChar = ts.Character;
//NPCCombatObject Monster = findMonster();
ts.SendAttack(MyChar.Row, MyChar.Col, 0, 4, 13002);
}
if (myturn >=2)
{
CharacterInfo MyChar = ts.Character;
//NPCCombatObject Monster = findMonster();
ts.SendAttack(MyChar.Row, MyChar.Col, 0, 4, 17001);
}
}
/******************* My Partner Attack *********************/
public override void MyPartnerAttack()
{
peturn++;
if (peturn == 1)
{
CharacterInfo MyWarrior = ts.CurrentPartner;
//NPCCombatObject Monster = findMonster();
ts.SendAttack(MyWarrior.Row, MyWarrior.Col, 0, 2, 10000);
}
if (peturn >= 2)
{
CharacterInfo MyWarrior = ts.CurrentPartner;
//NPCCombatObject Monster = findMonster();
ts.SendAttack(MyWarrior.Row, MyWarrior.Col, 0, 4, 10000);
}
}
/********************* Battle Started **********************/
public override void BattleStarted()
{
battle_count++;
myturn = 0;
peturn = 0;
}
/********************* Battle Stoped ***********************/
public override void BattleStopped()
{
AutoEatFood();
ProcessInventoryAction();
CheckDisconnect();
ViewState();
}
/******************* Receive Question *********************/
public override void doRecvQuestion()
{
}
/******************** 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);
}
/************************ On Timer *************************/
public override void OnTimer()
{
TimeSale++;
if (TimeSale % 200 == 0)
{
FindItemSale (46027, 50);
FindItemSale (26168, 50);
FindItemSale (46016, 50);
FindItemSale (46027, 50);
FindItemSale (26082, 50);
FindItemSale (48005, 50);
FindItemSale (46013, 50);
}
}
public override void NpcDialog(ushort DialogId)
{
debug("Dialog ID = "+ DialogId.ToString());
ts.SendEnd();
}
public override void NpcDialogMenu(ushort DialogId)
{
debug("Dialog Menu ID = "+ DialogId.ToString());
ts.SelectChoice(2);
ts.SendEnd();
}
/************************* Start ***************************/
public override void Start()
{
debug("Request Party ..........");
ts.RequestParty(uidchupt);
}
/************************** Stop ***************************/
public override void Stop()
{
for(byte i=0;i<25;i++){
Slot oSlot = (Slot)ts.MyItems[i];
Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()];
if(oSlot.itemid == 0){ continue; }
debug(oItem.itemname + " at slot " + oSlot.slot.ToString() + " with ID " + oSlot.itemid.ToString(),0);
}
}
/********************** Player Online **********************/
public override void PlayerOnline(uint uid,ushort mapid)
{
if (uid == uidchupt) {debug(uidchupt + " Is Now Online, RequestParty ......");ts.delay(500);ts.RequestParty(uidchupt);}
}
/*********************** Party Stop ************************/
public override void PartyStop(uint uid)
{
if (uid == uidchupt) {debug("Dis by "+playerid+" dis");ts.Disconnect();}
}
/************************ Init Bot *************************/
public override void InitBot()
{
ts.SetTimerOnOff(true);
ts.ClickOnNPC(2);
AddDropItemList("Măng khô");
AddDropItemList("Thuốc Bổ Huyết ");
AddDropItemList("tựđ uốngthuốc");
AddDropItemList("viên công kích");
AddDropItemList("ThuốcNhấtĐiểm");
AutoEatFood();
Stop();
{debug("Login Okie, Request Party .......");ts.delay(500);ts.RequestParty(uidchupt);}
}