Пример #1
0
        public void execute(Player player, string[] arguments) {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[Graphic command]: ::gfx gfx_number");
                return;
            }

            int gfxId = 0;
            if (!int.TryParse(arguments[0], out gfxId))
                gfxId = 0;
            player.setLastGraphics(new Graphics(gfxId, 0, 100));
	    }
	    public static void leverTeleport(Player p, int option) {
		    p.getPackets().closeInterfaces();
		    Location teleLocation = new Location(LEVER_COORDINATES[option][0], LEVER_COORDINATES[option][1], LEVER_COORDINATES[option][2]);
		    
            Event leverTeleportEvent = new Event(200);
            leverTeleportEvent.setAction(() => {
				leverTeleportEvent.stop();
				if (p.getTemporaryAttribute("teleblocked") != null) {
					p.getPackets().sendMessage("A magical force prevents you from teleporting!");
					return;
				} else if ((p.getTemporaryAttribute("teleporting") != null )) {
					return;
				}
				p.setLastAnimation(new Animation(2140));
				p.getPackets().closeInterfaces();
				p.setTemporaryAttribute("teleporting", true);
                p.getWalkingQueue().resetWalkingQueue();
				p.getPackets().clearMapFlag();
				SkillHandler.resetAllSkills(p);
                Event levelTeleportStartEvent = new Event(700);
                levelTeleportStartEvent.setAction(() => {
					levelTeleportStartEvent.stop();
					p.setLastAnimation(new Animation(8939, 0));
					p.setLastGraphics(new Graphics(1576, 0));
                    Event levelTeleportFinishEvent = new Event(1800);
                    levelTeleportFinishEvent.setAction(() => {
                        levelTeleportFinishEvent.stop();
						p.teleport(teleLocation);
						p.setLastAnimation(new Animation(8941, 0));
						p.setLastGraphics(new Graphics(1577, 0));
						Teleport.resetTeleport(p);
					});
                    Server.registerEvent(levelTeleportFinishEvent);
				});
                Server.registerEvent(levelTeleportStartEvent);
		    });
            Server.registerEvent(leverTeleportEvent);
	    }
Пример #3
0
        public static void levelUp(Player player, SKILL skill)
        {
            int    skillIndex = Convert.ToInt32(skill);
            String s          = "<br><br><br>";
            String s1         = "<br><br><br><br>";

            if (player.getTemporaryAttribute("teleporting") == null)
            {
                player.setLastGraphics(new Graphics(199, 0, 100));
            }

            int skillFlashFlags = (int)(player.getTemporaryAttribute("skillFlashFlags") == null ? 0 : (int)player.getTemporaryAttribute("skillFlashFlags"));

            skillFlashFlags |= SKILL_FLASH_BITMASKS[skillIndex];
            player.setTemporaryAttribute("skillFlashFlags", skillFlashFlags);

            player.getPackets().sendMessage("You've just advanced a " + SKILL_NAME[skillIndex] + " level! You have reached level " + player.getSkills().getMaxLevel(skillIndex) + ".");
            player.getPackets().modifyText(s + "Congratulations, you have just advanced a " + SKILL_NAME[skillIndex] + " level!", 740, 0);
            player.getPackets().modifyText(s1 + "You have now reached level " + player.getSkills().getMaxLevel(skillIndex) + ".", 740, 1);
            player.getPackets().modifyText("", 740, 2);
            player.getPackets().sendConfig(1179, SKILL_ICON_BITMASKS[skillIndex] | skillFlashFlags); //start flashing appropriate skill icons
            player.getPackets().sendChatboxInterface2(740);
            player.getUpdateFlags().setAppearanceUpdateRequired(true);
        }
Пример #4
0
        public bool doSpecialAttack(Entity killer, Entity target)
        {
            int  weapon       = ((Player)killer).getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON);
            int  currentPower = specialAmount;
            int  neededPower  = getRequiredAmount(weapon);
            bool rangeWeapon  = false;

            if (!usingSpecial)
            {
                return(false);
            }
            if (p.getDuel() != null)
            {
                if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_SPECIAL_ATTACKS))
                {
                    p.getPackets().sendMessage("Special attacks have been disabled for this duel!");
                    usingSpecial = false;
                    refreshBar();
                    return(false);
                }
            }
            if (neededPower > currentPower)
            {
                ((Player)killer).getPackets().sendMessage("You don't have enough special power left.");
                usingSpecial = false;
                refreshBar();
                return(false);
            }
            double damage          = -1;
            double damage2         = -1;
            double damage3         = -1;
            double damage4         = -1;
            bool   doubleHit       = false;
            int    increasedMaxHit = 0;

            damage  = CombatFormula.getSpecialMeleeHit((Player)killer, target, weapon);
            damage2 = CombatFormula.getSpecialMeleeHit((Player)killer, target, weapon);
            int  hitDelay         = killer.getHitDelay();
            int  usingBow         = ((Player)killer).getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON);
            int  usingArrows      = ((Player)killer).getEquipment().getItemInSlot(ItemData.EQUIP.ARROWS);
            bool usingRangePrayer = false;

            if (target is Player)
            {
                usingRangePrayer = ((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.PROTECT_FROM_RANGED);
            }
            switch (weapon)
            {
            case 4151:             // Whip.
                killer.setLastAnimation(new Animation(1658));
                target.setLastGraphics(new Graphics(341, 0, 100));
                if (misc.random(3) == 0 && damage > 0)
                {
                    damage = p.getMaxHit();
                }
                else
                {
                    damage = 0;
                }
                if (target is Player)
                {
                    int energy = ((Player)target).getRunEnergy() / 4;
                    ((Player)killer).setRunEnergy(((Player)killer).getRunEnergy() + energy);
                    ((Player)target).setRunEnergy(((Player)target).getRunEnergy() - energy);
                    if (((Player)killer).getRunEnergy() > 100)
                    {
                        ((Player)killer).setRunEnergy(100);
                    }
                    if (((Player)target).getRunEnergy() < 0)
                    {
                        ((Player)target).setRunEnergy(0);
                    }
                }
                break;

            case 1215:             // Dragon daggers.
            case 1231:
            case 5680:
            case 5698:
                if (damage > 0)
                {
                    damage  = p.getMaxHit(20);
                    damage2 = p.getMaxHit(20);
                }
                killer.setLastAnimation(new Animation(1062));
                killer.setLastGraphics(new Graphics(252, 0, 100));
                doubleHit = true;

                /*if (misc.random(3) == 0 && CombatFormula.getMeleeHit(p, target) > 0) {
                 * if (damage <= (CombatFormula.getPlayerMaxHit(p, 20) / 2) && damage2 <= (CombatFormula.getPlayerMaxHit(p, 20) / 2))
                 * {
                 * damage = (CombatFormula.getPlayerMaxHit(p, 20) / 2) + (misc.randomDouble(CombatFormula.getPlayerMaxHit(p, 20)) / 2);
                 * damage2 = (CombatFormula.getPlayerMaxHit(p, 20) / 2) + (misc.randomDouble(CombatFormula.getPlayerMaxHit(p, 20)) / 2);
                 *      }
                 * } else if (misc.random(2) == 0) {
                 *      damage = 0;
                 *      damage2 = 0;
                 * }*/
                double a = damage + damage2;
                if (damage > target.getHp())
                {
                    damage = target.getHp();
                }
                a -= damage;
                if (damage2 > a)
                {
                    damage2 = a;
                }

                /*if (damage > target.getHp()) {
                 *      int randomHp = misc.random(target.getHp());
                 *      damage = randomHp;
                 *      damage2 = target.getHp() - randomHp;
                 * } else {
                 *      int hpRemaining = target.getHp() - damage;
                 *      if (damage2 > hpRemaining) {
                 *              damage2 = hpRemaining;
                 *      }
                 * }*/
                break;

            case 1305:             // Dragon longsword.
                killer.setLastAnimation(new Animation(1058));
                killer.setLastGraphics(new Graphics(248, 0, 100));
                damage = p.getMaxHit(30);
                break;

            case 11694:             // Armadyl godsword.
                killer.setLastGraphics(new Graphics(1222, 0, 100));
                killer.setLastAnimation(new Animation(7074));
                damage += p.getMaxHit() * 0.25;                 //25% decrease.
                break;

            case 11696:             // Bandos godsword.
                killer.setLastGraphics(new Graphics(1223, 0, 100));
                killer.setLastAnimation(new Animation(7073));
                damage += p.getMaxHit() * 0.10;     //10% decrease.
                break;

            case 11698:             // Saradomin godsword.
                killer.setLastGraphics(new Graphics(1220, 0, 100));
                killer.setLastAnimation(new Animation(7071));
                int newHp     = (int)(damage * 0.50);              //50% decrease.
                int newPrayer = (int)(damage * 0.25);              //25% decrease
                if (newHp < 10)
                {
                    newHp = 10;
                }
                if (newPrayer < 5)
                {
                    newPrayer = 5;
                }
                ((Player)killer).heal(newHp);
                ((Player)killer).getSkills().setCurLevel(Skills.SKILL.PRAYER, ((Player)killer).getSkills().getCurLevel(Skills.SKILL.PRAYER) + newPrayer);
                if (((Player)killer).getSkills().getCurLevel(Skills.SKILL.PRAYER) > ((Player)killer).getSkills().getMaxLevel(Skills.SKILL.PRAYER))
                {
                    ((Player)killer).getSkills().setCurLevel(Skills.SKILL.PRAYER, ((Player)killer).getSkills().getMaxLevel(Skills.SKILL.PRAYER));
                }
                break;

            case 11700:             // Zamorak godsword
                killer.setLastGraphics(new Graphics(1221, 0, 100));
                killer.setLastAnimation(new Animation(7070));
                target.setLastGraphics(new Graphics(369));
                MagicCombat.freezeTarget(31, target);
                break;

            case 11730:             // Saradomin sword
                target.setLastGraphics(new Graphics(1207, 0, 100));
                killer.setLastAnimation(new Animation(7072));
                increasedMaxHit = 16;
                break;

            case 1434:             // Dragon mace
                hitDelay = 700;
                killer.setLastGraphics(new Graphics(251, 0, 75));
                killer.setLastAnimation(new Animation(1060));
                damage = p.getMaxHit(60);
                break;

            case 3204:             // Dragon halberd
                // TODO halberd
                break;

            case 4587:             // Dragon scimitar
                killer.setLastGraphics(new Graphics(347, 0, 100));
                killer.setLastAnimation(new Animation(451));
                if (target is Player)
                {
                    if (((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.PROTECT_FROM_MELEE) ||
                        ((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.PROTECT_FROM_MAGIC) ||
                        ((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.PROTECT_FROM_RANGED) ||
                        ((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.RETRIBUTION) ||
                        ((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.REDEMPTION) ||
                        ((Player)target).getPrayers().isPrayerActive(PrayerData.Prayer.SMITE))
                    {
                        ((Player)target).getPackets().sendMessage("The Dragon scimitar slashes through your prayer protection!");
                        Prayer.forcePrayerOff((Player)target, PrayerData.Prayer.PROTECT_FROM_MELEE);
                        Prayer.forcePrayerOff((Player)target, PrayerData.Prayer.PROTECT_FROM_MAGIC);
                        Prayer.forcePrayerOff((Player)target, PrayerData.Prayer.PROTECT_FROM_RANGED);
                        Prayer.forcePrayerOff((Player)target, PrayerData.Prayer.RETRIBUTION);
                        Prayer.forcePrayerOff((Player)target, PrayerData.Prayer.REDEMPTION);
                        Prayer.forcePrayerOff((Player)target, PrayerData.Prayer.SMITE);
                    }
                }
                break;

            case 14484:             // Dragon claws
                doubleHit = true;
                killer.setLastGraphics(new Graphics(1950));
                killer.setLastAnimation(new Animation(10961));
                if (misc.random(1) == 0 && damage > 0)
                {
                    if (damage < p.getMaxHit(20) * 0.75)
                    {
                        damage = (p.getMaxHit(20) * 0.75 + (misc.randomDouble((p.getMaxHit(20) * 0.25))));
                    }
                }
                damage  = Math.Floor(damage);
                damage2 = Math.Floor(damage * 0.50);                 //50% decrease
                damage3 = Math.Floor(damage2 * 0.50);                //50% decrease
                damage4 = Math.Floor(damage3 + 1);
                break;

            case 1249:             // Dragon spear
                //TODO leave due to noclipping?
                break;

            case 6739:             // Dragon axe
                //TODO find emote and graphic
                break;

            case 7158:             // Dragon 2h
                killer.setLastAnimation(new Animation(3157));
                killer.setLastGraphics(new Graphics(559));
                //TODO multi combat
                break;

            case 3101:             // Rune claws
                killer.setLastGraphics(new Graphics(274));
                break;

            case 4153:             // Granite maul
                killer.setLastAnimation(new Animation(1667));
                killer.setLastGraphics(new Graphics(340, 0, 100));
                //doubleHit = true;
                break;

            case 10887:             // Barrelchest anchor
                break;

            case 11061:             // Ancient mace
                break;

            case 13902:             // Statius' warhammer
                killer.setLastAnimation(new Animation(10505));
                killer.setLastGraphics(new Graphics(1840));
                damage += killer.getMaxHit() * 0.25;                 //25% decrease
                if (target is Player)
                {
                    int defenceLevel = ((Player)target).getSkills().getCurLevel(Skills.SKILL.DEFENCE);
                    int newDefence   = (int)(defenceLevel * 0.30);                   //30% decrease.
                    if (newDefence < 1)
                    {
                        newDefence = 1;
                    }

                    ((Player)target).getSkills().setCurLevel(Skills.SKILL.DEFENCE, defenceLevel - newDefence);
                    ((Player)target).getPackets().sendSkillLevel(Skills.SKILL.DEFENCE);
                }
                break;

            case 13899:                              // Vesta's longsword
                killer.setLastAnimation(new Animation(10502));
                damage += killer.getMaxHit() * 0.20; //20% decrease
                break;

            case 13905:             // Vesta's spear
                killer.setLastAnimation(new Animation(10499));
                killer.setLastGraphics(new Graphics(1835));
                break;

            case 13883:             // Morrigans throwing axe
                break;

            case 13879:            // Morrigans javelin

            case 8880:             // Dorgeshuun crossbow
                break;

            case 861:             // Magic shortbow
            case 859:             // Magic longbow
            case 10284:           // Magic composite bow
                rangeWeapon = true;
                if (p.getEquipment().getAmountInSlot(ItemData.EQUIP.ARROWS) < 2)
                {
                    p.getPackets().sendMessage("You need 2 arrows to use the Magic bow special attack!");
                    return(false);
                }
                damage   = CombatFormula.getRangeHit((Player)killer, target, usingBow, usingArrows);
                damage2  = CombatFormula.getRangeHit((Player)killer, target, usingBow, usingArrows);
                damage  *= 1.05;                //5% increase.
                damage2 *= 1.05;                //5% increase.
                if (usingRangePrayer)
                {
                    damage  *= 0.60;                    //60% decrease.
                    damage2 *= 0.60;                    //60% decrease.
                }
                double a1 = damage + damage2;
                if (damage > target.getHp())
                {
                    damage = target.getHp();
                }
                a1 -= damage;
                if (damage2 > a1)
                {
                    damage2 = a1;
                }

                /*if (damage >= target.getHp()) {
                 *      int randomHp = misc.random(target.getHp());
                 *      damage = randomHp;
                 *      damage2 = target.getHp() - randomHp;
                 * } else {
                 *      int hpRemaining = target.getHp() - damage;
                 *      if (damage2 > hpRemaining) {
                 *              damage2 = hpRemaining;
                 *      }
                 * }*/
                p.setLastAnimation(new Animation(1074));
                p.setLastGraphics(new Graphics(256, 0, 90));
                RangeCombat.deductArrow(killer);
                RangeCombat.deductArrow(killer);
                int arrowType = RangeCombat.getArrowType(killer);
                hitDelay = 1000;
                int   MSpecCounter = 0;
                Event displayMSpecProjectileEvent = new Event(0);
                displayMSpecProjectileEvent.setAction(() => {
                    RangeCombat.displayMSpecProjectile(killer, target);
                    MSpecCounter++;
                    if (MSpecCounter == 1)
                    {
                        displayMSpecProjectileEvent.setTick(500);
                        p.setLastGraphics(new Graphics(256, 0, 90));
                        Event doMSpecHitEvent = new Event(900);
                        doMSpecHitEvent.setAction(() => {
                            doMSpecHitEvent.stop();
                            target.hit(damage2);
                            RangeCombat.createGroundArrow(killer, target, arrowType);
                        });
                        Server.registerEvent(doMSpecHitEvent);
                    }
                    else
                    {
                        displayMSpecProjectileEvent.stop();
                        return;
                    }
                    MSpecCounter++;
                });
                Server.registerEvent(displayMSpecProjectileEvent);
                break;

            case 805:             // Rune thrownaxe
                rangeWeapon = true;
                break;

            case 6724:             // Seercull
                rangeWeapon = true;
                break;

            case 11235:             // Dark bow
                rangeWeapon = true;
                if (p.getEquipment().getAmountInSlot(ItemData.EQUIP.ARROWS) < 2)
                {
                    p.getPackets().sendMessage("You need 2 arrows to use the Dark bow!");
                    return(false);
                }
                int minHit = 8;
                damage  = CombatFormula.getRangeHit((Player)killer, target, usingBow, usingArrows);
                damage2 = CombatFormula.getRangeHit((Player)killer, target, usingBow, usingArrows);
                if (usingBow == 11235)                   // Dark bow
                {
                    if (usingArrows == 11212)            // Dragon arrows
                    {
                        minHit   = usingRangePrayer ? 4 : 8;
                        damage  *= 1.50;                        //50% increase.
                        damage2 *= 1.50;                        //50% increase.
                        if (damage < minHit)
                        {
                            damage = minHit;
                        }
                        if (damage2 < minHit)
                        {
                            damage2 = minHit;
                        }
                    }
                    else                         // Other arrow
                    {
                        minHit   = usingRangePrayer ? 3 : 5;
                        damage  *= 1.30;                        //30% increase.
                        damage2 *= 1.30;                        //30% increase.
                        if (damage < minHit)
                        {
                            damage = minHit;
                        }
                        if (damage2 < minHit)
                        {
                            damage2 = minHit;
                        }
                    }
                }
                if (usingRangePrayer)
                {
                    damage  *= 0.60;                    //60% decrease.
                    damage2 *= 0.60;                    //60% decrease.
                }
                double a2 = damage + damage2;
                if (damage > target.getHp())
                {
                    damage = target.getHp();
                }
                a2 -= damage;
                if (damage2 > a2)
                {
                    damage2 = a2;
                }

                /*if (damage >= target.getHp()) {
                 *      int randomHp = misc.random(target.getHp());
                 *      damage = randomHp;
                 *      damage2 = target.getHp() - randomHp;
                 * } else {
                 *      int hpRemaining = target.getHp() - damage;
                 *      if (damage2 > hpRemaining) {
                 *              damage2 = hpRemaining;
                 *      }
                 * }*/
                p.setLastGraphics(new Graphics(RangeCombat.getDrawbackGraphic(killer), 0, 90));
                RangeCombat.deductArrow(killer);
                RangeCombat.deductArrow(killer);
                hitDelay = RangeCombat.getHitDelay(killer, target);
                int delayHit = hitDelay;
                hitDelay = 1200;
                int   arrowType1       = RangeCombat.getArrowType(killer);
                int   DBSpecCounter    = 0;
                Event DBSpecProjectile = new Event(0);
                DBSpecProjectile.setAction(() => {
                    RangeCombat.displayDBSpecProjectile(killer, target);
                    DBSpecCounter++;
                    if (DBSpecCounter == 1)
                    {
                        DBSpecProjectile.setTick(200);
                        Event rangeHitEvent = new Event(delayHit + 600);
                        rangeHitEvent.setAction(() => {
                            target.hit(damage2);
                            rangeHitEvent.stop();
                            RangeCombat.createGroundArrow(killer, target, arrowType1);
                        });
                        Server.registerEvent(rangeHitEvent);
                    }
                    else
                    {
                        DBSpecProjectile.stop();
                        return;
                    }
                    DBSpecCounter++;
                });
                Server.registerEvent(DBSpecProjectile);
                break;
            }
            specialAmount -= neededPower;
            p.setSpecialAmount(specialAmount);
            usingSpecial = false;
            refreshBar();
            killer.resetCombatTurns();
            bool hitDouble = doubleHit;

            if (target is Player)
            {
                if (!rangeWeapon)
                {
                    if (((Player)target).getPrayers().getHeadIcon() == PrayerData.PrayerHeadIcon.MELEE)
                    {
                        damage = (damage * 0.60);                 //60% decrease.
                    }
                }
                else
                {
                    if (((Player)target).getPrayers().getHeadIcon() == PrayerData.PrayerHeadIcon.RANGE)
                    {
                        damage = (damage * 0.60);                 //60% decrease
                    }
                }
            }
            damage  = ((weapon == 4151) ? damage : misc.randomDouble(damage));
            damage2 = misc.randomDouble(damage2);
            double d  = ((damage == 0 && weapon != 11730) ? 0 : (damage + increasedMaxHit));
            double d2 = damage2;
            double d3 = damage3; // only used for d claws
            double d4 = damage4; // only used for d claws

            if (canPoison(weapon))
            {
                if (!target.isPoisoned() && misc.random(5) == 0 && (hitDouble ? (d2 > 0 || d > 0) : d > 0))
                {
                    Server.registerEvent(new PoisonEvent(target, POISON_AMOUNT));
                }
            }
            int    hhitDelay   = hitDelay;
            double totalDamage = (damage + damage2 + damage3 + damage4);

            Combat.checkIfWillDie(target, totalDamage);
            Event hitEvent = new Event(hhitDelay);

            hitEvent.setAction(() => {
                hitEvent.stop();
                if (!target.isDead())
                {
                    target.setLastAnimation(new Animation(target.getDefenceAnimation()));
                }
                target.hit(d);
                if (hitDouble)
                {
                    target.hit(d2);
                }
                if (d3 != -1 || d4 != -1)
                {
                    target.hit(d3);
                    target.hit(d4);
                }
                Combat.checkRecoilRing(killer, target, totalDamage);
                Combat.checkSmite(killer, target, totalDamage);
                Combat.checkVengeance(killer, target, totalDamage);
                Combat.addXp(killer, target, totalDamage);
            });
            Server.registerEvent(hitEvent);
            return(true);
        }
Пример #5
0
        /**
 * Handles a skill cape emote: checks appropriate levels,
 * finds the correct animation + graphic, etc.
 * @param player
 */
        public static bool emote(Player player)
        {
            Skills.SKILL skill = Skills.SKILL.ATTACK;
            int skillcapeAnimation = -1, skillcapeGraphic = -1;
            Item cape = player.getEquipment().getSlot(ItemData.EQUIP.CAPE);
            if (cape.getItemId() <= 0)
            {
                return false;
            }
            bool didEmote = true;
            switch (cape.getItemId())
            {
                /*
                 * Attack cape.
                 */
                case 9747:
                case 9748:
                    skill = Skills.SKILL.ATTACK;
                    skillcapeAnimation = 4959;
                    skillcapeGraphic = 823;
                    break;
                /*
                 * Defense cape.
                 */
                case 9753:
                case 9754:
                    skill = Skills.SKILL.DEFENCE;
                    skillcapeAnimation = 4961;
                    skillcapeGraphic = 824;
                    break;
                /*
                 * Strength cape.
                 */
                case 9750:
                case 9751:
                    skill = Skills.SKILL.STRENGTH;
                    skillcapeAnimation = 4981;
                    skillcapeGraphic = 828;
                    break;
                /*
                 * Hitpoints cape.
                 */
                case 9768:
                case 9769:
                    skill = Skills.SKILL.HITPOINTS;
                    skillcapeAnimation = 4971;
                    skillcapeGraphic = 833;
                    break;
                /*
                 * Ranging cape.	
                 */
                case 9756:
                case 9757:
                    skill = Skills.SKILL.RANGE;
                    skillcapeAnimation = 4973;
                    skillcapeGraphic = 832;
                    break;
                /*
                 * Prayer cape.
                 */
                case 9759:
                case 9760:
                    skill = Skills.SKILL.PRAYER;
                    skillcapeAnimation = 4979;
                    skillcapeGraphic = 829;
                    break;
                /*
                 * Magic cape.
                 */
                case 9762:
                case 9763:
                    skill = Skills.SKILL.MAGIC;
                    skillcapeAnimation = 4939;
                    skillcapeGraphic = 813;
                    break;
                /*
                 * Cooking cape.
                 */
                case 9801:
                case 9802:
                    skill = Skills.SKILL.COOKING;
                    skillcapeAnimation = 4955;
                    skillcapeGraphic = 821;
                    break;
                /*
                 * Woodcutting cape.
                 */
                case 9807:
                case 9808:
                    skill = Skills.SKILL.WOODCUTTING;
                    skillcapeAnimation = 4957;
                    skillcapeGraphic = 822;
                    break;
                /*
                 * Fletching cape.
                 */
                case 9783:
                case 9784:
                    skill = Skills.SKILL.FLETCHING;
                    skillcapeAnimation = 4937;
                    skillcapeGraphic = 812;
                    break;
                /*
                 * Fishing cape.
                 */
                case 9798:
                case 9799:
                    skill = Skills.SKILL.FISHING;
                    skillcapeAnimation = 4951;
                    skillcapeGraphic = 819;
                    break;
                /*
                 * Firemaking cape.
                 */
                case 9804:
                case 9805:
                    skill = Skills.SKILL.FIREMAKING;
                    skillcapeAnimation = 4975;
                    skillcapeGraphic = 831;
                    break;
                /*
                 * Crafting cape.
                 */
                case 9780:
                case 9781:
                    skill = Skills.SKILL.CRAFTING;
                    skillcapeAnimation = 4949;
                    skillcapeGraphic = 818;
                    break;
                /*
                 * Smithing cape.
                 */
                case 9795:
                case 9796:
                    skill = Skills.SKILL.SMITHING;
                    skillcapeAnimation = 4943;
                    skillcapeGraphic = 815;
                    break;
                /*
                 * Mining cape.
                 */
                case 9792:
                case 9793:
                    skill = Skills.SKILL.MINING;
                    skillcapeAnimation = 4941;
                    skillcapeGraphic = 814;
                    break;
                /*
                 * Herblore cape.
                 */
                case 9774:
                case 9775:
                    skill = Skills.SKILL.HERBLORE;
                    skillcapeAnimation = 4969;
                    skillcapeGraphic = 835;
                    break;
                /*
                 * Agility cape.
                 */
                case 9771:
                case 9772:
                    skill = Skills.SKILL.AGILITY;
                    skillcapeAnimation = 4977;
                    skillcapeGraphic = 830;
                    break;
                /*
                 * Thieving cape.
                 */
                case 9777:
                case 9778:
                    skill = Skills.SKILL.THIEVING;
                    skillcapeAnimation = 4965;
                    skillcapeGraphic = 826;
                    break;
                /*
                 * Slayer cape.
                 */
                case 9786:
                case 9787:
                    skill = Skills.SKILL.SLAYER;
                    skillcapeAnimation = 4937;//need animation
                    skillcapeGraphic = 812;//need graphic
                    break;
                /*
                 * Farming cape.
                 */
                case 9810:
                case 9811:
                    skill = Skills.SKILL.FARMING;
                    skillcapeAnimation = 4963;
                    skillcapeGraphic = 825;
                    break;
                /*
                 * Runecraft cape.
                 */
                case 9765:
                case 9766:
                    skill = Skills.SKILL.RUNECRAFTING;
                    skillcapeAnimation = 4947;
                    skillcapeGraphic = 817;
                    break;
                /*
                 * Hunter's cape
                 */
                case 9948:
                case 9949:
                    skill = Skills.SKILL.HUNTER;
                    skillcapeAnimation = 5158;
                    skillcapeGraphic = 907;
                    break;
                /*
                 * Construct. cape.
                 */
                case 9789:
                case 9790:
                    skill = Skills.SKILL.CONSTRUCTION;
                    skillcapeAnimation = 4953;
                    skillcapeGraphic = 820;
                    break;
                /*
                 * Summoning cape.
                 */
                case 12169:
                case 12170:
                    skill = Skills.SKILL.SUMMONING;
                    skillcapeAnimation = 8525;
                    skillcapeGraphic = 1515;
                    break;
                /*
                 * Quest cape.
                 */
                case 9813:
                    skillcapeAnimation = 4945;
                    skillcapeGraphic = 816;
                    player.setLastAnimation(new Animation(skillcapeAnimation));
                    player.setLastGraphics(new Graphics(skillcapeGraphic));
                    return true;
                default:
                    didEmote = false;
                    break;
            }
            if (player.getSkills().getMaxLevel(skill) == 99)
            {
                player.setLastAnimation(new Animation(skillcapeAnimation));
                player.setLastGraphics(new Graphics(skillcapeGraphic));
            }
            else
            {
                didEmote = false;
            }
            return didEmote;
        }
	    private void doRedemption(Player p) {
		    p.setLastGraphics(new Graphics(437));
		    if (lastAttacker == null) {
			    return;
		    }
		    if (lastAttacker.isDead() || !lastAttacker.isVisible() || lastAttacker.isDestroyed()) {
			    return;
		    }
		    Location l = p.getLocation();
		    double maxHit = p.getSkills().getMaxLevel(Skills.SKILL.PRAYER) * 0.25;
		    if (lastAttacker.getLocation().inArea(l.getX() - 1, l.getY() - 1, l.getX() + 1, l.getY() + 1)) {
			    double damage = misc.randomDouble(maxHit);
			    if (damage > lastAttacker.getHp()) {
				    damage = lastAttacker.getHp();
			    }
			    lastAttacker.hit(damage);
		    }
		    p.getSkills().setCurLevel(Skills.SKILL.PRAYER, 0);
            p.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
	    }
	    public static bool teleport(Player p, int opt, JewellerySlot js) {
		    if (js == null) {
			    return false;
		    }
		    if (js.index == -1 || js.index > 3 || opt > 6) {
			    return false;
		    }
		    if (!canTeleport(p, js)) {
			    p.getPackets().closeInterfaces();
			    return true;
		    }
		    if ((js.index == 2 && opt == 4) || (js.index != 2 && opt == 6)) {
			    p.getPackets().sendMessage("You stay where you are.");
			    p.getPackets().closeInterfaces();
			    return true;
		    }
		    opt -= 2; // Used to get the 'index' from the button id.
		    p.setLastGraphics(new Graphics(1684));
		    p.setLastAnimation(new Animation(9603));
		    p.getWalkingQueue().resetWalkingQueue();
		    p.getPackets().clearMapFlag();
		    p.setTemporaryAttribute("teleporting", true);
		    p.setTemporaryAttribute("unmovable", true);
		    p.removeTemporaryAttribute("autoCasting");
		    p.removeTemporaryAttribute("lootedBarrowChest");
		    p.setTarget(null);
		    changeJewellery(p, js);
		    int option = opt;
		    p.getPackets().closeInterfaces();
            Event teleportEvent = new Event(2000);
            teleportEvent.setAction(() => {
                teleportEvent.stop();
                p.teleport(new Location(TELEPORT_COORDINATES[js.index][option][0], TELEPORT_COORDINATES[js.index][option][1], 0));
				    p.setLastAnimation(new Animation(65535));
				    Teleport.resetTeleport(p);
				    p.removeTemporaryAttribute("unmovable");
		    });
            Server.registerEvent(teleportEvent);
		    return true;
	    }
Пример #8
0
        public static void levelUp(Player player, SKILL skill)
        {
            int skillIndex = Convert.ToInt32(skill);
            String s = "<br><br><br>";
            String s1 = "<br><br><br><br>";
            if (player.getTemporaryAttribute("teleporting") == null)
            {
                player.setLastGraphics(new Graphics(199, 0, 100));
            }

            int skillFlashFlags = (int)(player.getTemporaryAttribute("skillFlashFlags") == null ? 0 : (int)player.getTemporaryAttribute("skillFlashFlags"));
            skillFlashFlags |= SKILL_FLASH_BITMASKS[skillIndex];
            player.setTemporaryAttribute("skillFlashFlags", skillFlashFlags);

            player.getPackets().sendMessage("You've just advanced a " + SKILL_NAME[skillIndex] + " level! You have reached level " + player.getSkills().getMaxLevel(skillIndex) + ".");
            player.getPackets().modifyText(s + "Congratulations, you have just advanced a " + SKILL_NAME[skillIndex] + " level!", 740, 0);
            player.getPackets().modifyText(s1 + "You have now reached level " + player.getSkills().getMaxLevel(skillIndex) + ".", 740, 1);
            player.getPackets().modifyText("", 740, 2);
            player.getPackets().sendConfig(1179, SKILL_ICON_BITMASKS[skillIndex] | skillFlashFlags); //start flashing appropriate skill icons
            player.getPackets().sendChatboxInterface2(740);
            player.getUpdateFlags().setAppearanceUpdateRequired(true);
        }
 public static void useLever(Player p, int id, Location leverLocation)
 {
     if (p.getTemporaryAttribute("teleporting") != null)
     {
         return;
     }
     foreach (LoadedLaddersAndStairs.Lever lever in LoadedLaddersAndStairs.levers)
     {
         if (lever.getId() == id)
         {
             if (lever.getLeverLocation().Equals(leverLocation))
             {
                 LoadedLaddersAndStairs.Lever l = lever;
                 //TODO when in use it cant be used (in use = lever is facing down)
                 CoordinateEvent useLeverCoordinateEvent = new CoordinateEvent(p, l.getLeverLocation());
                 useLeverCoordinateEvent.setAction(() =>
                 {
                     p.setFaceLocation(l.getFaceLocation());
                     if (p.getTemporaryAttribute("teleblocked") != null)
                     {
                         p.getPackets().sendMessage("A magical force prevents you from teleporting!");
                         return;
                     }
                     else if ((p.getTemporaryAttribute("teleporting") != null))
                     {
                         return;
                     }
                     p.setLastAnimation(new Animation(2140));
                     p.getPackets().closeInterfaces();
                     p.setTemporaryAttribute("teleporting", true);
                     p.getWalkingQueue().resetWalkingQueue();
                     p.getPackets().clearMapFlag();
                     SkillHandler.resetAllSkills(p);
                     l.setInUse(true);
                     Event useLeverEvent = new Event(700);
                     useLeverEvent.setAction(() =>
                     {
                         useLeverEvent.stop();
                         p.setLastAnimation(new Animation(8939, 0));
                         p.setLastGraphics(new Graphics(1576, 0));
                         l.setInUse(false);
                         Event setLeverTeleportEvent = new Event(1800);
                         setLeverTeleportEvent.setAction(() =>
                         {
                             setLeverTeleportEvent.stop();
                             p.teleport(l.getTeleLocation());
                             p.setLastAnimation(new Animation(8941, 0));
                             p.setLastGraphics(new Graphics(1577, 0));
                             Teleport.resetTeleport(p);
                         });
                         Server.registerEvent(setLeverTeleportEvent);
                     });
                     Server.registerEvent(useLeverEvent);
                 });
                 Server.registerCoordinateEvent(useLeverCoordinateEvent);
                 break;
             }
         }
     }
 }
Пример #10
0
        /**
         * Handles a player emote: does the appropriate animation.
         * @param player
         * @param buttonId
         * @return
         */
        public static bool emote(Player player, int buttonId)
        {
            if (buttonId == 2)
            {
                player.setLastAnimation(new Animation(855, 0));
            }
            else if (buttonId == 3)
            {
                player.setLastAnimation(new Animation(856, 0));
            }
            else if (buttonId == 4)
            {
                player.setLastAnimation(new Animation(858, 0));
            }
            else if (buttonId == 5)
            {
                player.setLastAnimation(new Animation(859, 0));
            }
            else if (buttonId == 6)
            {
                player.setLastAnimation(new Animation(857, 0));
            }
            else if (buttonId == 7)
            {
                player.setLastAnimation(new Animation(863, 0));
            }
            else if (buttonId == 8)
            {
                player.setLastAnimation(new Animation(2113, 0));
            }
            else if (buttonId == 9)
            {
                player.setLastAnimation(new Animation(862, 0));
            }
            else if (buttonId == 10)
            {
                player.setLastAnimation(new Animation(864, 0));
            }
            else if (buttonId == 11)
            {
                player.setLastAnimation(new Animation(861, 0));
            }
            else if (buttonId == 12)
            {
                player.setLastAnimation(new Animation(2109, 0));
            }
            else if (buttonId == 13)
            {
                player.setLastAnimation(new Animation(2111, 0));
            }
            else if (buttonId == 14)
            {
                player.setLastAnimation(new Animation(866, 0));
            }
            else if (buttonId == 15)
            {
                player.setLastAnimation(new Animation(2106, 0));
            }
            else if (buttonId == 16)
            {
                player.setLastAnimation(new Animation(2107, 0));
            }
            else if (buttonId == 17)
            {
                player.setLastAnimation(new Animation(2108, 0));
            }
            else if (buttonId == 18)
            {
                player.setLastAnimation(new Animation(860, 0));
            }
            else if (buttonId == 19)
            {
                player.setLastAnimation(new Animation(0x558, 0));
                player.setLastGraphics(new Graphics(574, 0));
            }
            else if (buttonId == 20)
            {
                player.setLastAnimation(new Animation(2105, 0));
            }
            else if (buttonId == 21)
            {
                player.setLastAnimation(new Animation(2110, 0));
            }
            else if (buttonId == 22)
            {
                player.setLastAnimation(new Animation(865, 0));
            }
            else if (buttonId == 23)
            {
                player.setLastAnimation(new Animation(2112, 0));
            }
            else if (buttonId == 24)
            {
                player.setLastAnimation(new Animation(0x84F, 0));
            }
            else if (buttonId == 25)
            {
                player.setLastAnimation(new Animation(0x850, 0));
            }
            else if (buttonId == 26)
            {
                player.setLastAnimation(new Animation(1131, 0));
            }
            else if (buttonId == 27)
            {
                player.setLastAnimation(new Animation(1130, 0));
            }
            else if (buttonId == 28)
            {
                player.setLastAnimation(new Animation(1129, 0));
            }
            else if (buttonId == 29)
            {
                player.setLastAnimation(new Animation(1128, 0));
            }
            else if (buttonId == 30)
            {
                player.setLastAnimation(new Animation(4275, 0));
            }
            else if (buttonId == 31)
            {
                player.setLastAnimation(new Animation(1745, 0));
            }
            else if (buttonId == 32)
            {
                player.setLastAnimation(new Animation(4280, 0));
            }
            else if (buttonId == 33)
            {
                player.setLastAnimation(new Animation(4276, 0));
            }
            else if (buttonId == 34)
            {
                player.setLastAnimation(new Animation(3544, 0));
            }
            else if (buttonId == 35)
            {
                player.setLastAnimation(new Animation(3543, 0));
            }
            else if (buttonId == 36)
            {
                player.setLastAnimation(new Animation(7272, 0));
                player.setLastGraphics(new Graphics(1244, 0));
            }
            else if (buttonId == 37)
            {
                player.setLastAnimation(new Animation(2836, 0));
            }
            else if (buttonId == 38)
            {
                player.setLastAnimation(new Animation(6111, 0));
            }
            else if (buttonId == 39)
            {
                Skillcape.emote(player);
            }
            else if (buttonId == 40)
            {
                player.setLastAnimation(new Animation(7531, 0));
            }
            else if (buttonId == 41)
            {
                player.setLastAnimation(new Animation(2414, 0));
                player.setLastGraphics(new Graphics(1537, 0));
            }
            else if (buttonId == 42)
            {
                player.setLastAnimation(new Animation(8770, 0));
                player.setLastGraphics(new Graphics(1553, 0));
            }
            else if (buttonId == 43) // Explore
            {
                player.setLastAnimation(new Animation(9990, 0));
                player.setLastGraphics(new Graphics(1734, 0));
            } 
            else if (buttonId == 44) { // Trick
                player.setLastAnimation(new Animation(10530, 0));
                player.setLastGraphics(new Graphics(1864, 0));
            }
            else if (buttonId == 45) { // Freeze
                player.setLastAnimation(new Animation(11044, 0));
                player.setLastGraphics(new Graphics(1973, 0));
            }
            else if (buttonId == 46)
            {
                //TODO: lol todo.. umm ya.. unmovable remover is here so.. 
                //it can be used to cheat to remove unmovable spells haha.
                //to fix: make another unmovable check so there would be 2 ways to become unmovable.

                //trigger the turkey emote event which changes animation/graphic based on delay.
                if (player.getTemporaryAttribute("turkeyEmoteInProgress") == null) {
                    player.setTemporaryAttribute("turkeyEmoteStage", 11);
                    player.setTemporaryAttribute("turkeyEmoteInProgress", 1);
                } else {
                    //Force cancellation of the turkeyEmote Event.
                    player.setTemporaryAttribute("turkeyEmoteStage", -1);
                    //Don't create a new event until the old one is stopped.
                    return false;
                }

                Event turkeyEmoteEvent = new Event(500); //500 milliseconds per stage timer (adjust this for better results).
                turkeyEmoteEvent.setAction(() =>
                {
                    int turkeyEmoteStage = (int)(player.getTemporaryAttribute("turkeyEmoteStage") == null ? -1 : (int)player.getTemporaryAttribute("turkeyEmoteStage"));

                    if (turkeyEmoteStage <= 0)
                    {
                        //kill off this event.
                        turkeyEmoteEvent.stop();
                        player.removeTemporaryAttribute("unmovable");
                        player.setTemporaryAttribute("turkeyEmoteInProgress", null);
                        return;
                    }

                    if (turkeyEmoteStage == 11) {
                        player.setLastAnimation(new Animation(10994, 0));
                    } else if (turkeyEmoteStage == 10) {
                        player.setLastGraphics(new Graphics(1714, 0));
                    } else if (turkeyEmoteStage == 9) {
                        player.setLastAnimation(new Animation(10996, 0));
                        player.setTemporaryAttribute("unmovable", true);
                        player.getAppearance().setNpcId(8499);
                        player.getUpdateFlags().setAppearanceUpdateRequired(true);
                    } else if (turkeyEmoteStage == 1) {
                        player.setLastAnimation(new Animation(10995, 0));
                        player.setLastGraphics(new Graphics(1714, 0));
                        player.getAppearance().setNpcId(-1);
                        player.getUpdateFlags().setAppearanceUpdateRequired(true);
                        player.removeTemporaryAttribute("unmovable");
                        player.removeTemporaryAttribute("turkeyEmoteStage");
                    }
                    if (turkeyEmoteStage > 0) {
                        turkeyEmoteStage--;
                        player.setTemporaryAttribute("turkeyEmoteStage", turkeyEmoteStage);
                    }
                });
                Server.registerEvent(turkeyEmoteEvent);
            }
            else
            {
                return false;
            }
            return true;
        }
Пример #11
0
	    public static void fightCaveAttacks(Npc npc, Player p) {
		    if (npc.isDead() || npc.isDestroyed() || p.isDead() || p.isDestroyed() || p.isDead() || !Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
			    return;
		    }
		    double damage = misc.randomDouble(npc.getMaxHit());
            PrayerData.PrayerHeadIcon prayerHeadIcon = p.getPrayers().getHeadIcon();
		    int hitDelay = npc.getHitDelay();
		    int animation = npc.getAttackAnimation();
		    switch(npc.getId()) {
			    case 2734: // Tz-Kih (lvl 22)
			    case 2735:
                    if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MELEE)
                    {
					    damage = 0;
				    }
				    break;
				
			    case 2739: // Tz-Xil (lvl 90)
			    case 2740:
                    if (prayerHeadIcon == PrayerData.PrayerHeadIcon.RANGE)
                    {
					    damage = 0;
				    }
				    p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1616, 50, 40, 34, 50, p);
				    break;
				
			    case 2741: // Yt-MejKot (lvl 180)
			    case 2742:
                    if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MELEE)
                    {
					    damage = 0;
				    }
				    // TODO healing
				    break;
				
			    case 2743: // Ket-Zek (lvl 360)
			    case 2744:
				    if (!p.getLocation().withinDistance(npc.getLocation(), 2)) {
					    hitDelay = 1600;
					    animation = 9266;
					    npc.setLastGraphics(new Graphics(1622));
					    damage = misc.randomDouble(49);
                        if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MAGIC)
                        {
						    damage = 0;
					    }
                        Event sendProjectileToNpc = new Event(300);
                        sendProjectileToNpc.setAction(() => {
							sendProjectileToNpc.stop();
							p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1623, 50, 40, 34, 80, p);
					    });
                        Server.registerEvent(sendProjectileToNpc);
				    } else {
					    damage = misc.randomDouble(64);
                        if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MELEE)
                        {
						    damage = 0;
					    }
				    }
				    break;
				
			    case 2745: // TzTok Jad (lvl 702)
				    doJadAttacks(p, npc);
				    break;
		    }
		    if (npc.getId() == 2745){
			    return;
		    }
		    if (animation != 65535) {
			    npc.setLastAnimation(new Animation(animation));
		    }
            p.setLastAttacked(Environment.TickCount);
            npc.setLastAttack(Environment.TickCount);
		    p.setAttacker(npc);
		    npc.resetCombatTurns();
		    if (damage > p.getHp()) {
			    damage = p.getHp();
		    }
		    int npcId = npc.getId();

            Event losePrayerFightingEvent = new Event(hitDelay);
            losePrayerFightingEvent.setAction(() => {
				losePrayerFightingEvent.stop();
				if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
					return;
				}
				if (npcId == 2734 || npcId == 2735) {
                    int prayerLevel = p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
                    int newPrayerLevel = prayerLevel -= (int)(damage + 1);
					if (newPrayerLevel <= 0) {
						newPrayerLevel = 0;
					}
					p.getSkills().setCurLevel(Skills.SKILL.PRAYER, newPrayerLevel);
                    p.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
				} else if (npcId == 2743 || npcId == 2744) {
					if (misc.random(1) == 0) {
						p.setLastGraphics(new Graphics(1624, 0));
					}
				}
				if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
					p.setLastAnimation(new Animation(p.getDefenceAnimation()));
				}
                p.hit(damage);
		    });
            Server.registerEvent(losePrayerFightingEvent);
	    }
Пример #12
0
	    private static void doJadAttacks(Player p, Npc npc) {
		    if (npc.getHp() <= (npc.getMaxHp() * 0.50)) {
			    if (p.getFightCave() != null) {
                    if (!p.getFightCave().isHealersSpawned())
                    {
					    summonJadHealers(p, npc);
					    p.getFightCave().setHealersSpawned(true);
				    }
			    }
		    }
		    npc.resetCombatTurns();
		    npc.setEntityFocus(p.getClientIndex());
		    switch(misc.random(1)) {
			    case 0: // Range
				    npc.setLastAnimation(new Animation(9276));
				    npc.setLastGraphics(new Graphics(1625));
                    Event jadRangeAttackEvent = new Event(1600);
                    int jadRangeAttackStatus = 0;
                    jadRangeAttackEvent.setAction(() => {
					    double hit = 0;
                        PrayerData.PrayerHeadIcon prayerHeadIcon = p.getPrayers().getHeadIcon();
                        if (jadRangeAttackStatus == 0)
                        {
                            jadRangeAttackStatus++;
							jadRangeAttackEvent.setTick(1500);
							p.setLastGraphics(new Graphics(451));
                            if (prayerHeadIcon == PrayerData.PrayerHeadIcon.RANGE)
								hit = 0;
							else
								hit = misc.randomDouble(96);
						} else {
                            if (prayerHeadIcon != PrayerData.PrayerHeadIcon.RANGE)
								hit = misc.randomDouble(96);
							jadRangeAttackEvent.stop();
                            p.setLastAttacked(Environment.TickCount);
                            npc.setLastAttack(Environment.TickCount);
							p.setAttacker(npc);
							if (hit > p.getHp()) {
								hit = p.getHp();
							}
							if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
								return;
							}
							if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
								p.setLastAnimation(new Animation(p.getDefenceAnimation()));
							}
							p.hit(hit);
                            Event animationEvent = new Event(100);
                            animationEvent.setAction(() => {
								animationEvent.stop();
								p.setLastGraphics(new Graphics(157, 0, 100));
							});
                            Server.registerEvent(animationEvent);
						}
				    });
                    Server.registerEvent(jadRangeAttackEvent);
				    break;
	
			    case 1: // Magic
				    npc.setLastGraphics(new Graphics(1626));
                    Event jadMagicAttackEvent = new Event(300);
                    int jadMagicAttackStatus = 0;
                    jadMagicAttackEvent.setAction(() => {
					    double hit = 0;
						PrayerData.PrayerHeadIcon prayerHeadIcon = p.getPrayers().getHeadIcon();
						npc.setLastAnimation(new Animation(9278));
                        if (jadMagicAttackStatus == 0)
                        {
                            jadMagicAttackStatus++;
							jadMagicAttackEvent.setTick(1600);
							p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1627, 50, 40, 34, 90, p);
						} else {
							jadMagicAttackEvent.stop();
                            if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MAGIC)
                            {
								hit = 0;
							} else {
								hit = misc.randomDouble(96);
							}
                            p.setLastAttacked(Environment.TickCount);
                            npc.setLastAttack(Environment.TickCount);
							p.setAttacker(npc);
							if (hit > p.getHp()) {
								hit = p.getHp();
							}
							if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
								return;
							}
							if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
								p.setLastAnimation(new Animation(p.getDefenceAnimation()));
							}
							p.hit(hit);
                            Event animationEvent = new Event(100);
                            animationEvent.setAction(() => {
								animationEvent.stop();
								p.setLastGraphics(new Graphics(157, 0, 100));
							});
                            Server.registerEvent(animationEvent);
						}
				    });
                    Server.registerEvent(jadMagicAttackEvent);
				    break;
		    }
	    }