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
string state="";
byte turna = 0;
byte turnb = 0;
byte pt1 = 0;
byte pt2 = 0;
byte pt3 = 0;
byte counter = 0;
uint idmem1 = 1689218;
uint idmem2 = 2180353;
uint idmem3_sena = 2180109;
public override void MyAttack()
{
turna++;
if (turna == 1)
{
CharacterInfo MyChar = ts.Character;
//NPCCombatObject Monster = findMonster();
ts.SendAttack(MyChar.Row, MyChar.Col, 0, 2, 10000);
}
if (turnb >=2)
{
CharacterInfo MyChar = ts.Character;
//NPCCombatObject Monster = findMonster();
ts.SendAttack(MyChar.Row, MyChar.Col, 0, 2, 10000);
}
}
public override void BattleStarted()
{
turnb=0;
turna=0;
}
public override void BattleStoped()
{
ProcessInventoryAction();
AutoEatFood();
ts.SetTimerOnOff(false);
ts.ClickOnNPC(1);
Start();
}
public override void doRecvQuestion()
{
state="BTQ";
}
public override void ResponseAnswer()
{
int dtime=get_random(1,5);
debug("Delay "+dtime.ToString()+" before answer.");
ts.delay(dtime*1000);
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);
}
public override void onPlayerWalk(uint uid, ushort x, ushort y)
{
if (uid > 1 && uid < 501) {
debug("GM den roi chay thoi",0xFF0000);
ts.Disconnect(false);
}
}
public override void PartyStop(uint playerid)
{
if (playerid == idmem1) {debug("Dis by "+playerid+" dis");ts.Disconnect();}
if (playerid == idmem2) {debug("Dis by "+playerid+" dis");ts.Disconnect();}
if (playerid == idmem3_sena) {debug("Dis by "+playerid+" dis");ts.Disconnect();}
}
public override void Start()
{
ts.ClickOnNPC(1);
}
public override void FinishAnswer()
{
Start();
}
public override void NpcDialogMenu(ushort DialogId)
{
debug("Menu ID="+DialogId.ToString());
if (DialogId==5) {ts.SelectChoice(1); ts.SendEnd(); }
else {ts.SendEnd();}
}
public override void NpcDialog(ushort DialogId)
{
debug("Dialog ID="+DialogId.ToString());
if (DialogId==10152) {ts.SendEnd();}
else
if (DialogId==15657) {ts.SendEnd();ts.ClickOnNPC(1);}
}
public override void OnTimer()
{
ts.AcceptParty(idmem1);
ts.AcceptParty(idmem2);
ts.AcceptParty(idmem3_sena);
ts.Sena(idmem3_sena);
counter++;
if (counter == 5){
Start();
}
}
public override void InitBot()
{
ts.SetTimerOnOff(true);
ts.SetReconnectTime(1);
ts.SetMaxIdleTime(20);
debug(" Số con ma : " + ts.Character.ghost ,0xFF0000) ;
}