Thread: Male items on female character..

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Male items on female character.. 
    Project - Bliss
    Austin's Avatar
    Join Date
    Dec 2009
    Posts
    253
    Thanks given
    61
    Thanks received
    35
    Rep Power
    14
    So i'm using ruse and the server isn't understanding when you're a female? If you switch to female, log out and check the character's file it says male.

    If i manually change it to female, all the items i wear convert perfectly, i wear female items. The game just doesn't register when you're a female.. Can't find a fix anywhere


    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2016
    Posts
    7
    Thanks given
    0
    Thanks received
    6
    Rep Power
    0
    Your problem seems to be that it never saves it in character files.
    Never worked with Ruse, but I guess you should look at clicking and saving.
    Reply With Quote  
     

  3. #3  
    Project - Bliss
    Austin's Avatar
    Join Date
    Dec 2009
    Posts
    253
    Thanks given
    61
    Thanks received
    35
    Rep Power
    14
    Quote Originally Posted by Chip1 View Post
    Your problem seems to be that it never saves it in character files.
    Never worked with Ruse, but I guess you should look at clicking and saving.
    Thanks for the reply, i'm getting closer to solving the issue i believe but not quiet..

    This is the "accept" button on the makeover mage interface in my button clicking :

    Code:
    		case 3651:
    			Appearance.canChangeAppearance();
    			if (Appearance.BEARD == -1) {
    		player.getAppearance().setGender(Gender.valueOf("FEMALE"));
    	player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}else {
    		player.getAppearance().setGender(Gender.valueOf("MALE"));	
    		player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}
    	break;
    this is my appearance.java

    Code:
    package com.ruse.model;
    
    import com.ruse.world.entity.impl.player.Player;
    
    /**
     * This file manages a player's appearance and properties, such as head hints, gender, prayer head hints, etc.
     * 
     * @author relex lawl
     */
    
    public class Appearance {
    	
    	/**
    	 * Player's current gender.
    	 */
    	private static Gender gender = Gender.MALE;
    	
    	/**
    	 * Can the player change appearance right now?
    	 */
    	private static boolean canChangeAppearance = false;
    	
    	/**
    	 * The player's head icon hint.
    	 */
    	private int headHint = -1;
    	
    	/**
    	 * The player's bounty hunter skull.
    	 */
    	private int bountyHunterSkull = -1;
    	
    	/**
    	 * Gets the player's gender.
    	 * @return	gender.
    	 */
    	public static Gender getGender() {
    		return gender;
    	}
    	
    	/**
    	 * Sets the player's gender.
    	 * @param gender	Gender to set to.
    	 */
    	public Appearance setGender(Gender gender) {
    		this.gender = gender;
    		player.getUpdateFlag().flag(Flag.APPEARANCE);
    		return this;
    	}
    	
    	/**
    	 * Gets the player's current head hint index.
    	 * @return	The player's head hint.
    	 */
    	public int getHeadHint() {
    		return headHint;
    	}
    
    	/**
    	 * Sets the player's head icon hint.
    	 * @param headHint	The hint index to use.
    	 * @return			The Appearance instance.
    	 */
    	public Appearance setHeadHint(int headHint) {
    		this.headHint = headHint;
    		player.getUpdateFlag().flag(Flag.APPEARANCE);
    		return this;
    	}
    
    	/**
    	 * Gets the player's current bounty hunter skull.
    	 * @return	The player's skull hint.
    	 */
    	public int getBountyHunterSkull() {
    		return bountyHunterSkull;
    	}
    	
    	/**
    	 * Sets the player's bounty hunter skull.
    	 * @param skullHint	The skull hint index to use.
    	 * @return			The Appearance instance.
    	 */
    	public Appearance setBountyHunterSkull(int skullHint) {
    		this.bountyHunterSkull = skullHint;
    		player.getUpdateFlag().flag(Flag.APPEARANCE);
    		return this;
    	}
    	
    	/**
    	 * Checks if a player can change appearance right now
    	 * @return the canChangeAppearance value
    	 */
    	public static boolean canChangeAppearance() {
    		return canChangeAppearance;
    	}
    	
    	/**
    	 * Sets if a player can change appearance right now
    	 * @param l	The value to set
    	 */
    	public void setCanChangeAppearance(boolean l) {
    		this.canChangeAppearance = l;
    	}
    
    	/**
    	 * Gets the look array, which is an array with 13 elements describing the
    	 * look of a player.
    	 * @return The look array.
    	 */
    	public static int[] getLook() {
    		return look;
    	}
    	
    	/**
    	 * Sets the look array.
    	 * @param look The look array.
    	 * @throws IllegalArgumentException if the array length is not 12.
    	 */
    	public void set(int[] look) {
    		if(look.length < 12) {
    			throw new IllegalArgumentException("Array length must be 12.");
    		}
    		this.look = look;
    		player.getUpdateFlag().flag(Flag.APPEARANCE);
    	}
    	
    	/**
    	 * Sets a specific look.
    	 * @param index		Array index to set.
    	 * @param look		Value to change look[index] to.
    	 */
    	public void set(int index, int look) {
    		this.look[index] = look;
    		player.getUpdateFlag().flag(Flag.APPEARANCE);
    	}
    	
    	/**
    	 * The player's current character clothing.
    	 */
    	public static int[] look = new int[13];
    	
    	/**
    	 * The Appearance constructor, also sets
    	 * the player's default clothing.
    	 * @param player	The associated player.
    	 */
    	public Appearance(Player player) {
    		this.player = player;
    		set();
    	}
    	
    	/**
    	 * Sets the player's default clothing.
    	 */
    	public void set() {
    		if (gender == Gender.MALE) {
    			look[HEAD] = 3;
    			look[CHEST] = 18;
    			look[ARMS] = 26;
    			look[HANDS] = 34;
    			look[LEGS] = 38;
    			look[FEET] = 42;
    			look[BEARD] = 14;
    		} else {
    			look[HEAD] = 48;
    			look[CHEST] = 57;
    			look[ARMS] = 65;
    			look[HANDS] = 68;
    			look[LEGS] = 77;
    			look[FEET] = 80;
    			look[BEARD] = 57;
    		}
    		look[HAIR_COLOUR] = 2;
    		look[TORSO_COLOUR] = 14;
    		look[LEG_COLOUR] = 5;
    		look[FEET_COLOUR] = 4;
    		look[SKIN_COLOUR] = 0;
    		player.getUpdateFlag().flag(Flag.APPEARANCE);
    	}
    	
    	/**
    	 * The associated player.
    	 */
    	private Player player;
    
    	/**
    	 * The index of said body part color in the look array.
    	 */
    	public static final int HAIR_COLOUR = 8, TORSO_COLOUR = 9, LEG_COLOUR = 10, FEET_COLOUR = 11, SKIN_COLOUR = 12,
    							HEAD = 1, CHEST = 2, ARMS = 3, HANDS = 4, LEGS = 5, FEET = 6, BEARD = 7, GENDER = 0;
    }

    And finally my changeapppearancepacketlistener.java

    Code:
    package com.ruse.net.packet.impl;
    
    import com.ruse.model.Appearance;
    import com.ruse.model.Flag;
    import com.ruse.net.packet.Packet;
    import com.ruse.net.packet.PacketListener;
    import com.ruse.util.Misc;
    import com.ruse.world.entity.impl.player.Player;
    
    public class ChangeAppearancePacketListener implements PacketListener {
    
    	@Override
    	public void handleMessage(Player player, Packet packet) {
    		String appearanceAttributes = Misc.readString(packet.getBuffer());
    		if(appearanceAttributes == null || appearanceAttributes.length() <= 1)
    			return;
    		try {
    			String[] parts = appearanceAttributes.split(" ");
    			int gender = Integer.parseInt(parts[0]);
    			if(gender != 0 && gender != 1) {
    				return;
    			}
    			final int[] apperances = new int[MALE_VALUES.length];
    			final int[] colors = new int[ALLOWED_COLORS.length];
    			int currentPartIndex = 1;
    			for (int i = 0; i < apperances.length; i++, currentPartIndex++) {
    				int value = Integer.parseInt(parts[currentPartIndex]);
    				if (value < (gender == 0 ? MALE_VALUES[i][0] : FEMALE_VALUES[i][0]) || value > (gender == 0 ? MALE_VALUES[i][1] : FEMALE_VALUES[i][1]))
    					value = (gender == 0 ? MALE_VALUES[i][0] : FEMALE_VALUES[i][0]);
    				apperances[i] = value;
    			}
    			for (int i = 0; i < colors.length; i++, currentPartIndex++) {
    				int value = Integer.parseInt(parts[currentPartIndex]);
    				if (value < ALLOWED_COLORS[i][0] || value > ALLOWED_COLORS[i][1])
    					value = ALLOWED_COLORS[i][0];
    				colors[i] = value;
    			}
    			if(player.getAppearance().canChangeAppearance() && player.getInterfaceId() > 0) {
    				//Appearance looks
    				player.getAppearance().set(Appearance.GENDER, gender);
    				player.getAppearance().set(Appearance.HEAD, apperances[0]);
    				player.getAppearance().set(Appearance.CHEST, apperances[2]);
    				player.getAppearance().set(Appearance.ARMS, apperances[3]);
    				player.getAppearance().set(Appearance.HANDS, apperances[4]);
    				player.getAppearance().set(Appearance.LEGS, apperances[5]);
    				player.getAppearance().set(Appearance.FEET, apperances[6]);
    				player.getAppearance().set(Appearance.BEARD, apperances[1]);
    
    				//Colors
    				player.getAppearance().set(Appearance.HAIR_COLOUR, colors[0]);
    				player.getAppearance().set(Appearance.TORSO_COLOUR, colors[1]);
    				player.getAppearance().set(Appearance.LEG_COLOUR, colors[2]);
    				player.getAppearance().set(Appearance.FEET_COLOUR, colors[3]);
    				player.getAppearance().set(Appearance.SKIN_COLOUR, colors[4]);
    
    				player.getUpdateFlag().flag(Flag.APPEARANCE);
    			}
    		} catch(Exception e) {
    			player.getAppearance().set();
    			//e.printStackTrace();
    		}
    		player.getPacketSender().sendInterfaceRemoval();
    		player.getAppearance().setCanChangeAppearance(false);
    	}
    
    	private static final int[][] ALLOWED_COLORS = { 
    		{ 0, 11 }, // hair color
    		{ 0, 15 }, // torso color
    		{ 0, 15 }, // legs color
    		{ 0, 5 }, // feet color
    		{ 0, 7 } // skin color
    	};
    
    	static final int[][] FEMALE_VALUES = {
    		{ 45, 54 }, // head
    		{ -1, -1 }, // jaw
    		{ 56, 60 }, // torso
    		{ 61, 65 }, // arms
    		{ 67, 68 }, // hands
    		{ 70, 77 }, // legs
    		{ 79, 80 }, // feet
    	};
    
    	static final int[][] MALE_VALUES = {
    		{ 0, 8 }, // head
    		{ 10, 17 }, // jaw
    		{ 18, 25 }, // torso
    		{ 26, 31 }, // arms
    		{ 33, 34 }, // hands
    		{ 36, 40 }, // legs
    		{ 42, 43 }, // feet
    	};
    }
    The server will load and save your gender correctly; there's just no way to change it via the makeover mage i think.


    Reply With Quote  
     

  4. #4  
    Community Veteran


    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,833
    Thanks given
    187
    Thanks received
    306
    Discord
    View profile
    Rep Power
    770
    Make sure it saves or loads the gender correctly. You might have to debug and check it it really do.


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

  5. #5  
    Project - Bliss
    Austin's Avatar
    Join Date
    Dec 2009
    Posts
    253
    Thanks given
    61
    Thanks received
    35
    Rep Power
    14
    Quote Originally Posted by arch337 View Post
    Make sure it saves or loads the gender correctly. You might have to debug and check it it really do.
    It loads and saves correctly, the issue is when you press female in the interface screen it doesn't register.. you get female models and stuff but when the character wears an item..



    Here's an example i made where the santa NPC sets your character to female




    Essentially, i need a way to make it know you're a female or male in the makeover mage and switch your character accordingly i suppose..

    Thanks for the response by the way! any help is really appreciated

    Essentially.. If i could find a button ID for male or female like in this



    The fix is obvious. But female and male have no button id? ugh


    Reply With Quote  
     

  6. #6  
    Community Veteran


    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,833
    Thanks given
    187
    Thanks received
    306
    Discord
    View profile
    Rep Power
    770
    not sure if you need to update the player:

    Code:
    
    		case 3651:
    			Appearance.canChangeAppearance();
    			if (Appearance.BEARD == -1) {
    		player.getAppearance().setGender(Gender.valueOf("FEMALE"));
    	player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}else {
    		player.getAppearance().setGender(Gender.valueOf("MALE"));	
    		player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}
    player.getUpdateFlag().flag(Flag.APPEARANCE);
    	break;
    Also you need to set the correct values for the female clothing + color compare to what the man had.
    Check this:
    Code:
    static final int[][] FEMALE_VALUES = {
    		{ 45, 54 }, // head
    		{ -1, -1 }, // jaw
    		{ 56, 60 }, // torso
    		{ 61, 65 }, // arms
    		{ 67, 68 }, // hands
    		{ 70, 77 }, // legs
    		{ 79, 80 }, // feet
    	};
    
    	static final int[][] MALE_VALUES = {
    		{ 0, 8 }, // head
    		{ 10, 17 }, // jaw
    		{ 18, 25 }, // torso
    		{ 26, 31 }, // arms
    		{ 33, 34 }, // hands
    		{ 36, 40 }, // legs
    		{ 42, 43 }, // feet
    	};
    }


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

  7. #7  
    Project - Bliss
    Austin's Avatar
    Join Date
    Dec 2009
    Posts
    253
    Thanks given
    61
    Thanks received
    35
    Rep Power
    14
    Quote Originally Posted by arch337 View Post
    not sure if you need to update the player:

    Code:
    
    		case 3651:
    			Appearance.canChangeAppearance();
    			if (Appearance.BEARD == -1) {
    		player.getAppearance().setGender(Gender.valueOf("FEMALE"));
    	player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}else {
    		player.getAppearance().setGender(Gender.valueOf("MALE"));	
    		player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}
    player.getUpdateFlag().flag(Flag.APPEARANCE);
    	break;
    Also you need to set the correct values for the female clothing + color compare to what the man had.
    Check this:
    Code:
    static final int[][] FEMALE_VALUES = {
    		{ 45, 54 }, // head
    		{ -1, -1 }, // jaw
    		{ 56, 60 }, // torso
    		{ 61, 65 }, // arms
    		{ 67, 68 }, // hands
    		{ 70, 77 }, // legs
    		{ 79, 80 }, // feet
    	};
    
    	static final int[][] MALE_VALUES = {
    		{ 0, 8 }, // head
    		{ 10, 17 }, // jaw
    		{ 18, 25 }, // torso
    		{ 26, 31 }, // arms
    		{ 33, 34 }, // hands
    		{ 36, 40 }, // legs
    		{ 42, 43 }, // feet
    	};
    }
    Appreciate the help, i tried your ideas and no avail :/


    Essentially.. If i could find a button ID for male or female like in this



    The fix is obvious. But female and male have no button id? ugh


    Reply With Quote  
     

  8. #8  
    Community Veteran


    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,833
    Thanks given
    187
    Thanks received
    306
    Discord
    View profile
    Rep Power
    770
    Quote Originally Posted by Austin View Post
    Appreciate the help, i tried your ideas and no avail :/


    Essentially.. If i could find a button ID for male or female like in this



    The fix is obvious. But female and male have no button id? ugh
    try:

    Code:
    case 3651:
    			//Appearance.canChangeAppearance();
    int[] new_look = {45, 11, 46, 43, 41, 34, 37};
    			if (Appearance.gender == Gender.MALE) {
    player.getAppearance().setGender(Gender.valueOf("FEMALE"));
    for(int i = 0; i < Appearance.look.length - 5; i++) {
    if(i == 1) new_look[i] = -(Appearance.look[i] + 1);
    Appearance.set(i, Appearance.look[i] + new_look[i]);
    }
    	player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	} else {
    		player.getAppearance().setGender(Gender.valueOf("MALE"));	
    for(int i = 0; i < Appearance.look.length - 5; i++) {
    if(i == 1) new_look[i] = -new_look[i];
    Appearance.set(i, Appearance.look[i] - new_look[i]);
    }
    		player.getPacketSender().sendMessage("You are a "+Appearance.getGender()+ "");
    	}
    player.getUpdateFlag().flag(Flag.APPEARANCE);
    	break;
    As I assume you just want santa to transform you from female to male and vice versa.
    Also pretty sure the character design interface has it's own packet.


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

  9. #9  
    Banned

    Join Date
    Nov 2016
    Posts
    91
    Thanks given
    39
    Thanks received
    24
    Rep Power
    0
    This is triggering
    Reply With Quote  
     

  10. #10  
    Project - Bliss
    Austin's Avatar
    Join Date
    Dec 2009
    Posts
    253
    Thanks given
    61
    Thanks received
    35
    Rep Power
    14
    Quote Originally Posted by Bit Logic View Post
    This is triggering
    You obviously don't know the fix if that's all you can say :^)

    Coming close to fixing it..this works BUT i have to make over mage twice in order for it to work..
    Code:
    		case 3651:
    			Appearance.canChangeAppearance();
    
    			player.getAppearance().setCanChangeAppearance(true);
    			player.getUpdateFlag().flag(Flag.APPEARANCE);
    			if (Appearance.look[1] >= 45) {
    				//if (Appearance.look[7] > 50) {
    				//if (Appearance.look[1] >= 45) {
    				//Appearance.look[0] = 1;
    		player.getAppearance().setGender(Gender.valueOf("FEMALE"));
    		player.getPacketSender().sendMessage("You are a <col=0000FF>"+Appearance.getGender()+ "");
    
    			}else {
    				
    		//Appearance.look[0] = 1;
    		player.getAppearance().setGender(Gender.valueOf("MALE"));	
    		player.getPacketSender().sendMessage("You are a <col=0000FF>"+Appearance.getGender()+ "");
    	}


    Reply With Quote  
     

Page 1 of 2 12 LastLast

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: 5
    Last Post: 09-28-2016, 01:51 PM
  2. Replies: 4
    Last Post: 04-11-2014, 08:57 PM
  3. Invisible Items on Female characters
    By Conscientia in forum Help
    Replies: 2
    Last Post: 04-11-2014, 06:35 PM
  4. 634 items on 317 characters
    By Mael in forum Help
    Replies: 3
    Last Post: 03-31-2013, 01:24 AM
  5. Male Armor on Females?
    By Blazerker in forum Help
    Replies: 0
    Last Post: 10-24-2009, 11:14 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
  •