Thread: [508] Unfinished Basic Character Customization (Done like crap but semi working).

Results 1 to 3 of 3
  1. #1 [508] Unfinished Basic Character Customization (Done like crap but semi working). 
    Registered Member
    Join Date
    Oct 2011
    Posts
    130
    Thanks given
    3
    Thanks received
    6
    Rep Power
    11
    This is an unfinished character creation based on:

    [Only registered and activated users can see links. ]


    Difficulty: 3/10?


    First I'd like to say I haven't touched java in years so I'm super rusty (and after this code you'll probably say stay away from it too). Also this is NOT the full character customization, but it will give you SOME options to at least change from male to female or a different shirt / pants as well as skin color.


    (importing may be required. do it via exlipse.)

    in com.emulator.packet.packethandler
    ButtonPacketHandler:
    Code:
                case 771:
            		switch(buttonId) {
        			case 37:
        				player.getSettings().setMouseTwoButtons(true);
                        player.getActionSender().sendConfig(170, 0);
        				break;
        			case 40:
        				player.getSettings().setMouseTwoButtons(false);
                        player.getActionSender().sendConfig(170, 1);
                        break;
        			case 49:
        				player.getAppearance().setDefaultMale();
        				
        				break;
        			case 52:
        				player.getAppearance().setDefaultFemale();
        				
        				break;
        			case 158:
        				player.getAppearance().setColour4(7);
        				
        				break;
        			case 151:
        				player.getAppearance().setColour4(0);
        				
        				break;
        			case 152:
        				player.getAppearance().setColour4(1);
        				
        				break;
        			case 153:
        				player.getAppearance().setColour4(2);
        				
        				break;
        			case 154:
        				player.getAppearance().setColour4(3);
        				
        				break;
        			case 155:
        				player.getAppearance().setColour4(4);
        				
        				break;
        			case 156:
        				player.getAppearance().setColour4(5);
        				
        				break;
        			case 157:
        				player.getAppearance().setColour4(6);
        				
        				break;
        			case 342:
        				player.getAppearance().setShirtUp();
        				
        				break;
        			case 341:
        				player.getAppearance().setShirtDown();
        				
        				break;
        				
        			case 354:
        				player.getAppearance().setPantsUp();
        				
        				break;
        				
        			case 353:
        				player.getAppearance().setPantsDown();
        				
        				break;
        			
        				
        			case 362:
        				player.getAppearance();
        				PlayerUpdateFlags.setAppearanceUpdateRequired(true);
        				player.getActionSender().sendCloseInterface();
        				break;
        				
                    }
            		break;


    In com.emulator.model.player.masks
    Appeareance.java


    Code:
    package com.emulator.model.player.masks;
    
    /**
     * Appearance class
     * @author Graham
     *
     */
    public class Appearance {
    	
    	private boolean asNpc   = false;
    	private int     npcId   = -1;
    	private int     gender  = 0;
    	private int[]   look    = new int[7];
    	private int[]   colour  = new int[5];
    	
    	public Appearance() {
    		look[0] = 0;
    		look[1] = 10;
    		look[2] = 18;
    		look[3] = 26;
    		look[4] = 33;
    		look[5] = 36;
    		look[6] = 42;
    	}
    	
    	public boolean isNpc() {
    		return asNpc;
    	}
    	
    	public int getNpcId() {
    		return npcId;
    	}
    	
    	public int getGender() {
    		return gender;
    	}
    	
    	public int getLook(int id) {
    		return look[id];
    	}
    	
    	public int getColour(int id) {
    		return colour[id];
    	}
    	
    	public int[] getColours() {
    		return colour.clone();
    	}
    
    	public void transformToPlayer() {
    		asNpc = false;
    	}
    
    	public void transformToNpc(int i) {
    		asNpc = true;
    		npcId = i;
    	}
    
    	public int setColour4(int colour) {
    		return this.colour[4] = colour;
    		// TODO Auto-generated method stub
    		
    	}
    	
    	public void setDefaultMale() {
    		gender = 0;
    		look[0] = 0;
    		look[1] = 10;
    		look[2] = 18;
    		look[3] = 26;
    		look[4] = 33;
    		look[5] = 36;
    		look[6] = 42;
    	}
    	
    	public void setDefaultFemale() {
    		gender = 1;
    		look[0] = 48;
    		look[1] = 1000; // Beard
    		look[2] = 57; // Torso
    		look[3] = 64; // Arms
    		look[4] = 68; // Bracelets
    		look[5] = 77; // Legs
    		look[6] = 80; // Shoes
    	}
    	public void setShirtUp() {
    		if(gender == 0) {
    			if(look[2] == 18) {
    				look[2] = 19;
    			} else if(look[2] == 19) {
    				look[2] = 20;
    			} else if(look[2] == 20) {
    				look[2] = 21;
    			} else if(look[2] == 21) {
    				look[2] = 22;
    			} else if(look[2] == 22) {
    				look[2] = 23;
    			} else if(look[2] == 23) {
    				look[2] = 24;
    			} else if(look[2] == 24) {
    				look[2] = 25;
    			} else if(look[2] == 25) {
    				look[2] = 18;
    			}
    		} else if(gender == 1) {
    			if(look[2] == 57) {
    				look[2] = 58;
    			} else if(look[2] == 58) {
    				look[2] = 59;
    			} else if(look[2] == 59) {
    				look[2] = 60;
    			} else if(look[2] == 60) {
    				look[2] = 61;
    			} else if(look[2] == 61) {
    				look[2] = 62;
    			} else if(look[2] == 62) {
    				look[2] = 63;
    			} else if(look[2] == 63) {
    				look[2] = 64;
    			} else if(look[2] == 64) {
    				look[2] = 57;
    			}
    		}
    	}
    	public void setShirtDown() {
    		if(gender == 0) {
    			if(look[2] == 18) {
    				look[2] = 25;
    			} else if(look[2] == 25) {
    				look[2] = 24;
    			} else if(look[2] == 24) {
    				look[2] = 23;
    			} else if(look[2] == 23) {
    				look[2] = 22;
    			} else if(look[2] == 22) {
    				look[2] = 21;
    			} else if(look[2] == 21) {
    				look[2] = 20;
    			} else if(look[2] == 20) {
    				look[2] = 19;
    			} else if(look[2] == 19) {
    				look[2] = 18;
    			}
    		} else if(gender == 1) {
    			if(look[2] == 57) {
    				look[2] = 64;
    			} else if(look[2] == 64) {
    				look[2] = 63;
    			} else if(look[2] == 63) {
    				look[2] = 62;
    			} else if(look[2] == 62) {
    				look[2] = 61;
    			} else if(look[2] == 61) {
    				look[2] = 60;
    			} else if(look[2] == 60) {
    				look[2] = 59;
    			} else if(look[2] == 59) {
    				look[2] = 58;
    			} else if(look[2] == 58) {
    				look[2] = 57;
    			}
    		}
    	}
    	
    	public void setPantsUp() {
    		if(gender == 0) {
    			if(look[5] == 36) {
    				look[5] = 37;
    			} else if(look[5] == 37) {
    				look[5] = 38;
    			} else if(look[5] == 38) {
    				look[5] = 39;
    			} else if(look[5] == 39) {
    				look[5] = 40;
    			} else if(look[5] == 40) {
    				look[5] = 41;
    			} else if(look[5] == 41) {
    				look[5] = 42;
    			} else if(look[5] == 42) {
    				look[5] = 43;
    			} else if(look[5] == 43) {
    				look[5] = 36;
    			}
    		} else if(gender == 1) {
    			if(look[5] == 77) {
    				look[5] = 78;
    			} else if(look[5] == 78) {
    				look[5] = 79;
    			} else if(look[5] == 79) {
    				look[5] = 80;
    			} else if(look[5] == 80) {
    				look[5] = 81;
    			} else if(look[5] == 81) {
    				look[5] = 82;
    			} else if(look[5] == 82) {
    				look[5] = 83;
    			} else if(look[5] == 83) {
    				look[5] = 84;
    			} else if(look[5] == 84) {
    				look[5] = 77;
    			}
    		}
    	}
    	
    	public void setPantsDown() {
    		if(gender == 0) {
    			if(look[5] == 36) {
    				look[5] = 43;
    			} else if(look[5] == 43) {
    				look[5] = 42;
    			} else if(look[5] == 42) {
    				look[5] = 41;
    			} else if(look[5] == 41) {
    				look[5] = 40;
    			} else if(look[5] == 40) {
    				look[5] = 39;
    			} else if(look[5] == 49) {
    				look[5] = 38;
    			} else if(look[5] == 48) {
    				look[5] = 37;
    			} else if(look[5] == 47) {
    				look[5] = 36;
    			}
    		} else if(gender == 1) {
    			if(look[5] == 77) {
    				look[5] = 84;
    			} else if(look[5] == 84) {
    				look[5] = 83;
    			} else if(look[5] == 83) {
    				look[5] = 82;
    			} else if(look[5] == 82) {
    				look[5] = 81;
    			} else if(look[5] == 81) {
    				look[5] = 80;
    			} else if(look[5] == 80) {
    				look[5] = 78;
    			} else if(look[5] == 79) {
    				look[5] = 78;
    			} else if(look[5] == 78) {
    				look[5] = 77;
    			}
    		}
    	}
    
    }


    This is broken because I didn't feel like finding the ID's for every shirt/sleeve/pants/boot/hair/mustache model.


    But you can find this out by logging into the account busker, or changing in the files busker to your username so it will display packet information and click on each button for changing the colors, and just make a new public void for each option you want to change if you follow the system I was doing.


    Good luck finding all those model ID's but this will at least get you started.

    (if you wanted this to work really great, find a way to grab your current appearance and save it as your default appearance because the interface already changes your looks but doesn't save it if you move or the server updates.)
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Discord Johnyblob22#7757


    Join Date
    Mar 2016
    Posts
    1,321
    Thanks given
    256
    Thanks received
    510
    Rep Power
    3849
    noice
    Reply With Quote  
     

  4. #3  
    Registered Member Selseus's Avatar
    Join Date
    Aug 2017
    Posts
    328
    Thanks given
    9
    Thanks received
    46
    Rep Power
    53
    Thanks for the release. I'm sure some will find it very helpful.
    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. Replies: 2
    Last Post: 10-29-2009, 10:04 AM
  2. [508] new options for custom items
    By tinosk in forum Configuration
    Replies: 7
    Last Post: 09-02-2009, 06:42 PM
  3. [508 RS2HD] Basic pestcontrol class
    By w::v::d in forum Snippets
    Replies: 10
    Last Post: 05-24-2009, 06:11 PM
  4. [508-RS2HD] Basic magic class
    By w::v::d in forum Snippets
    Replies: 2
    Last Post: 04-27-2009, 02:22 PM
  5. Replies: 8
    Last Post: 02-13-2008, 10:15 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
  •