PhThanhTai
Mr & Ms Pac-Man
script TruongGiac ne`ban.
PHP:
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;
uint sotrandanh = 0;
byte songuoi = 00;
byte pt1 = 0;
byte pt2 = 0;
byte pt3 = 0;
byte pt4 = 0;
uint mem1 = 0;
uint mem2 = 0;
uint mem3 = 0;
uint quansu = 0;
uint time = 0;
uint mapid1 = 12012;
uint mapid2 = 12011;
byte warpid1 = 1;
byte warpid2 = 11;
byte dem = 0;
bool bagoihon = false;
public override void MyAttack()
{
CharacterInfo MyChar = ts.Character;
ts.SendAttack(MyChar.Row, MyChar.Col, 0, 1, 17001);
}
public override void MyPartnerAttack()
{
CharacterInfo MyWarrior = ts.CurrentPartner;
ts.SendAttack(MyWarrior.Row, MyWarrior.Col, 0, 2, 10000);
}
public override void BattleStarted()
{
time = 0;
ts.SetTimerOnOff(false);
}
public override void BattleStopped()
{
AutoEatFood();
ProcessInventoryAction();
sotrandanh++;
debug("So Tran Danh : " + sotrandanh);
if(ts.Character.ghost != 0)
{
debug("An con ma kia di giai thoi",0xFF0000);
ts.Disconnect();
}
ts.ClickOnNPC(50);
ts.ClickOnNPC(50);
}
public override void doRecvQuestion()
{
time = 0;
ts.SetTimerOnOff(false);
if(bagoihon == true)
{
dem++;
}
}
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);
if(dem == 3)
{
dem = 0;
bagoihon = false;
ts.SendEnd();
}
}
public override void FinishAnswer()
{
Start();
}
public override void NpcDialogMenu(ushort DialogId)
{
debug("Dialog Menu ID="+DialogId.ToString());
if(DialogId==4)
{
ts.SelectChoice(1);
ts.SendEnd();
}
}
public override void NpcDialog(ushort DialogId)
{
debug("Dialog ID="+DialogId.ToString());
if(DialogId==10183)
{
ts.SetTimerOnOff(true);
time = 0;
}
else
{
if(DialogId==10140 || DialogId==12215 || DialogId==12119)
{
ts.SetTimerOnOff(true);
time = 0;
ts.SendEnd();
}
else
{
if(DialogId == 10750)
{
ts.SendEnd();
ts.SendEnd();
ts.Disconnect();
}
else
{
ts.SendEnd();
}
}
}
}
public override void onNPCAppear(ushort npcmapid, int x, int y)
{
}
public override void OnTimer()
{
if(pt1 ==1 && pt2 == 1 && pt3 == 1 && pt4 == 1)
{
time++;
if(time > 3)
{
Start();
time = 0;
ts.SetTimerOnOff(false);
}
}
else
{
if (pt1 == 0) {ts.AcceptParty(mem1);}
if (pt2 == 0) {ts.AcceptParty(mem2);}
if (pt3 == 0) {ts.AcceptParty(mem3);}
if (pt4 == 0) {ts.AcceptParty(quansu);}
}
}
public override void warpFinish()
{
if(ts.Character.ghost == 0)
{
ts.Walk(342,255);
CheckMem();
}
else
{
TuDongGiaiMa();
}
}
void CheckMem(){
if(songuoi==4){
ts.ClickOnNPC(50);
}
else
{
debug("So thanh vien chua du ko the danh dc",0xFF0000);
}
}
public override void RequestPartyAcceptFrom(uint PlayerId)
{
}
public override void PartyStop(uint PlayerId)
{
if(PlayerId == mem1 || PlayerId == mem2 || PlayerId == mem3 || PlayerId == quansu)
{
debug(PlayerId + " da roi khoi party");
time = 0;
ts.SetTimerOnOff(false);
ts.Disconnect();
}
}
public override void AcceptedParty(uint playerid)
{
if (playerid == mem1)
{
debug(playerid + " gia nhap doi ngu");
songuoi++;
pt1 = 1;
}
if (playerid == mem2)
{
debug(playerid + " gia nhap doi ngu");
songuoi++;
pt2 = 1;
}
if (playerid == mem3)
{
debug(playerid + " gia nhap doi ngu");
songuoi++;
pt3 = 1;
}
if (playerid == quansu)
{
debug(playerid + " gia nhap doi ngu");
songuoi++;
pt4 = 1;
ts.Sena(quansu);
debug(playerid + " lam quan su");
}
if (pt1 == 1 && pt2 == 1 && pt3 == 1 && pt4 == 1)
{
ts.SetTimerOnOff(false);
debug("Doi ngu da day",0xFF0000);
Start();
}
}
public override void Start()
{
CheckMem();
}
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);
}
}
public override void onPlayerWalk(uint uid, ushort x, ushort y)
{
}
public override void PlayerOnline(uint uid,ushort mapid)
{
if(uid>101 && uid<10000)
{
debug("Game Master Online");
ts.Disconnect();
}
}
public override void InitBot()
{
ts.SetReconnectTime(1);
if(ts.Character.ghost != 0)
{
TuDongGiaiMa();
}
else
{
ts.SetTimerOnOff(true);
if(ts.Character.mapid == mapid2)
{
ts.Warp(warpid2);
}
}
}
void TuDongGiaiMa()
{
if(ts.Character.ghost != 0)
{
if (ts.Character.mapid == mapid1)
{
ts.Warp(warpid1);
}
else
{
if (ts.Character.mapid == mapid2)
{
ts.Walk(382,355);
bagoihon = true;
ts.ClickOnNPC(9);
}
}
}
}