Thread: 317 Attack Style Bug

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by MidgardPK View Post
    I was trying older weapons, custom weapons and new. Oak shortbow, bronze dagger, dragon claws, ags, korasi, and then a few customs ive put in.
    can you post the whole of your Weaponinterfaces.java then please, obviously missing something
    Reply With Quote  
     

  2. #12  
    Registered Member
    Join Date
    May 2021
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Perplexity View Post
    can you post the whole of your Weaponinterfaces.java then please, obviously missing something
    package com.arlania.model.definitions;

    import java.util.HashMap;
    import java.util.Map;

    import com.arlania.model.Item;
    import com.arlania.util.JsonLoader;
    import com.arlania.world.content.combat.weapon.CombatSpec ial;
    import com.arlania.world.content.combat.weapon.FightType;
    import com.arlania.world.entity.impl.player.Player;
    import com.google.gson.Gson;
    import com.google.gson.JsonObject;

    /**
    * A static utility class that displays holds and displays data for weapon
    * interfaces.
    *
    * @author lare96
    */
    public final class WeaponInterfaces {

    /** A map of items and their respective interfaces. */
    private static Map<Integer, WeaponInterface> interfaces = new HashMap<>(500);

    /**
    * All of the interfaces for weapons and the data needed to display these
    * interfaces properly.
    *
    * @author lare96
    */
    public enum WeaponInterface {
    STAFF(328, 331, 6, new FightType[] { FightType.STAFF_BASH, FightType.STAFF_POUND, FightType.STAFF_FOCUS }),
    WARHAMMER(425, 428, 6, new FightType[] { FightType.WARHAMMER_POUND,
    FightType.WARHAMMER_PUMMEL, FightType.WARHAMMER_BLOCK }, 7474, 7486),

    FASTSPEED0(2276, 2279, 0, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    //Fastest Speed
    FASTSPEED(2276, 2279, 1, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    // Second fastest
    FASTSPEED1(2276, 2279, 2, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    //Third fastest
    FASTSPEED2(2276, 2279, 3, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    //Fourth fastest

    FASTSPEED3(2276, 2279, 4, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),




    SCYTHE(776, 779, 6, new FightType[] { FightType.SCYTHE_REAP,
    FightType.SCYTHE_CHOP, FightType.SCYTHE_JAB,
    FightType.SCYTHE_BLOCK }),
    BATTLEAXE(1698, 1701, 6, new FightType[] { FightType.BATTLEAXE_CHOP,
    FightType.BATTLEAXE_HACK, FightType.BATTLEAXE_SMASH,
    FightType.BATTLEAXE_BLOCK }, 7499, 7511),
    CROSSBOW(1764, 1767, 5, new FightType[] { FightType.CROSSBOW_ACCURATE,
    FightType.CROSSBOW_RAPID, FightType.CROSSBOW_LONGRANGE }, 7524, 7536),
    SHORTBOW(1764, 1767, 5, new FightType[] { FightType.SHORTBOW_ACCURATE,
    FightType.SHORTBOW_RAPID, FightType.SHORTBOW_LONGRANGE }, 7549, 7561),
    LONGBOW(1764, 1767, 6, new FightType[] { FightType.LONGBOW_ACCURATE,
    FightType.LONGBOW_RAPID, FightType.LONGBOW_LONGRANGE }, 7549, 7561),
    DAGGER(2276, 2279, 4, new FightType[] { FightType.DAGGER_STAB,
    FightType.DAGGER_LUNGE, FightType.DAGGER_SLASH,
    FightType.DAGGER_BLOCK }, 7574, 7586),
    SWORD(2276, 2279, 5, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    SCIMITAR(2423, 2426, 5, new FightType[] { FightType.SCIMITAR_CHOP,
    FightType.SCIMITAR_SLASH, FightType.SCIMITAR_LUNGE,
    FightType.SCIMITAR_BLOCK }, 7599, 7611),
    LONGSWORD(2423, 2426, 6, new FightType[] { FightType.LONGSWORD_CHOP,
    FightType.LONGSWORD_SLASH, FightType.LONGSWORD_LUNGE,
    FightType.LONGSWORD_BLOCK }, 7599, 7611),
    MACE(3796, 3799, 4, new FightType[] { FightType.MACE_POUND,
    FightType.MACE_PUMMEL, FightType.MACE_SPIKE,
    FightType.MACE_BLOCK }, 7624, 7636),
    KNIFE(4446, 4449, 4, new FightType[] { FightType.KNIFE_ACCURATE,
    FightType.KNIFE_RAPID, FightType.KNIFE_LONGRANGE }, 7649, 7661),
    SPEAR(4679, 4682, 6, new FightType[] { FightType.SPEAR_LUNGE,
    FightType.SPEAR_SWIPE, FightType.SPEAR_POUND,
    FightType.SPEAR_BLOCK }, 7674, 7686),
    TWO_HANDED_SWORD(4705, 4708, 6, new FightType[] {
    FightType.TWOHANDEDSWORD_CHOP, FightType.TWOHANDEDSWORD_SLASH,
    FightType.TWOHANDEDSWORD_SMASH, FightType.TWOHANDEDSWORD_BLOCK }, 7699, 7711),
    PICKAXE(5570, 5573, 6, new FightType[] { FightType.PICKAXE_SPIKE,
    FightType.PICKAXE_IMPALE, FightType.PICKAXE_SMASH,
    FightType.PICKAXE_BLOCK }),
    CLAWS(7762, 7765, 4, new FightType[] { FightType.CLAWS_CHOP,
    FightType.CLAWS_SLASH, FightType.CLAWS_LUNGE,
    FightType.CLAWS_BLOCK }, 7800, 7812),
    HALBERD(8460, 8463, 6, new FightType[] { FightType.HALBERD_JAB,
    FightType.HALBERD_SWIPE, FightType.HALBERD_FEND }, 8493, 8505),
    UNARMED(5855, 5857, 6, new FightType[] { FightType.UNARMED_PUNCH,
    FightType.UNARMED_KICK, FightType.UNARMED_BLOCK }),
    WHIP(12290, 12293, 4, new FightType[] { FightType.WHIP_FLICK,
    FightType.WHIP_LASH, FightType.WHIP_DEFLECT }, 12323, 12335),
    THROWNAXE(4446, 4449, 6, new FightType[] {
    FightType.THROWNAXE_ACCURATE, FightType.THROWNAXE_RAPID,
    FightType.THROWNAXE_LONGRANGE }, 7649, 7661),
    DART(4446, 4449, 4, new FightType[] { FightType.DART_ACCURATE,
    FightType.DART_RAPID, FightType.DART_LONGRANGE }, 7649, 7661),
    JAVELIN(4446, 4449, 6, new FightType[] { FightType.JAVELIN_ACCURATE,
    FightType.JAVELIN_RAPID, FightType.JAVELIN_LONGRANGE }, 7649, 7661);

    /** The interface that will be displayed on the sidebar. */
    private int interfaceId;

    /** The line that the name of the item will be printed to. */
    private int nameLineId;

    /** The attack speed of weapons using this interface. */
    private int speed;

    /** The fight types that correspond with this interface. */
    private FightType[] fightType;

    /** The id of the special bar for this interface. */
    private int specialBar;

    /** The id of the special meter for this interface. */
    private int specialMeter;

    /**
    * Creates a new weapon interface.
    *
    * @Param interfaceId
    * the interface that will be displayed on the sidebar.
    * @Param nameLineId
    * the line that the name of the item will be printed to.
    * @Param speed
    * the attack speed of weapons using this interface.
    * @Param fightType
    * the fight types that correspond with this interface.
    * @Param specialBar
    * the id of the special bar for this interface.
    * @Param specialMeter
    * the id of the special meter for this interface.
    */
    private WeaponInterface(int interfaceId, int nameLineId, int speed,
    FightType[] fightType, int specialBar, int specialMeter) {
    this.interfaceId = interfaceId;
    this.nameLineId = nameLineId;
    this.speed = speed;
    this.fightType = fightType;
    this.specialBar = specialBar;
    this.specialMeter = specialMeter;
    }

    /**
    * Creates a new weapon interface.
    *
    * @Param interfaceId
    * the interface that will be displayed on the sidebar.
    * @Param nameLineId
    * the line that the name of the item will be printed to.
    * @Param speed
    * the attack speed of weapons using this interface.
    * @Param fightType
    * the fight types that correspond with this interface.
    */
    private WeaponInterface(int interfaceId, int nameLineId, int speed,
    FightType[] fightType) {
    this(interfaceId, nameLineId, speed, fightType, -1, -1);
    }

    /**
    * Gets the interface that will be displayed on the sidebar.
    *
    * @Return the interface id.
    */
    public int getInterfaceId() {
    return interfaceId;
    }

    /**
    * Gets the line that the name of the item will be printed to.
    *
    * @Return the name line id.
    */
    public int getNameLineId() {
    return nameLineId;
    }

    /**
    * Gets the attack speed of weapons using this interface.
    *
    * @Return the attack speed of weapons using this interface.
    */
    public int getSpeed() {
    return speed;
    }

    /**
    * Gets the fight types that correspond with this interface.
    *
    * @Return the fight types that correspond with this interface.
    */
    public FightType[] getFightType() {
    return fightType;
    }

    /**
    * Gets the id of the special bar for this interface.
    *
    * @Return the id of the special bar for this interface.
    */
    public int getSpecialBar() {
    return specialBar;
    }

    /**
    * Gets the id of the special meter for this interface.
    *
    * @Return the id of the special meter for this interface.
    */
    public int getSpecialMeter() {
    return specialMeter;
    }
    }

    /**
    * Assigns an interface to the combat sidebar based on the argued weapon.
    *
    * @Param player
    * the player that the interface will be assigned for.
    * @Param item
    * the item that the interface will be chosen for.
    */
    public static void assign(Player player, Item item) {
    WeaponInterface weapon;
    FightType fightStyle;

    fightStyle = player.getFightType();

    if(item == null || item.getId() == -1) {
    weapon = WeaponInterface.UNARMED;
    } else {
    weapon = interfaces.get(item.getId());
    }

    if(weapon == null)
    weapon = WeaponInterface.UNARMED;

    if (weapon == WeaponInterface.UNARMED) {
    player.getPacketSender().sendTabInterface(0, weapon.getInterfaceId());
    player.getPacketSender().sendString(weapon.getName LineId(), "Unarmed");
    player.setWeapon(WeaponInterface.UNARMED);
    } else if (weapon == WeaponInterface.CROSSBOW) {
    player.getPacketSender().sendString(weapon.getName LineId() - 1, "Weapon: ");
    } else if (weapon == WeaponInterface.WHIP) {
    player.getPacketSender().sendString(weapon.getName LineId() - 1, "Weapon: ");
    }

    player.getPacketSender().sendItemOnInterface(
    weapon.getInterfaceId() + 1, 200, item.getId());
    player.getPacketSender().sendTabInterface(0,
    weapon.getInterfaceId());
    player.getPacketSender().sendString(
    weapon.getNameLineId(), item.getDefinition().getName());
    player.setWeapon(weapon);
    CombatSpecial.assign(player);
    CombatSpecial.updateBar(player);

    for (FightType type : weapon.getFightType()) {
    if (type.getStyle() == player.getFightType().getStyle()) {
    player.setFightType(type);
    player.getPacketSender().sendConfig(player.getFigh tType().getParentId(), player.getFightType().getChildId());
    return;
    }
    }

    int fightTypeIndex = 0;

    if(fightStyle != null) { //Fix for weapon style changes
    if(fightStyle.getChildId() < weapon.getFightType().length) {
    fightTypeIndex = fightStyle.getChildId();
    }
    }

    player.setFightType(player.getWeapon().getFightTyp e()[fightTypeIndex]);
    player.getPacketSender().sendConfig(player.getFigh tType().getParentId(), player.getFightType().getChildId());
    }

    /**
    * Prepares the dynamic json loader for loading weapon interfaces.
    *
    * @Return the dynamic json loader.
    * @ThroWs Exception
    * if any errors occur while preparing for load.
    */
    public static JsonLoader parseInterfaces() {
    return new JsonLoader() {
    @Override
    public void load(JsonObject reader, Gson builder) {
    int id = reader.get("item-id").getAsInt();
    WeaponInterface animation = builder.fromJson(
    reader.get("interface"), WeaponInterface.class);
    interfaces.put(id, animation);
    }

    @Override
    public String filePath() {
    return "./data/def/json/weapon_interfaces.json";
    }
    };
    }
    }
    Reply With Quote  
     

  3. #13  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by MidgardPK View Post
    package com.arlania.model.definitions;

    import java.util.HashMap;
    import java.util.Map;

    import com.arlania.model.Item;
    import com.arlania.util.JsonLoader;
    import com.arlania.world.content.combat.weapon.CombatSpec ial;
    import com.arlania.world.content.combat.weapon.FightType;
    import com.arlania.world.entity.impl.player.Player;
    import com.google.gson.Gson;
    import com.google.gson.JsonObject;

    /**
    * A static utility class that displays holds and displays data for weapon
    * interfaces.
    *
    * @author lare96
    */
    public final class WeaponInterfaces {

    /** A map of items and their respective interfaces. */
    private static Map<Integer, WeaponInterface> interfaces = new HashMap<>(500);

    /**
    * All of the interfaces for weapons and the data needed to display these
    * interfaces properly.
    *
    * @author lare96
    */
    public enum WeaponInterface {
    STAFF(328, 331, 6, new FightType[] { FightType.STAFF_BASH, FightType.STAFF_POUND, FightType.STAFF_FOCUS }),
    WARHAMMER(425, 428, 6, new FightType[] { FightType.WARHAMMER_POUND,
    FightType.WARHAMMER_PUMMEL, FightType.WARHAMMER_BLOCK }, 7474, 7486),

    FASTSPEED0(2276, 2279, 0, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    //Fastest Speed
    FASTSPEED(2276, 2279, 1, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    // Second fastest
    FASTSPEED1(2276, 2279, 2, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    //Third fastest
    FASTSPEED2(2276, 2279, 3, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    //Fourth fastest

    FASTSPEED3(2276, 2279, 4, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),




    SCYTHE(776, 779, 6, new FightType[] { FightType.SCYTHE_REAP,
    FightType.SCYTHE_CHOP, FightType.SCYTHE_JAB,
    FightType.SCYTHE_BLOCK }),
    BATTLEAXE(1698, 1701, 6, new FightType[] { FightType.BATTLEAXE_CHOP,
    FightType.BATTLEAXE_HACK, FightType.BATTLEAXE_SMASH,
    FightType.BATTLEAXE_BLOCK }, 7499, 7511),
    CROSSBOW(1764, 1767, 5, new FightType[] { FightType.CROSSBOW_ACCURATE,
    FightType.CROSSBOW_RAPID, FightType.CROSSBOW_LONGRANGE }, 7524, 7536),
    SHORTBOW(1764, 1767, 5, new FightType[] { FightType.SHORTBOW_ACCURATE,
    FightType.SHORTBOW_RAPID, FightType.SHORTBOW_LONGRANGE }, 7549, 7561),
    LONGBOW(1764, 1767, 6, new FightType[] { FightType.LONGBOW_ACCURATE,
    FightType.LONGBOW_RAPID, FightType.LONGBOW_LONGRANGE }, 7549, 7561),
    DAGGER(2276, 2279, 4, new FightType[] { FightType.DAGGER_STAB,
    FightType.DAGGER_LUNGE, FightType.DAGGER_SLASH,
    FightType.DAGGER_BLOCK }, 7574, 7586),
    SWORD(2276, 2279, 5, new FightType[] { FightType.SWORD_STAB,
    FightType.SWORD_LUNGE, FightType.SWORD_SLASH,
    FightType.SWORD_BLOCK }, 7574, 7586),
    SCIMITAR(2423, 2426, 5, new FightType[] { FightType.SCIMITAR_CHOP,
    FightType.SCIMITAR_SLASH, FightType.SCIMITAR_LUNGE,
    FightType.SCIMITAR_BLOCK }, 7599, 7611),
    LONGSWORD(2423, 2426, 6, new FightType[] { FightType.LONGSWORD_CHOP,
    FightType.LONGSWORD_SLASH, FightType.LONGSWORD_LUNGE,
    FightType.LONGSWORD_BLOCK }, 7599, 7611),
    MACE(3796, 3799, 4, new FightType[] { FightType.MACE_POUND,
    FightType.MACE_PUMMEL, FightType.MACE_SPIKE,
    FightType.MACE_BLOCK }, 7624, 7636),
    KNIFE(4446, 4449, 4, new FightType[] { FightType.KNIFE_ACCURATE,
    FightType.KNIFE_RAPID, FightType.KNIFE_LONGRANGE }, 7649, 7661),
    SPEAR(4679, 4682, 6, new FightType[] { FightType.SPEAR_LUNGE,
    FightType.SPEAR_SWIPE, FightType.SPEAR_POUND,
    FightType.SPEAR_BLOCK }, 7674, 7686),
    TWO_HANDED_SWORD(4705, 4708, 6, new FightType[] {
    FightType.TWOHANDEDSWORD_CHOP, FightType.TWOHANDEDSWORD_SLASH,
    FightType.TWOHANDEDSWORD_SMASH, FightType.TWOHANDEDSWORD_BLOCK }, 7699, 7711),
    PICKAXE(5570, 5573, 6, new FightType[] { FightType.PICKAXE_SPIKE,
    FightType.PICKAXE_IMPALE, FightType.PICKAXE_SMASH,
    FightType.PICKAXE_BLOCK }),
    CLAWS(7762, 7765, 4, new FightType[] { FightType.CLAWS_CHOP,
    FightType.CLAWS_SLASH, FightType.CLAWS_LUNGE,
    FightType.CLAWS_BLOCK }, 7800, 7812),
    HALBERD(8460, 8463, 6, new FightType[] { FightType.HALBERD_JAB,
    FightType.HALBERD_SWIPE, FightType.HALBERD_FEND }, 8493, 8505),
    UNARMED(5855, 5857, 6, new FightType[] { FightType.UNARMED_PUNCH,
    FightType.UNARMED_KICK, FightType.UNARMED_BLOCK }),
    WHIP(12290, 12293, 4, new FightType[] { FightType.WHIP_FLICK,
    FightType.WHIP_LASH, FightType.WHIP_DEFLECT }, 12323, 12335),
    THROWNAXE(4446, 4449, 6, new FightType[] {
    FightType.THROWNAXE_ACCURATE, FightType.THROWNAXE_RAPID,
    FightType.THROWNAXE_LONGRANGE }, 7649, 7661),
    DART(4446, 4449, 4, new FightType[] { FightType.DART_ACCURATE,
    FightType.DART_RAPID, FightType.DART_LONGRANGE }, 7649, 7661),
    JAVELIN(4446, 4449, 6, new FightType[] { FightType.JAVELIN_ACCURATE,
    FightType.JAVELIN_RAPID, FightType.JAVELIN_LONGRANGE }, 7649, 7661);

    /** The interface that will be displayed on the sidebar. */
    private int interfaceId;

    /** The line that the name of the item will be printed to. */
    private int nameLineId;

    /** The attack speed of weapons using this interface. */
    private int speed;

    /** The fight types that correspond with this interface. */
    private FightType[] fightType;

    /** The id of the special bar for this interface. */
    private int specialBar;

    /** The id of the special meter for this interface. */
    private int specialMeter;

    /**
    * Creates a new weapon interface.
    *
    * @Param interfaceId
    * the interface that will be displayed on the sidebar.
    * @Param nameLineId
    * the line that the name of the item will be printed to.
    * @Param speed
    * the attack speed of weapons using this interface.
    * @Param fightType
    * the fight types that correspond with this interface.
    * @Param specialBar
    * the id of the special bar for this interface.
    * @Param specialMeter
    * the id of the special meter for this interface.
    */
    private WeaponInterface(int interfaceId, int nameLineId, int speed,
    FightType[] fightType, int specialBar, int specialMeter) {
    this.interfaceId = interfaceId;
    this.nameLineId = nameLineId;
    this.speed = speed;
    this.fightType = fightType;
    this.specialBar = specialBar;
    this.specialMeter = specialMeter;
    }

    /**
    * Creates a new weapon interface.
    *
    * @Param interfaceId
    * the interface that will be displayed on the sidebar.
    * @Param nameLineId
    * the line that the name of the item will be printed to.
    * @Param speed
    * the attack speed of weapons using this interface.
    * @Param fightType
    * the fight types that correspond with this interface.
    */
    private WeaponInterface(int interfaceId, int nameLineId, int speed,
    FightType[] fightType) {
    this(interfaceId, nameLineId, speed, fightType, -1, -1);
    }

    /**
    * Gets the interface that will be displayed on the sidebar.
    *
    * @Return the interface id.
    */
    public int getInterfaceId() {
    return interfaceId;
    }

    /**
    * Gets the line that the name of the item will be printed to.
    *
    * @Return the name line id.
    */
    public int getNameLineId() {
    return nameLineId;
    }

    /**
    * Gets the attack speed of weapons using this interface.
    *
    * @Return the attack speed of weapons using this interface.
    */
    public int getSpeed() {
    return speed;
    }

    /**
    * Gets the fight types that correspond with this interface.
    *
    * @Return the fight types that correspond with this interface.
    */
    public FightType[] getFightType() {
    return fightType;
    }

    /**
    * Gets the id of the special bar for this interface.
    *
    * @Return the id of the special bar for this interface.
    */
    public int getSpecialBar() {
    return specialBar;
    }

    /**
    * Gets the id of the special meter for this interface.
    *
    * @Return the id of the special meter for this interface.
    */
    public int getSpecialMeter() {
    return specialMeter;
    }
    }

    /**
    * Assigns an interface to the combat sidebar based on the argued weapon.
    *
    * @Param player
    * the player that the interface will be assigned for.
    * @Param item
    * the item that the interface will be chosen for.
    */
    public static void assign(Player player, Item item) {
    WeaponInterface weapon;
    FightType fightStyle;

    fightStyle = player.getFightType();

    if(item == null || item.getId() == -1) {
    weapon = WeaponInterface.UNARMED;
    } else {
    weapon = interfaces.get(item.getId());
    }

    if(weapon == null)
    weapon = WeaponInterface.UNARMED;

    if (weapon == WeaponInterface.UNARMED) {
    player.getPacketSender().sendTabInterface(0, weapon.getInterfaceId());
    player.getPacketSender().sendString(weapon.getName LineId(), "Unarmed");
    player.setWeapon(WeaponInterface.UNARMED);
    } else if (weapon == WeaponInterface.CROSSBOW) {
    player.getPacketSender().sendString(weapon.getName LineId() - 1, "Weapon: ");
    } else if (weapon == WeaponInterface.WHIP) {
    player.getPacketSender().sendString(weapon.getName LineId() - 1, "Weapon: ");
    }

    player.getPacketSender().sendItemOnInterface(
    weapon.getInterfaceId() + 1, 200, item.getId());
    player.getPacketSender().sendTabInterface(0,
    weapon.getInterfaceId());
    player.getPacketSender().sendString(
    weapon.getNameLineId(), item.getDefinition().getName());
    player.setWeapon(weapon);
    CombatSpecial.assign(player);
    CombatSpecial.updateBar(player);

    for (FightType type : weapon.getFightType()) {
    if (type.getStyle() == player.getFightType().getStyle()) {
    player.setFightType(type);
    player.getPacketSender().sendConfig(player.getFigh tType().getParentId(), player.getFightType().getChildId());
    return;
    }
    }

    int fightTypeIndex = 0;

    if(fightStyle != null) { //Fix for weapon style changes
    if(fightStyle.getChildId() < weapon.getFightType().length) {
    fightTypeIndex = fightStyle.getChildId();
    }
    }

    player.setFightType(player.getWeapon().getFightTyp e()[fightTypeIndex]);
    player.getPacketSender().sendConfig(player.getFigh tType().getParentId(), player.getFightType().getChildId());
    }

    /**
    * Prepares the dynamic json loader for loading weapon interfaces.
    *
    * @Return the dynamic json loader.
    * @ThroWs Exception
    * if any errors occur while preparing for load.
    */
    public static JsonLoader parseInterfaces() {
    return new JsonLoader() {
    @Override
    public void load(JsonObject reader, Gson builder) {
    int id = reader.get("item-id").getAsInt();
    WeaponInterface animation = builder.fromJson(
    reader.get("interface"), WeaponInterface.class);
    interfaces.put(id, animation);
    }

    @Override
    public String filePath() {
    return "./data/def/json/weapon_interfaces.json";
    }
    };
    }
    }
    ok can you now find item 4151 in weapon_interfaces.json for me and post the code surrounding it ?
    Reply With Quote  
     

  4. #14  
    Registered Member
    Join Date
    May 2021
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Perplexity View Post
    can you post the whole of your Weaponinterfaces.java then please, obviously missing something

    {
    "hash": 4151,
    "item-id": 4151,
    "interface": "WHIP"
    },
    Reply With Quote  
     

  5. #15  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by MidgardPK View Post
    {
    "hash": 4151,
    "item-id": 4151,
    "interface": "WHIP"
    },
    and when you equip item 4151 ingame it still shows up as unarmed?
    Reply With Quote  
     

  6. #16  
    Registered Member
    Join Date
    May 2021
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Perplexity View Post
    and when you equip item 4151 ingame it still shows up as unarmed?
    Correct, I get all the weapon stats that are coded for the item, it just doesn't change the combat interface
    Reply With Quote  
     

  7. #17  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by MidgardPK View Post
    Correct, I get all the weapon stats that are coded for the item, it just doesn't change the combat interface
    can you check you have

    serviceLoader.execute(() -> WeaponInterfaces.parseInterfaces().load());

    in your

    private void executeServiceLoad() {
    Reply With Quote  
     

  8. #18  
    Registered Member
    Join Date
    May 2021
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Perplexity View Post
    can you check you have

    serviceLoader.execute(() -> WeaponInterfaces.parseInterfaces().load());

    in your

    private void executeServiceLoad() {
    Yeah thats there
    Reply With Quote  
     

  9. #19  
    Registered Member
    Join Date
    Apr 2021
    Posts
    32
    Thanks given
    1
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Perplexity View Post
    can you check you have

    serviceLoader.execute(() -> WeaponInterfaces.parseInterfaces().load());

    in your

    private void executeServiceLoad() {
    The image on OP shows that the tab is registering the weapon, but not the fight style. So I think the issue might be in fighttype or fightstyle class for some reason the id is returning null
    Reply With Quote  
     

  10. #20  
    Registered Member
    Join Date
    May 2021
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Perplexity View Post
    can you check you have

    serviceLoader.execute(() -> WeaponInterfaces.parseInterfaces().load());

    in your

    private void executeServiceLoad() {
    I just combed through the entire weapon_interfaces.json and fought a } was one space off of where it should've been, putting it in the proper place fixed it.
    A big error on my part that I didnt catch as I didnt notice the bug til a few days after. Wouldn't have found it without your suggestions either, thank you. Please send me a message on discord as well Nocturn#2034
    Reply With Quote  
     

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)


User Tag List

Similar Threads

  1. Replies: 9
    Last Post: 09-16-2019, 08:29 AM
  2. attacking style 317 [HELP]
    By taymor in forum Help
    Replies: 0
    Last Post: 05-04-2017, 11:03 PM
  3. [317] 474 Attack Styles [REMAKE]
    By Deku in forum Snippets
    Replies: 7
    Last Post: 11-11-2016, 12:09 AM
  4. attack style bug
    By unrealscape in forum Help
    Replies: 0
    Last Post: 06-09-2013, 10:33 PM
  5. Changing attack styles? 317 Delta
    By tuna guy in forum Help
    Replies: 3
    Last Post: 07-02-2011, 03:53 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
  •