import bot.*;
public class EdgeSwordCooka extends Methods {
	public EdgeSwordCooka(Client c){super(c);}
	public String command(){return "edgesword";}
	
	public String lastServerMessage = "";
	
	public void main(String args[]) {
		int RAW = 369;
		int COOKED = 370;
		int BURNT = 371;
        printMessage("@or3@[@gre@X Smoke@or3@] @whi@ - @gre@ Edge Swordy Cooker");
		while(running()) {
			while (paused()) {
				wait(1000);
			}
			while(sleeping())
				wait(500);
			while(!questionMenu()) {
				int npc = getNPCIndex(95)[0];
				if(lastServerMessage.contains("banker is currently busy"))
					npc = getNPCIndex(95, npc)[0];
				talkToNPC(npc);
				wait(random(3000, 4000));
			}
			while(getDoorID(225, 444) == 2) {
				useDoor(225, 444);
				wait(random(1000, 2000));
			}
			while(getDoorID(217, 447) == 2) {
				useDoor(217, 447);
				wait(random(1000, 2000));
			}
			answerQuestion(0);
			while(!inBank())
				wait(500);
			depositAll(COOKED);
			wait(random(500, 1000));
			if(haveItemInBank(RAW))
				withdrawAll(RAW);
			wait(500);
			closeBank();
			while(!inArea(222, 1383, 227, 1387)) {
				if(getDoorID(217, 447) == 64)
					useDoor(217, 447);
				else if(getDoorID(225, 444) == 2)
					useDoor(225, 444);
				else
					useObject(226, 439);
				wait(random(1000, 2000));
			}
			while(itemCount(RAW) > 0) {
if(fatigue() >= 90L) {
						doSleep();
                                                wait(500);
					}
                          
                             if ((fatigue() >= 80L) && (fatigue() <= 85L) && !sleeping()) doSleep();
                              wait(300);
                             if (fatigue() >= 93L) stop();
				useItemOnObject(getItemSlot(RAW), 222, 1385);
	                     wait(random(2000, 3300));
			}
			while(itemCount(BURNT) > 0) {
				dropItem(getItemSlot(BURNT));
				wait(random(1000, 2000));
			}
			while(!inArea(222, 439, 227, 443)) {
				useObject(226, 1383);
				wait(random(1000, 2000));
			}
		}
	}

public void modProtection() {  
        if (fatigue() == 100) {  
        printMessage("@red@A Mod has fatigued you!");  
        stop();  
        }  
    } 
      

	
	public boolean onServerMessage(String s) {
		s = s.toLowerCase();
		lastServerMessage = s;
		return false;
	}
}
