Thread: Mr Ex & Wildstalker Helmets

Results 1 to 6 of 6
  1. #1 Mr Ex & Wildstalker Helmets 
    Learner

    Kaiser Btw's Avatar
    Join Date
    Dec 2010
    Posts
    2,420
    Thanks given
    509
    Thanks received
    445
    Rep Power
    209
    Been a very long time since I was in the whole RSPS scene and I'm slowly easing myself back in & figured I might as well release my first real completed thing, edit to your server.

    Nothing special, just a nice little addition to any server

    Actionhandler
    Code:
    case 3709:
    			c.getDH().sendDialogues(500, npcType);
    			break;
    Dialoguehandler
    Code:
    		case 500:
    			sendOption3("Wilderness hats", "Skull me", "Kill count");
    			c.dialogueAction = 500;
    			break;
    	    case 501:
                sendNpcChat1("You've lost your hat, it seems.", c.talkingNpc, "Mr Ex");
                c.nextChat = 502;
            break;
    	    case 502:
                sendPlayerChat1("Yes, somewhere out there.");
                c.nextChat = 503;
            break;
    	    case 503:
                sendNpcChat1("Well, I don't mind getting it back for you...", c.talkingNpc, "Mr Ex");
                c.nextChat = 504;
            break;
    	    case 504:
                sendNpcChat1("It's not in the Wilderness, is it?", c.talkingNpc, "Mr Ex");
                c.nextChat = 505;
            break;
    	    case 505:
                sendNpcChat1("Ah, here we go, it's come home to me. Look after it.", c.talkingNpc, "Mr Ex");
                c.nextChat = 506;
                c.getItems().addItem(20801);
            break;
    	    case 506:
                sendPlayerChat1("Thanks!");
                c.nextChat = 507;
            break;
    	    case 507:
    	    	sendOption2("Tell me more about this hat, then.", "Farewell.");
    	    	c.dialogueAction = 507;
    	    	break;
    	    case 508:
                sendPlayerChat1("Farewell.");
                c.nextChat = 0;
            break;
    	    case 509:
                sendPlayerChat1("Tell me more about this hat, then.");
                c.nextChat = 510;
            break;
    	    case 510:
                sendNpcChat3("While you own this hat, your kills and deaths", "in the Wilderness will be recorded, as will your", "current kill streak.", c.talkingNpc, "Mr Ex");
                c.nextChat = 511;
            break;
    	    case 511:
                sendNpcChat3("You can use your hat to display your achievements", "by shouting out your record. If you wish to,", "you can instruct it not to show certain elements.", c.talkingNpc, "Mr Ex");
                c.nextChat = 512;
            break;
    	    case 512:
                sendPlayerChat1("Handy, thanks!");
                c.nextChat = 0;
            break;
    	    case 513:
                sendNpcChat2("You've still got that helmet I gave you? Good stuff.", "Better you than me out there, I say.", c.talkingNpc, "Mr Ex");
                c.nextChat = 507;
            break;
    	    case 514:
    	    	sendOption2("Renew my PK skull.", "Actually, no, it's not a good idea.");
    	    	c.dialogueAction = 514;
    	    	break;
    Clickingbuttons (Figure button Ids out)
    Code:
    			case 514:
    				p.isSkulled = true;
    				p.skullTimer = Constants.SKULL_TIMER;
    				p.headIconPk = 0;
    				p.getPA().requestUpdates();
    				p.getPA().removeAllWindows();
    				break;
    Code:
    			case 507:
    				p.getDH().sendDialogues(509, 3507);
    				break;
    Code:
    			case 507:
    				p.getDH().sendDialogues(508, 8863);
    				break;
    			case 514:
    				p.getPA().removeAllWindows();
    				break;
    Code:
    			case 500:
    				p.getDH().sendDialogues(514, -1);
    				break;
    Code:
    			case 500:
    				p.getDH().sendStatement("You have "+p.getVariables().KC+" player kills.");
    				break;
    ItemAssistant
    Code:
    	public void addItemToBank(int itemId, int amount) {
    		for (int i = 0; i < Constants.BANK_SIZE; i++) {
    			if (c.getVariables().bankItems[i] <= 0 || c.getVariables().bankItems[i] == itemId + 1 && c.getVariables().bankItemsN[i] + amount < Integer.MAX_VALUE) {
    				c.getVariables().bankItems[i] = itemId + 1;
    				c.getVariables().bankItemsN[i] += amount;
    				resetBank();
    				return;
    			}
    		}
    	}
    	
    	public void addItem(int itemId) {
    		if(c.getItems().freeSlots() <= 2) {
    			addItemToBank(itemId, 1);
    		} else {
    			addItem(itemId, 1);
    		}
    	}
    	
    	public void replaceItem(int itemId, int newId) {
    		deleteItem(itemId, 1);
    		addItem(newId, 1);
    	}
    
    	   public boolean hasItem(int i) {
    		   if (playerHasItem(i) || hasBankItem(i)) {
    			   return true;
    		   }
    		   return false;
    	   }
    
    	   public boolean playerHasItem(int itemID) {
    		   itemID++;
    		   
    		   for (int i = 0; i < c.getVariables().playerItems.length; i++) {
    			   if (c.getVariables().playerItems[i] == itemID) {
    				   return true;
    			   }
    		   }
    		   return false;
    		   
    	   }
    
    		public boolean hasBankItem(int itemID) {
    	      	for (int i1 = 0; i1 < c.getVariables().bankItems.length; i1++) {
    				if(c.getVariables().bankItems[i1]-1 == itemID && c.getVariables().bankItemsN[i1] >= 1) {
    					return true;
    				}
    			}
    			return false;
    		}
    ItemClick2
    Code:
    		case 20801:
    		case 20802:
    		case 20803:
    		case 20804:
    		case 20805:
    		case 20806:
    			c.sendMessage("Current Kills - @red@"+c.getVariables().KC+"@bla@.");
    			c.sendMessage("Current Deaths - @red@"+c.getVariables().DC+"@bla@.");
    			c.sendMessage("Current Kill streak - @red@"+c.killStreak+"@bla@.");
    			c.forcedChat("I have "+c.getVariables().KC+" kills and a "+c.killStreak+" kill streak!");
    			c.startAnimation(2417);//Loyalty Muscleman emote, change if you don't have 667+ Anims
    			break;
    ItemClick3
    Code:
    		case 20801:
    		case 20802:
    		case 20803:
    		case 20804:
    		case 20805:
    		case 20806:
    			c.getWSH().switchHelmet(itemId);
    			break;
    WildstalkerHelmet.java
    Code:
    package com.exile.game.players.content;
    
    import com.exile.game.players.Player;
    
    public class WildstalkerHelmet {
    	
    	private Player c;
    	
    	public WildstalkerHelmet(Player client) {
    		this.c = client;
    	}
    	
    	public enum Helmets {
    		TIER_1(20801, 10, 20802),
    		TIER_2(20802, 50, 20803),
    		TIER_3(20803, 100, 20804),
    		TIER_4(20804, 250, 20805),
    		TIER_5(20805, 500, 20806),
    		TIER_6(20806, 500, 20801);
    		
    		int iD;
    		int kR;
    		int nI;
    		
    		Helmets(int iD, int kR, int nI) {
    			this.iD = iD;
    			this.kR = kR;
    			this.nI = nI;
    		}
    		
    		public int getId() {
    			return iD;
    		}
    		
    		public int getKillReq() {
    			return kR;
    		}
    		
    		public int nextId() {
    			return nI;
    		}
    	}
    	
    	public void switchHelmet(int Id) {
    		for (final Helmets h : Helmets.values())
    			if(Id == h.getId()) {
    				if(c.getVariables().KC >= h.getKillReq()) {
    					c.getItems().replaceItem(h.getId(), h.nextId());
    				} else {
    					c.getItems().replaceItem(h.getId(), 20801);
    					c.sendMessage("You need "+h.getKillReq()+" kills to advance to the next tier. Current kill count - "+c.getVariables().KC);
    				}
    			}
    	}
    	
    
    }
    And I believe that's it, only things you have to do is figure out what button is which, I have a completely different dialogue button handling system that's why I didn't include and to handle all of your bonus' stuff.

    Attached image
    Attached image
    Attached image
    Attached image

    ALSO, forgot to make it check to see if the hood is equipped when checking if you have the item. Might want to add that.
    Reply With Quote  
     

  2. #2  
    Spread Love

    Dhruv's Avatar
    Join Date
    Feb 2012
    Age
    28
    Posts
    1,011
    Thanks given
    157
    Thanks received
    167
    Rep Power
    215
    Looks alright and welcome back
    Reply With Quote  
     

  3. #3  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Could've been done times better but welcome back I guess
    Reply With Quote  
     

  4. #4  
    Learner

    Kaiser Btw's Avatar
    Join Date
    Dec 2010
    Posts
    2,420
    Thanks given
    509
    Thanks received
    445
    Rep Power
    209
    Quote Originally Posted by Tyrant View Post
    Could've been done times better but welcome back I guess
    Cleaned it up, how's it lookin now
    Reply With Quote  
     

  5. #5  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Quote Originally Posted by KaiserCo View Post
    Cleaned it up, how's it lookin now
    No need to instance the class

    Code:
    package com.exile.game.players.content;
    
    import com.exile.game.players.Player;
    
    public class WildstalkerHelmet {
    	
    	public enum Helmets {
    		TIER_1(20801, 10, 20802),
    		TIER_2(20802, 50, 20803),
    		TIER_3(20803, 100, 20804),
    		TIER_4(20804, 250, 20805),
    		TIER_5(20805, 500, 20806),
    		TIER_6(20806, 500, 20801);
    		
    		int iD;
    		int kR;
    		int nI;
    		
    		Helmets(int iD, int kR, int nI) {
    			this.iD = iD;
    			this.kR = kR;
    			this.nI = nI;
    		}
    		
    		public int getId() {
    			return iD;
    		}
    		
    		public int getKillReq() {
    			return kR;
    		}
    		
    		public int nextId() {
    			return nI;
    		}
    	}
    	
    	public static void switchHelmet(Player c, int Id) {
    		for (final Helmets h : Helmets.values())
    			if(Id == h.getId()) {
    				if(c.getVariables().KC >= h.getKillReq()) {
    					c.getItems().replaceItem(h.getId(), h.nextId());
    				} else {
    					c.getItems().replaceItem(h.getId(), 20801);
    					c.sendMessage("You need "+h.getKillReq()+" kills to advance to the next tier. Current kill count - "+c.getVariables().KC);
    				}
    			}
    	}
    	
    
    }
    Reply With Quote  
     

  6. #6  
    Learner

    Kaiser Btw's Avatar
    Join Date
    Dec 2010
    Posts
    2,420
    Thanks given
    509
    Thanks received
    445
    Rep Power
    209
    Aw thank you
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [667] Mr. Ex
    By Kaiser Btw in forum Snippets
    Replies: 22
    Last Post: 08-16-2016, 04:46 PM
  2. Mr Ex
    By mr code in forum Models
    Replies: 3
    Last Post: 11-16-2012, 02:21 PM
  3. Mr Ex Npc 718
    By yo quise in forum Help
    Replies: 12
    Last Post: 10-20-2012, 11:31 AM
  4. Tidy Mr.Ex Dialogue + More Teleports
    By Floof of light in forum Snippets
    Replies: 6
    Last Post: 08-13-2012, 12:48 AM
  5. Mr Ex npc id
    By OblivionRealm in forum Requests
    Replies: 5
    Last Post: 08-12-2012, 02:37 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
  •