- 24/7/04
- 2,871
- 2,181
Thôi Lỡ rồi Duy làm liều cho anh em vậy
Scrip:
Common:
Ai cũng xin dữ wa nên làm liều vậy thôi.
----Thân----
Hệ Địa
Scrip:
PHP:
string state="";
double DisconnectFlag = 0.3; // Disconnect when current HP is below 30%
double hpFractionEat = 0.8; //Eat HP when current HP<= 80%
double spFractionEat = 1;
double hpFraction = 1; //Eat until current HP >= 95 %
double spFraction = 0.5;
byte DisconFai = 00; // Faith of warrior to disconnect
byte battle_count = 0;
byte countpt=1;
byte SendingFlag=0;
int i1=1;
int delaywarp =300; // Delay de warp
int turn1=1;
int turn2=1;
int charturn=1;
int petturn=1;
int dennhanQ=0;
int dendanhTG=0;
int dendanhNW=0;
int nhanQ=0;
int danhTG=0;
int danhNW=0;
uint hieuthuoc=2088228;
uint taphoa=2088222;
uint idMem1=123456;
uint idMem2=123456; //Sena
uint idMem3=123456;
uint idMem4=123456;
uint idMem5=123456;
public override void PlayerAppear(uint PlayerID, int mapid,int PosX, int PosY)
{
if (PlayerID <= 1000 && mapid==ts.Character.mapid) {
debug("giao hoan đất trời mẹ thằng GM nó tới anh em ơi!");
ts.Disconnect(false);
}
}
public override void MyAttack()
{
CharacterInfo MyChar = ts.Character;
ts.SendAttack(MyChar.Row, MyChar.Col, MyChar.Row, MyChar.Col,17001);
}
public override void MyPartnerAttack()
{
}
public override void BattleStoped()
{
state="";
ts.SendEnd();
if(nhanQ==1) {
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
danhTG=1;
}
if(danhNW==1){
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
}
if(danhTG==0&&danhNW==1){
ts.Walk(1242,475);
ts.delay(200);
ts.ClickOnNPC(3);
}
AutoEatFood();
}
public override void doRecvQuestion()
{
state="BTQ";
}
public override void ResponseAnswer()
{
int dtime=2;
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 NpcDialogMenu(ushort DialogId)
{
debug("Dialog Menu ID="+DialogId.ToString());
if(DialogId == 4)
{
debug("µÍº ¢éÍ 1",0x0000FF);
ts.SelectChoice(1);
ts.SendEnd();
}
}
public override void NpcDialog(ushort DialogId)
{
debug("Dialog ID="+DialogId.ToString());
if(DialogId > 1) ts.SendEnd();
// if(DialogId==10024) ts.SendEnd();
if(DialogId == 13984) {
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
}
if(DialogId == 13958) {
ts.SendEnd();
ts.SendEnd();
}
if(DialogId == 20119) {
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
}
if(DialogId == 13919) {
ts.SendEnd();
ts.SendEnd();
ts.ClickOnNPC(7);
}
if(DialogId == 13920||DialogId==11392) {
ts.SendEnd();
dendanhTG=1;
BridgeWarpLink();
}
if(DialogId == 13922) {
ts.SendEnd();
ts.SendEnd();
}
if(DialogId == 13984) {
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
ts.SendEnd();
}
if(DialogId == 13979) {
debug("danh xong roi, di danh lay ngoc nao");
ts.SendEnd();
danhTG=1;
dendanhNW=1;
BridgeWarpLink();
}
}
public override void RequestPartyAcceptFrom(uint PlayerId)
{
}
public override void AcceptedParty(uint PlayerId)
{
if(PlayerId == idMem2 || PlayerId == idMem3 || PlayerId == idMem4 || PlayerId == idMem5){
debug(PlayerId + "vua moi party");
countpt++;
}
if (countpt>4)
{
ts.Sena(idMem2);
BridgeWarpLink();
}
}
public override void PartyStop(uint PlayerId)
{
if(PlayerId == idMem1 || PlayerId == idMem2 || PlayerId == idMem3 || PlayerId == idMem4 || PlayerId == idMem5)
{
ts.Disconnect();
debug(PlayerId + " disconnected");
}
}
public override void PlayerOnline(uint PlayerId)
{
if(PlayerId == idMem1 || PlayerId == idMem2 || PlayerId == idMem3 || PlayerId == idMem4 || PlayerId == idMem5)
{
ts.AcceptParty(PlayerId);
//debug(PlayerId + " disconnected");
}
}
public override void BattleStarted(){}
public override void onNPCAppear(ushort npcmapid, int x, int y){}
public override void OnTimer()
{
}
public override void warpFinish()
{
if (state == "")
{
BridgeWarpLink();
}
}
public override void Start()
{
state="";
BridgeWarpLink();
}
public override void Stop()
{
state="stop";
}
public override void FinishAnswer()
{
BridgeWarpLink();
}
public override void InitBot()
{ ts.SetReconnectTime(5);
ts.AcceptParty(idMem2);
ts.delay(10);
ts.AcceptParty(idMem3);
ts.delay(10);
ts.AcceptParty(idMem4);
ts.delay(10);
ts.AcceptParty(idMem5);
ts.Sena(idMem2);
dennhanQ=1;
dendanhTG=0;
dendanhNW=0;
AutoEatFood();
}
Common:
PHP:
void BridgeWarpLink()
{
if(dennhanQ==1){
tracquan_haphi();
}
if(nhanQ==1&&dendanhTG==1){
haphi_trieugoi();
}
if(danhTG==1&&dendanhNW==1){
danhtrieugoi_laynhamquai();
}
}
void tracquan_haphi(){
if (ts.Character.mapid == 12003)
ts.Warp(1);
if (ts.Character.mapid == 12002)
ts.Warp(2);
if (ts.Character.mapid == 12001)
ts.Warp(1);
if (ts.Character.mapid == 12000)
ts.Warp(30);
if (ts.Character.mapid == 11000)
ts.Warp(8);
if (ts.Character.mapid == 15507)
ts.Warp(2);
if (ts.Character.mapid == 15517)
ts.Warp(2);
if (ts.Character.mapid == 15506)
ts.Warp(3);
if (ts.Character.mapid == 15516)
ts.Warp(2);
if (ts.Character.mapid == 15508)
ts.Warp(2);
if (ts.Character.mapid == 15518)
ts.Warp(3);
if (ts.Character.mapid == 15510)
ts.Warp(2);
if (ts.Character.mapid == 15000)
ts.Warp(9);
if (ts.Character.mapid == 15011)
ts.Warp(1);
if (ts.Character.mapid == 15012) {
debug("den noi roi");
dennhanQ=0;
ts.Walk(362,215);
ts.delay(2000);
nhanQ=1;
debug("da nhan xong Q, gio di den danh TG");
ts.ClickOnNPC(7);
}
}
void haphi_trieugoi(){
if (ts.Character.mapid == 15471)
ts.Warp(2);
if (ts.Character.mapid == 15012)
ts.Warp(6);
if (ts.Character.mapid == 15011)
ts.Warp(2);
if (ts.Character.mapid == 15000)
ts.Warp(8);
if (ts.Character.mapid == 15521)
ts.Warp(1);
if (ts.Character.mapid == 15525)
ts.Warp(2);
if (ts.Character.mapid == 15522)
ts.Warp(1);
if (ts.Character.mapid == 15526)
ts.Warp(2);
if (ts.Character.mapid == 15524) {
ts.Walk(2082,1555);
ts.delay(150);
ts.Walk(2082,1315);
ts.delay(150);
ts.Walk(2082,1075);
ts.delay(150);
ts.Walk(2082,815);
ts.delay(150);
ts.Walk(2082,555);
ts.delay(150);
ts.Walk(2142,355);
ts.delay(150);
debug("den noi roi, chuan bi danh TG");
ts.delay(150);
nhanQ=0;
danhTG=1;
debug("danh Q trieu goi nao");
ts.ClickOnNPC(9);
}
}
void danhtrieugoi_laynhamquai(){
if (ts.Character.mapid == 15471) {
ts.Walk(322,475);
ts.delay(200);
ts.Walk(1242,475);
ts.delay(1200);
debug("toi noi roi");
danhTG=0;
danhNW=1;
ts.ClickOnNPC(3);
}
if (ts.Character.mapid == 15000)
ts.Warp(3);
if (ts.Character.mapid == 15521)
ts.Warp(2);
if (ts.Character.mapid == 15525)
ts.Warp(1);
if (ts.Character.mapid == 15522)
ts.Warp(2);
if (ts.Character.mapid == 15526)
ts.Warp(1);
if (ts.Character.mapid == 15524) {
ts.Warp(2);
}
}
void CNS(){
Slot oSlot = (Slot)ts.MyItems[i1];
debug("check slot: "+i1);
Item oItem = (Item)ts.ITEMS[oSlot.itemid.ToString()];
if(oSlot.num >=50){
if(oSlot.itemid==27005||oSlot.itemid==27066||oSlot.itemid==27035||oSlot.itemid==27032){
ts.SendItemTo(2088228,oSlot.slot,50);
}
else{
ts.SendItemTo(2088222,oSlot.slot,50);
}
}
i1=i1+1;
if(i1==25) i1=1;
debug("Checked!");
}
void viewState()
{
debug(" Exp : " + ts.Character.EXP,0xFF0000);
debug(" Max Exp : " + ts.Character.MAXEXP, 0xFF0000);
debug(" Lucky Count : " + ts.Character.luck, 0xFF0000);
debug(" Ghost Count : " + ts.Character.ghost,0xFF0000);
debug(" Warrior's FAI : " + ts.CurrentPartner.CharName +" : " + ts.CurrentPartner.fai,0xFF0000);
}
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 (InDropItemList(oItem.itemname)) ts.DropItem(oSlot.slot,oSlot.num);
// if (InContributeItemList(oItem.itemname)) ts.Contribute(oSlot.slot);
if(oSlot.itemid != 0 && oSlot.num >= 50)
{
if (InContributeItemList(oItem.itemname))
{ts.SendItemTo(thuoc,oSlot.slot,50);}
else
{ts.SendItemTo(taphoa,oSlot.slot,50);}
}
}
}*/
Ai cũng xin dữ wa nên làm liều vậy thôi.
----Thân----
, thế sao ko repair cho nó warp qua cái gate CTK đi 



:-P 