Sript: 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 = 40; uint sotrandanh = 0; byte songuoi = 00; byte pt1 = 0; byte pt2 = 0; byte pt3 = 0; byte pt4 = 0; byte bg=0; byte npcid = 1; byte temp = 0; // giai doan lam Q uint mem1 =; uint mem2 =; uint mem3 =; uint quansu =; public override void Disconnected() { pt1=0; pt2=0; pt3=0; pt4=0; } public override void MyAttack() { CharacterInfo MyChar = ts.Character; ts.SendAttack(MyChar.Row, MyChar.Col, 0, 2, 13007); } public override void BattleStarted() { } public override void BattleStopped() { AutoEatFood(); ProcessInventoryAction(); sotrandanh++; debug("So Tran Danh : " + sotrandanh); } public override void doRecvQuestion() { } 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); } public override void FinishAnswer() { Start(); } public override void TradeWarriorDialog(uint playerid){ debug(playerid + " muốn trade võ tướng với bạn"); debug("legna://ts.AcceptTradeWarrior(); -> Đồng ý trade võ tướng"); debug("legna://ts.TradeWarrior(playerid,thứ tự); -> Trade võ tướng 1,2,3,4 cho " + playerid); debug("Ví dụ: legna://ts.TradeWarrior(playerid,1); -> Trade võ tướng ở vị trí 1 cho " + playerid); } public override void TradeItemDialog(uint playerid){ debug(playerid + " muốn trade item với bạn"); debug("legna://ts.AcceptTradeItem(); -> Đồng ý trade Item"); debug("legna://ts.TradeItem(playerid,slot,num); -> Trade item ở slot ... số lượng ... cho " + playerid); debug("Ví dụ: legna://ts.TradeItem(playerid,3,50); -> Trade item ở slot 3 số lượng 50 cho " + playerid); } public override void NpcDialogMenu(ushort DialogId) { debug("Dialog Menu ID="+DialogId.ToString()); ts.SelectChoice(1); ts.SendEnd(); } public override void NpcDialog(ushort DialogId) { debug("Dialog ID="+DialogId.ToString()); if(DialogId == 12087){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=0;ph();} else if(DialogId == 25389){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=1;ph();} else if(DialogId == 25399){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=2;ph();} else if(DialogId == 10102){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=3;ph();} else if(DialogId == 25408){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=4;ph();} else if(DialogId == 25411){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=5;ph();} else if(DialogId == 25413){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=6;ph();} else if(DialogId == 19701){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=7;ph();} else if(DialogId == 19705){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=8;ph();} else if(DialogId == 19714){ts.SendEnd();ts.delay(3000);ts.SendEnd();temp=9;ph();} else{ts.SendEnd();} } public override void onNPCAppear(ushort npcmapid, int x, int y) { } public override void OnTimer() { } void ph(){ if(ts.Character.mapid == 12831 && temp ==0){ts.Warp(1);} else if(ts.Character.mapid == 12000 && temp ==0){ts.Warp(30);} else if(ts.Character.mapid == 11000 && temp ==0){ts.Warp(8);} else if(ts.Character.mapid == 15507 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 15517 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 15506 && temp ==0){ts.Warp(3);} else if(ts.Character.mapid == 15516 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 15508 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 15518 && temp ==0){ts.Warp(3);} else if(ts.Character.mapid == 15510 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 15000 && temp ==0){ts.Warp(4);} else if(ts.Character.mapid == 15401 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 15402 && temp ==0){ts.Warp(1);} else if(ts.Character.mapid == 13000 && temp ==0){ts.Warp(27);} else if(ts.Character.mapid == 21501 && temp ==0){ts.Warp(1);} else if(ts.Character.mapid == 21502 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 21503 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 21504 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 21505 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 21000 && temp ==0){ts.Warp(33);} else if(ts.Character.mapid == 25000 && temp ==0){ts.Warp(28);} else if(ts.Character.mapid == 25451 && temp ==0){ts.Warp(1);} else if(ts.Character.mapid == 25452 && temp ==0){ts.Warp(3);} else if(ts.Character.mapid == 25021 && temp ==0){ts.Warp(2);} else if(ts.Character.mapid == 25022 && temp ==0){ts.Warp(4);} else if(ts.Character.mapid == 25243 && temp ==0){ts.Walk(602,535);ts.delay(1000);ts.ClickOnNPC(2);} else if(ts.Character.mapid == 25243 && temp ==1){ts.Warp(1);} else if(ts.Character.mapid == 25022 && temp ==1){ts.Warp(1);} else if(ts.Character.mapid == 25021 && temp ==1){ts.Walk(262,615);ts.delay(1000);ts.ClickOnNPC(3);} else if(ts.Character.mapid == 25021 && temp ==2){ts.Warp(2);} else if(ts.Character.mapid == 25022 && temp ==2){ts.Warp(5);} else if(ts.Character.mapid == 25282 && temp ==2){ts.Walk(522,395);ts.delay(1000);ts.ClickOnNPC(2);} else if(ts.Character.mapid == 25282 && temp ==3){ts.Warp(1);} else if(ts.Character.mapid == 25022 && temp ==3){ts.Warp(1);} else if(ts.Character.mapid == 25021 && temp ==3){ts.Warp(1);} else if(ts.Character.mapid == 25452 && temp ==3){ts.Warp(1);} else if(ts.Character.mapid == 25451 && temp ==3){ts.Warp(2);} else if(ts.Character.mapid == 25000 && temp ==3){ts.Warp(25);} else if(ts.Character.mapid == 25041 && temp ==3){ts.Warp(1);} else if(ts.Character.mapid == 25042 && temp ==3){ts.Walk(642,735);ts.delay(1000);ts.Walk(262,775);ts.delay(1000);ts.ClickOnNPC(3);} else if(ts.Character.mapid == 25042 && temp ==4){ts.Warp(1);} else if(ts.Character.mapid == 25041 && temp ==4){ts.Warp(2);} else if(ts.Character.mapid == 25000 && temp ==4){ts.Warp(28);} else if(ts.Character.mapid == 25451 && temp ==4){ts.Warp(1);} else if(ts.Character.mapid == 25452 && temp ==4){ts.Warp(3);} else if(ts.Character.mapid == 25021 && temp ==4){ts.Warp(2);} else if(ts.Character.mapid == 25022 && temp ==4){ts.Warp(5);} else if(ts.Character.mapid == 25282 && temp ==4){ts.Walk(522,395);ts.delay(1000);ts.ClickOnNPC(2);} else if(ts.Character.mapid == 25282 && temp ==5){ts.Warp(1);} else if(ts.Character.mapid == 25022 && temp ==5){ts.Warp(4);} else if(ts.Character.mapid == 25243 && temp ==5){ts.Walk(602,535);ts.delay(1000);ts.ClickOnNPC(2);} else if(ts.Character.mapid == 25243 && temp ==6){ts.Warp(1);} else if(ts.Character.mapid == 25022 && temp ==6){ts.Warp(1);} else if(ts.Character.mapid == 25021 && temp ==6){ts.Warp(1);} else if(ts.Character.mapid == 25452 && temp ==6){ts.Warp(1);} else if(ts.Character.mapid == 25451 && temp ==6){ts.Warp(2);} else if(ts.Character.mapid == 25000 && temp ==6){ts.Warp(19);} else if(ts.Character.mapid == 25851 && temp ==6){ts.Warp(1);} else if(ts.Character.mapid == 25051 && temp ==6){ts.Walk(862,635);ts.delay(1000);ts.Walk(462,435);ts.delay(1000);ts.Walk(142,435);ts.delay(1000);ts.ClickOnNPC(7);} else if(ts.Character.mapid == 25051 && temp ==7){ts.Warp(5);} else if(ts.Character.mapid == 25108 && temp ==7){ts.Walk(482,375);ts.delay(1000);ts.ClickOnNPC(1);} else if(ts.Character.mapid == 25108 && temp ==8){ts.Warp(1);} else if(ts.Character.mapid == 25051 && temp ==8){ts.Warp(1);} else if(ts.Character.mapid == 25851 && temp ==8){ts.Warp(2);} else if(ts.Character.mapid == 25000 && temp ==8){ts.Warp(24);} else if(ts.Character.mapid == 25531 && temp ==8){ts.Warp(1);} else if(ts.Character.mapid == 25532 && temp ==8){ts.Warp(2);} else if(ts.Character.mapid == 25534 && temp ==8){ts.Warp(1);} else if(ts.Character.mapid == 25535 && temp ==8){ts.Warp(3);} else if(ts.Character.mapid == 25536 && temp ==8){ts.Warp(3);} else if(ts.Character.mapid == 25539 && temp ==8){ts.Warp(1);} else if(ts.Character.mapid == 25540 && temp ==8){ts.Walk(382,615);ts.delay(1000);ts.Walk(702,315);ts.delay(1000);ts.Walk(1102,235);ts.delay(1000);ts.ClickOnNPC(1);} else if(ts.Character.mapid == 25540 && temp ==9){ts.Warp(1);} else if(ts.Character.mapid == 25539 && temp ==9){ts.Warp(2);} else if(ts.Character.mapid == 25536 && temp ==9){ts.Warp(1);} else if(ts.Character.mapid == 25535 && temp ==9){ts.Warp(2);} else if(ts.Character.mapid == 25534 && temp ==9){ts.Warp(2);} else if(ts.Character.mapid == 25532 && temp ==9){ts.Warp(1);} else if(ts.Character.mapid == 25531 && temp ==9){ts.Warp(3);} else if(ts.Character.mapid == 25000 && temp ==9){ts.Warp(19);} else if(ts.Character.mapid == 25851 && temp ==9){ts.Warp(1);} else if(ts.Character.mapid == 25051 && temp ==9){ts.Warp(5);} else if(ts.Character.mapid == 25108 && temp ==9){ts.Walk(482,375);ts.delay(1000);ts.ClickOnNPC(1);} } public override void warpFinish() { ts.delay(1000); ph(); } public override void RequestPartyAcceptFrom(uint uid) { 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 PartyStop(uint uid) { if(uid == mem1 || uid == mem2 || uid == mem3 || uid == quansu) { debug(uid + " da roi khoi party"); ts.Disconnect(); } } public override void AcceptedParty(uint uid) { if (uid == mem1) {debug(uid + " gia nhap doi ngu");pt1 = 1;} if (uid == mem2) {debug(uid + " gia nhap doi ngu");pt2 = 1;} if (uid == mem3) {debug(uid + " gia nhap doi ngu");pt3 = 1;} if (uid == quansu) {debug(uid + " gia nhap doi ngu");pt4 = 1; ts.Sena(quansu);debug(uid + " lam quan su");} if (pt1 == 1 && pt2 == 1 && pt3 == 1 && pt4 == 1) { ts.delay(1000); debug("Doi ngu da day",0xFF0000); debug ("Start");ph(); } } public override void Start() { ph(); } public override void Stop() { } public override void PlayerAppear(uint uid, int mapid,int PosX, int PosY) { } public override void PlayerOnline(uint uid, ushort mapid) { } public override void PlayerOffline(uint uid) { } public override void InitBot() { ts.SetReconnectTime(1); ts.SetMaxIdleTime(20); AutoEatFood(); } Common: PHP: NPCCombatObject findMonster() { int maxhp = 0; string mi = ""; foreach (NPCCombatObject onpc in ts.oNPCCombat.Values) { if (onpc.HP > 0) { if (onpc.MAXHP > maxhp) { maxhp = onpc.MAXHP; mi = onpc.Row.ToString() + onpc.Col.ToString(); } } } return ts.oNPCCombat[mi] as NPCCombatObject; } void doEatSP(ushort order,int difSp){ for(byte i = 0;i< 25 ;i++){ Slot oSlot = (Slot)ts.MyItems[i]; if (oSlot.itemid == 0) { continue; } Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()]; if(oItem.isSPItem()){ int itemvalue=oItem.getSPValue(); if (itemvalue > difSp){ continue; } byte eatSpAmt = (byte)((difSp - (difSp % itemvalue)) / itemvalue); if (eatSpAmt> 0){ if (eatSpAmt > oSlot.num){ eatSpAmt = oSlot.num; } ts.EatItem((byte)(i+1),eatSpAmt,order) ; debug(oItem.itemname+" SP "+itemvalue+" at slot "+((byte)(i+1)).ToString()+" decrease"+eatSpAmt ,0xC08008 ); difSp = difSp - eatSpAmt * itemvalue ; } } } ts.delay(500); } void doEatHP(ushort order,int difHp){ for(byte i = 0;i< 25 ;i++){ Slot oSlot = (Slot)ts.MyItems[i]; if (oSlot.itemid == 0) { continue; } Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()]; if(oItem.isHPItem()){ int itemvalue=oItem.getHPValue(); if (itemvalue > difHp){ continue; } byte eatHpAmt = (byte)((difHp - (difHp % itemvalue)) / itemvalue ); if (eatHpAmt> 0){ if (eatHpAmt > oSlot.num){ eatHpAmt = oSlot.num; } ts.EatItem((byte)(i+1),eatHpAmt,order); debug(oItem.itemname + " HP " + itemvalue.ToString() + " at slot " + ((byte)(i+1)).ToString() + " decrease " + eatHpAmt.ToString() ,0xC08008 ); difHp = difHp - eatHpAmt * itemvalue ; } } } ts.delay(500); } void FindItemContribute(string ItemName){ Slot s = FindItemInSlot(ItemName); if(s != null){ ts.Contribute(s.slot); } } void FindItemDrop(string ItemName){ Slot s = FindItemInSlot(ItemName); if(s != null){ ts.DropItem(s.slot,s.num); } } Slot FindItemInSlot(string ItemName){ for(byte i=0;i<25;i++){ Slot oSlot = (Slot)ts.MyItems[i]; if( oSlot.itemid == 0){ continue; } Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()]; if(oItem.itemname == ItemName){ return oSlot; } } return null; } void AutoEatFood(){ if (ts.Character.HP < (ts.Character.MAXHP * hpFractionEat)){ doEatHP(0,(int)((ts.Character.MAXHP * hpFraction)-ts.Character.HP)); } if (ts.Character.SP < (ts.Character.MAXSP * spFractionEat)){ doEatSP(0,(int)((ts.Character.MAXSP * spFraction)-ts.Character.SP)); } if (ts.CurrentPartner.HP < (ts.CurrentPartner.MAXHP * hpFractionEat)){ doEatHP((ushort)ts.CurrentPartner.Order,(int)((ts.CurrentPartner.MAXHP * hpFraction)-ts.CurrentPartner.HP)); } if (ts.CurrentPartner.SP < (ts.CurrentPartner.MAXSP * spFractionEat)){ doEatSP((ushort)ts.CurrentPartner.Order,(int)((ts.CurrentPartner.MAXSP * spFraction)-ts.CurrentPartner.SP)); } } int get_random(int min,int max) { System.Random rd=new System.Random(); int ranNum= rd.Next(min,max); return ranNum; } void Disconnect(string msg) { debug(msg,0x0000FF); ts.Disconnect(); } void CheckDisconnect(){ if(ts.Character.HP< (DisconnectFlag * ts.Character.MAXHP)){ Disconnect("Disconnected : Character HP is low !!"); } if(ts.CurrentPartner.HP< (DisconnectFlag * ts.CurrentPartner.MAXHP)){ Disconnect("Disconnected : Warrior HP is low !!"); } if(ts.CurrentPartner.fai < DisconFai){ Disconnect("Disconnected : Warrior faith is below faith flag !!"); } } System.Collections.ArrayList DropItemList = new System.Collections.ArrayList(); System.Collections.ArrayList ContributeItemList = new System.Collections.ArrayList(); void AddDropItemList(string itemname) { if (!DropItemList.Contains(itemname)) { DropItemList.Add(itemname); } } bool InDropItemList(string itemname) { if (DropItemList.Contains(itemname)) return true; else return false; } void AddContributeItemList(string itemname) { if (!ContributeItemList.Contains(itemname)) { ContributeItemList.Add(itemname); } } bool InContributeItemList(string itemname) { if (ContributeItemList.Contains(itemname)) return true; else return false; } void ProcessInventoryAction(){ for(byte i=0;i<25;i++){ Slot oSlot = (Slot)ts.MyItems[i]; if(oSlot.itemid == 0){ continue; } Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()]; if(oSlot.num == 50) {ts.SendItemTo(2324125,oSlot.slot,oSlot.num);} } } ai chưa copy mà đã bị edit lại vô đây copy nha, mặc dù chưa full thông cãm P/S: ko có ý câu bài, chỉ vì có mấy đứa bạn ko trực tiếp send file đc nên share lên đây thôi, mod heo có thể close topic nhưng xin đừng xóa thanks.
thì làm Q xong...nó đứng ở chỗ thằng gì đó....mấy con kia đang extreme...ăn 1 cái TQ về party mấy conkia tiếp.....đâu có sao >.<