Thread: [HELP] Level difference in Castle Wars [HELP]

Results 1 to 7 of 7
  1. #1 [HELP] Level difference in Castle Wars [HELP] 
    Registered Member
    Join Date
    Oct 2010
    Posts
    68
    Thanks given
    7
    Thanks received
    2
    Rep Power
    1
    Hey Rune-Server,

    Currently I'm adding CastleWars to DevastationRS.. the base is already there, I just need to add a few things.
    Now I have a problem with the level difference, you know when in the wilderness that a 126 CB-level player can't attack a newb of CB-level 3.. well I have this problem in the CastleWars arena.. I'd like to fully disable it for CastleWars so you can just attack everyone in CastleWars..
    Here are my booleans which have something todo with the level difference:
    CheckPVP.java :
    Code:
    	public boolean check(Client client, Client targetPlayer){
    	int targetId = targetPlayer.playerId;
    	if(client.playerRights > 1){
    		//client.getActionAssistant().sendMessage("You can not attack regular players.");
    			//return false;
    	}
    	if(targetPlayer.playerRights > 1){
    		//client.getActionAssistant().sendMessage("You can not attack game administrators.");
    			//return false;
    	}
    	if(!client.inCastleWars() && !client.duelArea1() && !client.duelArea2() && !client.inFightPits() && !client.acceptedFUNDuel){
    		if(!targetPlayer.inWild() || !client.inWild()) {
    			client.getActionAssistant().sendMessage("You cannot attack other players unless you are in the wilderness.");
    			return false;
    		}
    		int lvldiff = Math.abs(client.getCombatLevel() - targetPlayer.getCombatLevel());
    		if(lvldiff > targetPlayer.getCombatManager().wildernessLevel || lvldiff > client.getCombatManager().wildernessLevel) {
    			client.getActionAssistant().sendMessage("Your level difference is too great. Move deeper into the wilderness.");
    			return false;
    		}
    	}
    
    		if(targetPlayer.getTradeAssistant().getCurrentTrade() != null) {
    			if(targetPlayer.getTradeAssistant().getCurrentTrade().isOpen()) {
    				targetPlayer.getTradeAssistant().decline();
    			}
    		}
    		if(targetPlayer.fastAttackedBy != client.playerId && !client.inMulti() && !targetPlayer.inMulti()){
    			if(System.currentTimeMillis() - targetPlayer.fastAttackedTime < 3500){
    				client.getActionAssistant().sendMessage("Someone else is already fighting this opponent.");
    				return false;
    			}
    		}
    		targetPlayer.fastAttackedTime = System.currentTimeMillis();
    		targetPlayer.fastAttackedBy = client.playerId;
    	return true;
    	}
    CheckPVPspell.java :
    Code:
    public boolean check(Client client, Client targetPlayer){
    		if(client.isViewingOrb){
    			return false;
    		}
    	//if(client.playerRights > 1){
    		//client.getActionAssistant().sendMessage("You can not attack regular players.");
    			//return false;
    	//}
    	//if(targetPlayer.playerRights > 1){
    		//client.getActionAssistant().sendMessage("You can not attack game administrators.");
    			//return false;
    	//}
    	if(!client.inCastleWars() && !client.duelArea1() && !client.duelArea2() && !client.acceptedFUNDuel){
    		if(!targetPlayer.inWild() || !client.inWild()) {
    			client.getActionAssistant().sendMessage("You cannot attack other players unless you are in the wilderness.");
    			client.stopMovement();
    			return false;
    		}
    		int lvldiff = Math.abs(client.getCombatLevel() - targetPlayer.getCombatLevel());
    		if(lvldiff > targetPlayer.getCombatManager().wildernessLevel || lvldiff > client.getCombatManager().wildernessLevel) {
    			client.getActionAssistant().sendMessage("Your level difference is too great. Move deeper into the wilderness.");
    			client.stopMovement();
    			return false;
    		}
    	}
    	return true;
    	}
    PvP.java :
    Code:
    public boolean check(Client client, Client targetPlayer){
    		//client.faceNPC(targetPlayer.playerId + 32768);
    		if(!client.inFightPits() && !client.inCastleWars() && !client.duelArea1() && !client.duelArea2()){
    			if(!client.isSkulled){
    			 if(!client.attackedPlayers.contains(targetPlayer.playerId) && !targetPlayer.attackedPlayers.contains(client.playerId)) {
    				client.skullDelay = System.currentTimeMillis();
    				client.attackedPlayers.add(targetPlayer.playerId);
    				client.isSkulled = true;
    				client.headIconPK = 0;
    			 }
    			}
    		}
    		Random r = new Random();
    		if (client.playerEquipment[12] == 2550) {
    			if(r.nextInt(3)==1){
    				int hit = client.getCombat().CalculateHits().Calculate_PVN_Melee_Hit(client, targetPlayer);
    				if(hit < 1){
    					hit = 0;
    				}
                                    int recoilDam = (int) ((double) r.nextInt(hit)*.10);
    				targetPlayer.getActionAssistant().hit2(recoilDam,0);
    			}
    			if(r.nextInt(11)==1){
    				client.getActionAssistant().deleteequiment(client.playerEquipment[12], 12);
    				client.getActionAssistant().sendMessage("Your Ring of recoil has shattered.");
    			}
    		}
    		if(!client.inCastleWars() && !client.duelArea1() && !client.duelArea2() && !client.acceptedFUNDuel){
    			if(!targetPlayer.inWild() || !client.inWild()) {
    			client.getActionAssistant().sendMessage("You cannot attack other players unless you are in the wilderness.");
    			client.stopMovement();
    			return false;
    		}
    	}
    		if(!targetPlayer.inWild() || !client.inWild()) {
    		int lvldiff = Math.abs(client.getCombatLevel() - targetPlayer.getCombatLevel());
    		if(lvldiff > targetPlayer.getCombatManager().wildernessLevel || lvldiff > client.getCombatManager().wildernessLevel) {
    			client.getActionAssistant().sendMessage("Your level difference is too great. Move deeper into the wilderness.");
    			client.stopMovement();
    			return false;
    		}
    	}
    
    	if(!client.inMulti() && !targetPlayer.inMulti()){
    		if(client.underAttackBy != 0 && System.currentTimeMillis()-client.singleCombatDelay < 5000){
    			if(client.underAttackBy != targetPlayer.playerId){
    				client.getActionAssistant().sendMessage("You are already in combat.");
    			client.stopMovement();
    			return false;
    			}
    		}
    		if(targetPlayer.underAttackBy != 0 && System.currentTimeMillis()-targetPlayer.singleCombatDelay < 5000){
    			if(targetPlayer.underAttackBy != client.playerId){
    				client.getActionAssistant().sendMessage("This player is already in combat.");
    			client.stopMovement();
    			return false;
    			}
    		}
    	}
    		
    		if(client.getCombat().useRange()){
    			if(!client.getCombat().CheckRange().check(client, targetPlayer)){
    				return false;
    			}
    		} else if(client.getCombat().useMagic()){
    			if(!client.getCombat().CheckMagic().check(client, targetPlayer, client.getCombat().getSpellId())){
    				client.getCombat().oneTimeMagic = false;
    				return false;
    			}
    		} else {
    			if(!client.getCombat().CheckMelee().check(client, targetPlayer)){
    				return false;
    			}
    		}
    	return true;
    	}
    And here is the "inCastleWars()" boolean :
    Code:
    	public boolean inCastleWars(){
    		if(getAbsX() >= 2368 && getAbsX() <= 2432 && getAbsY() >= 3071 && getAbsY() <= 3135||
    	getAbsX() >= 2368 && getAbsX() <= 2401 && getAbsY() >= 9501 && getAbsY() <= 9528||
    	getAbsX() >= 2391 && getAbsX() <= 2410 && getAbsY() >= 9494 && getAbsY() <= 9513||
    	getAbsX() >= 2401 && getAbsX() <= 2430 && getAbsY() >= 9481 && getAbsY() <= 9504) {	
    			return true;
    		}
    		return false;
    	}
    If anyone can help me.. PLEASE, It's really annoying, I've been trying different things, and until now it won't work.
    I'll rep+

    Grz. Yannick
    Reply With Quote  
     

  2. #2  
    damnant quod non intellegunt

    Mr Chainsaw's Avatar
    Join Date
    Sep 2006
    Age
    25
    Posts
    4,052
    Thanks given
    827
    Thanks received
    1,277
    Rep Power
    4664
    Code:
    		if(lvldiff > targetPlayer.getCombatManager().wildernessLevel || lvldiff > client.getCombatManager().wildernessLevel & !client.isInCastleWars()) {
    			client.getActionAssistant().sendMessage("Your level difference is too great. Move deeper into the wilderness.");
    			return false;
    		}
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2010
    Posts
    68
    Thanks given
    7
    Thanks received
    2
    Rep Power
    1
    Quote Originally Posted by Mr Chainsaw View Post
    Code:
    		if(lvldiff > targetPlayer.getCombatManager().wildernessLevel || lvldiff > client.getCombatManager().wildernessLevel & !client.isInCastleWars()) {
    			client.getActionAssistant().sendMessage("Your level difference is too great. Move deeper into the wilderness.");
    			return false;
    		}
    Thx I will try if it works (unless you are sure )
    Reply With Quote  
     

  4. #4  
    damnant quod non intellegunt

    Mr Chainsaw's Avatar
    Join Date
    Sep 2006
    Age
    25
    Posts
    4,052
    Thanks given
    827
    Thanks received
    1,277
    Rep Power
    4664
    you can also try adding this to it:

    Code:
    if (client.isInCastleWars()) {
    return true;
    }
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Oct 2010
    Posts
    68
    Thanks given
    7
    Thanks received
    2
    Rep Power
    1
    Quote Originally Posted by Mr Chainsaw View Post
    you can also try adding this to it:

    Code:
    if (client.isInCastleWars()) {
    return true;
    }
    When the first thing doesn't work I'll try

    btw. you are making/made a little mistake

    it should be:
    Code:
    client.isCastleWars()
    not
    Code:
    client.isInCastleWars()
    but nvm
    Reply With Quote  
     

  6. #6  
    damnant quod non intellegunt

    Mr Chainsaw's Avatar
    Join Date
    Sep 2006
    Age
    25
    Posts
    4,052
    Thanks given
    827
    Thanks received
    1,277
    Rep Power
    4664
    Whatever. I was only giving you a basic idea.
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Oct 2010
    Posts
    68
    Thanks given
    7
    Thanks received
    2
    Rep Power
    1
    you're first code didn't work

    now going to try you're second code..

    just add it in the boolean right?
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Replies: 40
    Last Post: 06-27-2010, 04:45 PM
  2. Replies: 9
    Last Post: 06-13-2010, 12:41 PM
  3. [HELP] Combat level difference
    By Arta in forum Help
    Replies: 0
    Last Post: 04-18-2010, 05:36 PM
  4. Replies: 6
    Last Post: 04-12-2010, 11:46 AM
  5. Replies: 63
    Last Post: 05-20-2008, 06:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •