Emberveil source

tests/GodswordCombatSmoke.java

import java.net.InetAddress;
public final class GodswordCombatSmoke extends OnlineSmoke {
 boolean sent,animated,effect;
 @Override public void processGameLoop() {
  super.processGameLoop();if(!loggedIn||loadingStage!=2)return;
  if(ticks==100) {
   int best=-1,distance=999;
   for(int i=0;i<npcArray.length;i++) {
    NPC n=npcArray[i];if(n==null||n.desc==null||n.desc.type!=32)continue;
    int d=Math.abs(n.smallX[0]-myPlayer.smallX[0])+Math.abs(n.smallY[0]-myPlayer.smallY[0]);if(d<distance){distance=d;best=i;}
   }
   if(best<0)throw new AssertionError("Ardougne guard not loaded");
   stream.createFrame(185);stream.writeWord(30*256+7);
   NPC guard=npcArray[best];doWalkTo(2,0,1,0,myPlayer.smallY[0],1,0,guard.smallY[0],myPlayer.smallX[0],false,guard.smallX[0]);
   stream.createFrame(72);stream.method432(best);sent=true;System.out.println("Sent Armadyl special attack against Ardougne guard index="+best);
  }
  if(myPlayer.anim==17074)animated=true;if(myPlayer.anInt1520==11222)effect=true;
  if(ticks==1600){boolean pass=sent&&animated&&effect;System.out.println((pass?"PASS":"FAIL")+" AGS guard combat: animation="+animated+" effect="+effect+" connected="+loggedIn);if(!pass)for(String message:chatMessages)if(message!=null)System.out.println("Chat: "+message);System.exit(pass?0:1);}
 }
 public static void main(String[] args)throws Exception {
  host="127.0.0.1";username="evnet777778a";peer=username;targetTicks=6000;
  ClientSettings.SERVER_IP=host;ClientSettings.SERVER_WORLD=1;ClientSettings.CHECK_CRC=false;ClientSettings.SHOW_NAVBAR=false;
  Game.nodeID=10;Game.portOff=0;Game.setHighMem();Game.isMembers=true;Signlink.storeid=32;Signlink.startpriv(InetAddress.getLocalHost());
  GodswordCombatSmoke client=new GodswordCombatSmoke();client.testWalking=false;client.testChat=false;client.createClientFrame(503,765);client.gameFrame.setVisible(false);
 }
}