Exemple #1
0
        public static void addXp(Entity killer, Entity target, double damage)
        {
            int xpRate = 230;

            if ((killer is Player) && (target is Npc))
            {
                Player     p    = (Player)killer;
                CombatType type = p.getLastCombatType();
                AttackStyle.CombatSkill fightType  = p.getAttackStyle().getSkill();
                AttackStyle.CombatStyle fightStyle = p.getAttackStyle().getStyle();
                if (type == CombatType.MELEE)
                {
                    if (!fightType.Equals(AttackStyle.CombatSkill.CONTROLLED))
                    {
                        Skills.SKILL skill = Skills.SKILL.ATTACK;
                        if (fightType.Equals(AttackStyle.CombatSkill.ACCURATE))
                        {
                            skill = Skills.SKILL.ATTACK;
                        }
                        else if (fightType.Equals(AttackStyle.CombatSkill.DEFENSIVE))
                        {
                            skill = Skills.SKILL.DEFENCE;
                        }
                        else if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE))
                        {
                            skill = Skills.SKILL.STRENGTH;
                        }
                        p.getSkills().addXp(skill, (xpRate * damage));
                        p.getSkills().addXp(Skills.SKILL.HITPOINTS, (xpRate * 0.30));
                    }
                    else
                    {
                        p.getSkills().addXp(Skills.SKILL.ATTACK, ((xpRate * 0.30) * damage));
                        p.getSkills().addXp(Skills.SKILL.DEFENCE, ((xpRate * 0.30) * damage));
                        p.getSkills().addXp(Skills.SKILL.STRENGTH, ((xpRate * 0.30) * damage));
                        p.getSkills().addXp(Skills.SKILL.HITPOINTS, (0.25 * damage));
                    }
                }
                else
                {
                    if (fightStyle.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || fightStyle.Equals(AttackStyle.CombatStyle.RANGE_RAPID))
                    {
                        p.getSkills().addXp(Skills.SKILL.RANGE, (xpRate * damage));
                    }
                    else if (fightStyle.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE))
                    {
                        p.getSkills().addXp(Skills.SKILL.RANGE, ((xpRate * 0.50) * damage));
                        p.getSkills().addXp(Skills.SKILL.DEFENCE, ((xpRate * 0.50) * damage));
                    }
                    p.getSkills().addXp(Skills.SKILL.HITPOINTS, ((xpRate * 0.30) * damage));
                }
            }
            target.addToHitCount(killer, damage);
        }
Exemple #2
0
        public static void setButtonForAttackStyle(Player p, int interfaceId)
        {
            if (interfaceId == -1)
            {
                return;
            }
            AttackStyle av = p.getAttackStyle();

            AttackStyle.CombatSkill type  = av.getSkill();
            AttackStyle.CombatStyle type2 = av.getStyle();
            int slot = av.getSlot();

            switch (interfaceId)
            {
            case 92:     // Unarmed
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 93:     // Whip attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 89:     // Dagger attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if ((type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.STAB)) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if ((type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH)))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 82:     // Longsword/scimitar attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.CRUSH))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 78:     // Claw attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 81:     // Godsword attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 88:     // Mace attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 76:     // Granite maul attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 77:     // Bow attack interface.
                if (type2.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_RAPID) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 75:     // Battleaxe attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.CRUSH))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 91:     // Thrown weapon
                if (type2.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_RAPID) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 85:     // Spear
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 90:     // Staff interface
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;
            }
        }