Problem is you can just tele straight out in the middle of a duel.
I've looked at this a few times before posting and I just can't get my head around it
Anyway heres whats needed....
The final accept button to place you into a duel...
Code:
case 25120:
if(c.duelStatus == 5) {
break;
}
Client o1 = (Client) Server.playerHandler.players[c.duelingWith];
if(o1 == null) {
c.getTradeAndDuel().declineDuel();
return;
}
c.duelStatus = 4;
if(o1.duelStatus == 4 && c.duelStatus == 4) {
c.getTradeAndDuel().startDuel();
o1.getTradeAndDuel().startDuel();
o1.duelCount = 4;
c.duelCount = 4;
c.duelDelay = System.currentTimeMillis();
o1.duelDelay = System.currentTimeMillis();
} else {
c.getPA().sendFrame126("Waiting for other player...", 6571);
o1.getPA().sendFrame126("Other player has accepted", 6571);
}
break;
The start duel method...
Code:
public void startDuel() {
Client o = (Client) Server.playerHandler.players[c.duelingWith];
if(o == null) {
duelVictory();
}
c.duelStatus = 5;
c.headIconHints = 2;
if(c.duelRule[7]){
for(int p = 0; p < c.PRAYER.length; p++) { // reset prayer glows
c.prayerActive[p] = false;
c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);
}
c.getCombat().resetPrayer();
c.getCombat().resetCurse();
c.prayerId = -1;
c.ProtectItem = false;
c.getPA().refreshSkill(5);
c.headIcon = -1;
c.getPA().requestUpdates();
}
if(c.duelRule[11]) {
c.getItems().removeItem(c.playerEquipment[0], 0);
}
if(c.duelRule[12]) {
c.getItems().removeItem(c.playerEquipment[1], 1);
}
if(c.duelRule[13]) {
c.getItems().removeItem(c.playerEquipment[2], 2);
}
if(c.duelRule[14]) {
c.getItems().removeItem(c.playerEquipment[3], 3);
}
if(c.duelRule[15]) {
c.getItems().removeItem(c.playerEquipment[4], 4);
}
if(c.duelRule[16]) {
c.getItems().removeItem(c.playerEquipment[5], 5);
}
if(c.duelRule[17]) {
c.getItems().removeItem(c.playerEquipment[7], 7);
}
if(c.duelRule[18]) {
c.getItems().removeItem(c.playerEquipment[9], 9);
}
if(c.duelRule[19]) {
c.getItems().removeItem(c.playerEquipment[10], 10);
}
if(c.duelRule[20]) {
c.getItems().removeItem(c.playerEquipment[12], 12);
}
if(c.duelRule[21]) {
c.getItems().removeItem(c.playerEquipment[13], 13);
}
c.getPA().removeAllWindows();
c.specAmount = 10;
c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
if(c.duelRule[8]){
if(c.duelRule[1]) {
c.getPA().movePlayer(c.duelTeleX, c.duelTeleY, 0);
} else {
c.getPA().movePlayer(3366 + Misc.random(12), 3246 + Misc.random(6), 0);
}
} else {
if(c.duelRule[1]) {
c.getPA().movePlayer(c.duelTeleX, c.duelTeleY, 0);
} else {
c.getPA().movePlayer(3335 + Misc.random(12), 3246 + Misc.random(6), 0);
}
}
c.getPA().createPlayerHints(10, o.playerId);
c.getPA().showOption(3, 0, "Attack", 1);
for (int i = 0; i < 20; i++) {
c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
c.getPA().refreshSkill(i);
}
for(GameItem item : o.getTradeAndDuel().stakedItems) {
otherStakedItems.add(new GameItem(item.id, item.amount));
}
c.getPA().requestUpdates();
}
The startteleport method in playerassistant.
Code:
public void startTeleport(int x, int y, int height, String teleportType) {
c.getTradeAndDuel().declineDuel();
c.getPA().closeAllWindows();
if(c.duelStatus == 5) {
c.sendMessage("You can't teleport during a duel!");
return;
}
if(c.inWild() && c.wildLevel > Config.NO_TELEPORT_WILD_LEVEL) {
c.sendMessage("You can't teleport above level "+Config.NO_TELEPORT_WILD_LEVEL+" in the wilderness.");
return;
}
if(c.Jail == true) {
c.sendMessage("You can't teleport out of prison idiot!");
return;
}
if(c.inJail() && c.Jail == true) {
c.sendMessage("You can't teleport out of prison idiot!");
return;
}
if(c.isInDungeon() && c.dungeonFinished == false) {
c.sendMessage("You can't teleport whilst doing dungeoneering");
return;
}
if(c.inFightCaves()) {
c.sendMessage("You can't teleport Out of FightCaves.");
return;
}
if(c.inPits == true) {
c.sendMessage("You can't teleport out of the fight pits!");
return;
}
if(System.currentTimeMillis() - c.teleBlockDelay < c.teleBlockLength) {
c.sendMessage("You are teleblocked and can't teleport.");
return;
}
if(!c.isDead && c.teleTimer == 0 && c.respawnTimer == -6) {
if (c.playerIndex > 0 || c.npcIndex > 0)
c.getCombat().resetPlayerAttack();
EarningPotential.checkTeleport(c);
c.stopMovement();
removeAllWindows();
c.teleX = x;
c.teleY = y;
c.npcIndex = 0;
c.playerIndex = 0;
c.faceUpdate(0);
c.teleHeight = height;
if(teleportType.equalsIgnoreCase("modern")) {
c.startAnimation(8939);
c.teleTimer = 11;
c.gfx0(1576);
c.teleEndAnimation = 8941;
c.teleEndGfx = 1577;
}
if(teleportType.equalsIgnoreCase("ancient")) {
c.startAnimation(9599);
c.teleGfx = 0;
c.teleTimer = 11;
c.teleEndAnimation = 8941;
c.gfx0(1681);
}
if(teleportType.equalsIgnoreCase("dungeoneering")) {
c.startAnimation(13652);
c.teleGfx = 0;
c.teleTimer = 16;
c.gfx0(2602);
c.teleEndAnimation = 13654;
}
if(teleportType.equalsIgnoreCase("lunar")) {
c.startAnimation(8939);
c.teleTimer = 11;
c.gfx0(1576);
c.teleEndAnimation = 8941;
c.teleEndGfx = 1577;
}
}
}
I'd appreciate any help and I'm open for teamviewer if you want.
Although it may be laggy
Thanks in advance, Mikey