Thread: Duel arena

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28
  1. #11  
    Donator

    Join Date
    Nov 2012
    Posts
    769
    Thanks given
    45
    Thanks received
    41
    Rep Power
    18
    nvm./
    Last edited by Relentless; 06-11-2019 at 10:10 PM.
    Reply With Quote  
     

  2. Thankful user:


  3. #12  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,588
    Thanks given
    160
    Thanks received
    254
    Rep Power
    396
    Quote Originally Posted by Relentless View Post
    Code:
    package server.model.players.packets;
    
    import server.Server;
    import server.model.players.Client;
    import server.model.players.PacketType;
    
    /**
     * Walking packet
     **/
    public class Walking implements PacketType {
    
    	@Override
    	public void processPacket(Client c, int packetType, int packetSize) {		
    		if (packetType == 248 || packetType == 164) {
    			c.clickObjectType = 0;
    			c.clickNpcType = 0;
    			c.faceUpdate(0);
    			c.npcIndex = 0;
    			c.playerIndex = 0;
    			if (c.followId > 0 || c.followId2 > 0)
    				c.getPA().resetFollow();
    		}		
    		
    		c.getPA().removeAllWindows();
    		if(c.duelRule[1] && c.duelStatus == 5) {
    			if(Server.playerHandler.players[c.duelingWith] != null) { 
    				if(!c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[c.duelingWith].getX(), Server.playerHandler.players[c.duelingWith].getY(), 1) || c.attackTimer == 0) {
    					c.sendMessage("Walking has been disabled in this duel!");
    				}
    			}
    			c.playerIndex = 0;	
    			return;		
    		}
    		
    		if(c.openDuel) {
    			Client o = (Client) Server.playerHandler.players[c.duelingWith];
    			c.openDuel = false;
    			o.openDuel = false;
    			c.getPA().closeAllWindows();
    			o.getPA().closeAllWindows();
    	}
    		
    		if(c.freezeTimer > 0) {
    			if(Server.playerHandler.players[c.playerIndex] != null) {
    				if(c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[c.playerIndex].getX(), Server.playerHandler.players[c.playerIndex].getY(), 1) && packetType != 98) {
    					c.playerIndex = 0;	
    					return;
    				}
    			}
    			if (packetType != 98) {
    				c.sendMessage("A magical force stops you from moving.");
    				c.playerIndex = 0;
    			}	
    			return;
    		}
    		
    		if (System.currentTimeMillis() - c.lastSpear < 4000) {
    			c.sendMessage("You have been stunned.");
    			c.playerIndex = 0;
    			return;
    		}
    		
    		if (packetType == 98) {
    			c.mageAllowed = true;
    		}
    
    		
    		if((c.duelStatus >= 1 && c.duelStatus <= 4) || c.duelStatus == 6) {
    			if(c.duelStatus == 6) {
    				c.getTradeAndDuel().claimStakedItems();		
    			}
    			return;
    		}
    		
    		
    		if(c.respawnTimer > 3) {
    			return;
    		}
    		if(c.inTrade) {
    			return;
    		}
    		if(packetType == 248) {
    			packetSize -= 14;
    		}
    		c.newWalkCmdSteps = (packetSize - 5)/2;
    		if(++c.newWalkCmdSteps > c.walkingQueueSize) {
    			c.newWalkCmdSteps = 0;
    			return;
    		}
    		
    		c.getNewWalkCmdX()[0] = c.getNewWalkCmdY()[0] = 0;
    		
    		int firstStepX = c.getInStream().readSignedWordBigEndianA()-c.getMapRegionX()*8;
    		for(int i = 1; i < c.newWalkCmdSteps; i++) {
    			c.getNewWalkCmdX()[i] = c.getInStream().readSignedByte();
    			c.getNewWalkCmdY()[i] = c.getInStream().readSignedByte();
    		}
    		
    		int firstStepY = c.getInStream().readSignedWordBigEndian()-c.getMapRegionY()*8;
    		c.setNewWalkCmdIsRunning(c.getInStream().readSignedByteC() == 1);
    		for(int i1 = 0; i1 < c.newWalkCmdSteps; i1++) {
    			c.getNewWalkCmdX()[i1] += firstStepX;
    			c.getNewWalkCmdY()[i1] += firstStepY;
    		}
    	}
    
    }
    See if it even reach this code:
    Code:
    		if((c.duelStatus >= 1 && c.duelStatus <= 4) || c.duelStatus == 6) {
    System.out.println("I send here as a test duel check: " + c.duelStatus);
    			if(c.duelStatus == 6) {
    				c.getTradeAndDuel().claimStakedItems();		
    			}
    			return;
    		}


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  4. Thankful user:


  5. #13  
    Donator

    Join Date
    Nov 2012
    Posts
    769
    Thanks given
    45
    Thanks received
    41
    Rep Power
    18
    Quote Originally Posted by arch337 View Post
    See if it even reach this code:
    Code:
    		if((c.duelStatus >= 1 && c.duelStatus <= 4) || c.duelStatus == 6) {
    System.out.println("I send here as a test duel check: " + c.duelStatus);
    			if(c.duelStatus == 6) {
    				c.getTradeAndDuel().claimStakedItems();		
    			}
    			return;
    		}
    EDIT:
    i got this
    [11/06/19 19:29]: I send here as a test duel check: 6
    Last edited by Relentless; 06-11-2019 at 08:29 PM.
    Reply With Quote  
     

  6. Thankful user:


  7. #14  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,588
    Thanks given
    160
    Thanks received
    254
    Rep Power
    396
    Quote Originally Posted by Relentless View Post
    EDIT:
    i got this
    [11/06/19 19:29]: I send here as a test duel check: 6
    What is the code for your claimStakedItems() ?
    Because it should trigger that code but something inside might be problem.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  8. Thankful user:


  9. #15  
    Registered Thanker
    MrClassic's Avatar
    Join Date
    Oct 2008
    Age
    24
    Posts
    1,823
    Thanks given
    6,221
    Thanks received
    155
    Rep Power
    2118
    I got this part in my PI code:

    at startDuel() (tradeandduel.java)
    Code:
    		Client o = (Client) PlayerHandler.players[c.duelingWith];
    		if(o == null) {
    			duelVictory();
    		}
    on top

    Also this part should be in givelife() (playerassistant)
    Code:
    			Client o = (Client) PlayerHandler.players[c.duelingWith];
    			if (o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if (o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    whole code:
    Code:
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) PlayerHandler.players[c.duelingWith];
    			if (o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if (o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			o.getPA().movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			if (c.duelStatus != 6) { // if we have won but have died, don't
    										// reset the duel status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    Thanks, MrClassic.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  10. #16  
    Donator

    Join Date
    Nov 2012
    Posts
    769
    Thanks given
    45
    Thanks received
    41
    Rep Power
    18
    nvm./
    Last edited by Relentless; 06-11-2019 at 10:11 PM.
    Reply With Quote  
     

  11. Thankful user:


  12. #17  
    Registered Thanker
    MrClassic's Avatar
    Join Date
    Oct 2008
    Age
    24
    Posts
    1,823
    Thanks given
    6,221
    Thanks received
    155
    Rep Power
    2118
    Edited my last post
    Thanks, MrClassic.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  13. #18  
    Donator

    Join Date
    Nov 2012
    Posts
    769
    Thanks given
    45
    Thanks received
    41
    Rep Power
    18
    Quote Originally Posted by MrClassic View Post
    I got this part in my PI code:

    at startDuel() (tradeandduel.java)
    Code:
    		Client o = (Client) PlayerHandler.players[c.duelingWith];
    		if(o == null) {
    			duelVictory();
    		}
    on top

    Also this part should be in givelife() (playerassistant)
    Code:
    			Client o = (Client) PlayerHandler.players[c.duelingWith];
    			if (o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if (o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    whole code:
    Code:
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) PlayerHandler.players[c.duelingWith];
    			if (o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if (o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			o.getPA().movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			if (c.duelStatus != 6) { // if we have won but have died, don't
    										// reset the duel status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    i changed this
    Code:
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) Server.playerHandler.players[c.duelingWith];
    			if(o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if(o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X+(Misc.random(Config.RANDOM_DUELING_RESPAWN)), Config.DUELING_RESPAWN_Y+(Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			if(c.duelStatus != 6) { // if we have won but have died, don't reset the duel status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    to this
    Code:
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) PlayerHandler.players[c.duelingWith];
    			if (o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if (o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			o.getPA().movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			if (c.duelStatus != 6) { // if we have won but have died, don't
    										// reset the duel status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    EDIT: Okay now it teles out fine, however the spoils interface doesnt appear if i click the ground and the winners prize goes in inventory before they tele out
    Reply With Quote  
     

  14. Thankful user:


  15. #19  
    Registered Thanker
    MrClassic's Avatar
    Join Date
    Oct 2008
    Age
    24
    Posts
    1,823
    Thanks given
    6,221
    Thanks received
    155
    Rep Power
    2118
    Quote Originally Posted by Relentless View Post
    This is mine
    Code:
    public void startDuel() {
    		
    		Client o = (Client) Server.playerHandler.players[c.duelingWith];
    		if (o.disconnected) {
    			duelVictory();
    			}
    		//if(o == null) {
    		//	duelVictory();
    		//}
    		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.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.duelStatus = 5;
    		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();			
    	}
    o.disconnected part should be removed completely and uncomment the o == null part. Idk why this has been done.
    Thanks, MrClassic.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  16. Thankful user:


  17. #20  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,588
    Thanks given
    160
    Thanks received
    254
    Rep Power
    396
    Quote Originally Posted by Relentless View Post
    i changed this
    Code:
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) Server.playerHandler.players[c.duelingWith];
    			if(o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if(o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X+(Misc.random(Config.RANDOM_DUELING_RESPAWN)), Config.DUELING_RESPAWN_Y+(Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			if(c.duelStatus != 6) { // if we have won but have died, don't reset the duel status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    to this
    Code:
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) PlayerHandler.players[c.duelingWith];
    			if (o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if (o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			o.getPA().movePlayer(Config.DUELING_RESPAWN_X + (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
    					Config.DUELING_RESPAWN_Y + (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);
    			if (c.duelStatus != 6) { // if we have won but have died, don't
    										// reset the duel status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    EDIT: Okay now it teles out fine, however the spoils interface doesnt appear if i click the ground and the winners prize goes in inventory before they tele out
    Remove this code inside the walk packet (mention above) if you do not want the user to get the 'spoil' aka the items won when click on the floor.
    Code:
    			if(c.duelStatus == 6) {
    				c.getTradeAndDuel().claimStakedItems();		
    			}


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  18. Thankful user:


Page 2 of 3 FirstFirst 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. o.O My New Pure In Duel Arena
    By JavaŠ in forum Media
    Replies: 8
    Last Post: 04-07-2007, 10:22 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •