當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.getSkills方法代碼示例

本文整理匯總了C#中RS2.Server.player.Player.getSkills方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.getSkills方法的具體用法?C# Player.getSkills怎麽用?C# Player.getSkills使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RS2.Server.player.Player的用法示例。


在下文中一共展示了Player.getSkills方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: checkOverdose

 public static void checkOverdose(Player p, Skills.SKILL skill)
 {
     if (p.getSkills().getCurLevel(skill) >= p.getSkills().getMaxLevel(skill))
     {
         p.getSkills().setCurLevel(skill, p.getSkills().getMaxLevel(skill));
     }
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:7,代碼來源:Consumables.cs

示例2: execute

 public void execute(Player player, string[] arguments)
 {
     foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL)))
     {
         player.getSkills().setCurLevel(skill, 99);
         player.getSkills().setXp(skill, Skills.getXpForLevel(99));
     }
     player.getPackets().sendSkillLevels();
     player.getUpdateFlags().setAppearanceUpdateRequired(true);
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:10,代碼來源:Master.cs

示例3: getMeleeAttack

 public static double getMeleeAttack(Player p)
 {
     int attBonus = getHighestAttBonus(p);
     int attLevel = p.getSkills().getCurLevel(Skills.SKILL.ATTACK);
     double power = (attLevel + attBonus) * 0.01365;
     double amount = 1.260;
     power *= (attLevel * (power * 0.12)) + (attBonus * amount) * (power * 0.009);
     if (p.getPrayers().getAttackPrayer() == 1)
     {
         power *= 1.05;
     }
     else if (p.getPrayers().getAttackPrayer() == 2)
     {
         power *= 1.10;
     }
     else if (p.getPrayers().getAttackPrayer() == 3 || p.getPrayers().getSuperPrayer() == 1)
     {
         power *= 1.15;
     }
     else if (p.getPrayers().getSuperPrayer() == 2)
     {
         power *= 1.20;
     }
     if (wearingMeleeVoid(p))
     {
         power *= 1.10;
     }
     return power;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:29,代碼來源:CombatFormula.cs

示例4: execute

        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length < 2)
            {
                player.getPackets().sendMessage("[SetLevel command]: ::setLevel skillId level or ::setLevel skillName level");
                return;
            }

            int skillId = -1;
            int newLevel = 1;
            if (!int.TryParse(arguments[1], out newLevel))
            {
                player.getPackets().sendMessage("[SetLevel command]: ::setLevel skillId level or ::setLevel skillName level");
                return;
            }

            if (newLevel > 99) newLevel = 99;

            if (!int.TryParse(arguments[0], out skillId))
            {
                //string based skills
                arguments[0] = arguments[0].ToUpper();

                if (!Enum.IsDefined(typeof(Skills.SKILL), arguments[0]))
                {
                    player.getPackets().sendMessage("[SetLevel command]: wrong.. try like ::setlevel attack 99 or ::setlevel 0 99");
                    return;
                }
                try
                {
                    Skills.SKILL skillName = (Skills.SKILL)Enum.Parse(typeof(Skills.SKILL), arguments[0], true);
                    player.getSkills().setXp(skillName, 0);
                    player.getSkills().setCurLevel(skillName, newLevel);
                    player.getSkills().addXp(skillName, Skills.getXpForLevel(newLevel));
                    player.getPackets().sendSkillLevel(skillName);
                }
                catch (ArgumentException)
                {
                    player.getPackets().sendMessage("[SetLevel command]: wrong.. try like ::setlevel attack 99 or ::setlevel 0 99");
                }
            }
            else
            {
                if (!Enum.IsDefined(typeof(Skills.SKILL), skillId))
                {
                    player.getPackets().sendMessage("[SetLevel command]: wrong.. try like ::setlevel attack 99 or ::setlevel 0 99");
                    return;
                }
                Skills.SKILL skillName = (Skills.SKILL)skillId;
                player.getSkills().setXp(skillName, 0);
                player.getSkills().setCurLevel(skillName, newLevel);
                player.getSkills().addXp(skillName, Skills.getXpForLevel(newLevel));
                player.getPackets().sendSkillLevel(skillName);
            }
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:55,代碼來源:SetLevel.cs

示例5: castCharge

 public static void castCharge(Player p)
 {
     p.removeTemporaryAttribute("autoCasting");
     if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < 80)
     {
         p.getPackets().sendMessage("You need a Magic level of 80 to cast Charge.");
         return;
     }
     if (!hasRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT))
     {
         p.getPackets().sendMessage("You do not have enough runes to cast Charge.");
         return;
     }
     if (p.getTemporaryAttribute("godCharged") != null)
     {
         p.getPackets().sendMessage("You have already charged your god spells.");
         return;
     }
     if (hasGodCapeAndStaff(p))
     {
         p.getPackets().sendMessage("You must wear a God cape and wield the matching staff to cast Charge.");
         return;
     }
     if (!deleteRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT))
     {
         return;
     }
     p.setTemporaryAttribute("godCharged", true);
     p.setLastGraphics(new Graphics(308, 800, 90));
     p.setLastAnimation(new Animation(811));
     p.getPackets().sendMessage("You feel charged with magical power..");
     int delay = 60000 + Misc.random(120000); //60 seconds + possible 120 seconds so, 1 minute to 2 minutes.
     Event removeGodChargeEvent = new Event(delay);
     removeGodChargeEvent.setAction(() =>
     {
         removeGodChargeEvent.stop();
         p.removeTemporaryAttribute("godCharged");
         p.getPackets().sendMessage("Your magical charge fades away.");
     });
     Server.registerEvent(removeGodChargeEvent);
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:41,代碼來源:MagicCombat.cs

示例6: applyBoltGraphic

        private static int applyBoltGraphic(Player killer, Entity target, int damage, int bolt)
        {
            int hit = Misc.random(10);
            if (hit != 0 || getBowType(killer) != BOW_TYPE.CROSSBOW)
            {
                return damage;
            }
            double maxDamage = getDamage((Player)killer, target, ((Player)killer).getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON), bolt);
            switch (bolt)
            {
                case 9236: // Opal.
                    target.setLastGraphics(new Graphics(749));
                    maxDamage *= 1.25;
                    break;

                case 9237: // Jade.
                    target.setLastGraphics(new Graphics(756));
                    //TODO Falling emote
                    break;

                case 9238: // Pearl.
                    target.setLastGraphics(new Graphics(750));
                    break;

                case 9239: // Topaz.
                    target.setLastGraphics(new Graphics(757, 0, 0));
                    if (target is Player)
                    {
                        int magicLevel = ((Player)target).getSkills().getCurLevel(Skills.SKILL.MAGIC);
                        if (magicLevel == 1)
                            return (int)maxDamage;
                        int magicLevelDeduction = Misc.random(1, 10);
                        magicLevelDeduction = Math.Min(magicLevelDeduction, (magicLevel - 1));
                        string s = magicLevelDeduction == 1 ? "" : "s";
                        ((Player)target).getSkills().setCurLevel(Skills.SKILL.MAGIC, magicLevel - magicLevelDeduction);
                        ((Player)target).getPackets().sendSkillLevel(Skills.SKILL.MAGIC);
                        ((Player)target).getPackets().sendMessage("Your Magic level has been reduced by " + magicLevelDeduction + " level" + s + " !");
                    }
                    break;

                case 9240: // Sapphire.
                    target.setLastGraphics(new Graphics(751));
                    if (target is Player)
                    {
                        int prayerLevel = ((Player)target).getSkills().getCurLevel(Skills.SKILL.PRAYER);
                        if (prayerLevel == 1)
                            return (int)maxDamage;
                        int prayerLevelDeduction = Misc.random(1, 10);
                        prayerLevelDeduction = Math.Min(prayerLevelDeduction, (prayerLevel - 1));
                        string s = prayerLevelDeduction == 1 ? "" : "s";
                        ((Player)target).getSkills().setCurLevel(Skills.SKILL.PRAYER, prayerLevel - prayerLevelDeduction);
                        ((Player)target).getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
                        ((Player)target).getPackets().sendMessage("Your Prayer level has been lowered by " + prayerLevelDeduction + " level" + s + " !");
                        killer.getPackets().sendMessage("You steal " + prayerLevelDeduction + " Prayer point" + s + " from your opponent!");

                        int prayerLevelObtained = Math.Min(killer.getSkills().getCurLevel(Skills.SKILL.PRAYER) + prayerLevelDeduction, killer.getSkills().getMaxLevel(Skills.SKILL.PRAYER));
                        killer.getSkills().setCurLevel(Skills.SKILL.PRAYER, prayerLevelObtained);
                        killer.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
                    }
                    break;

                case 9241: // Emerald.
                    if (!target.isPoisoned())
                    {
                        Server.registerEvent(new PoisonEvent(target, 6));
                        target.setLastGraphics(new Graphics(752));
                    }
                    break;

                case 9242: // Ruby
                    target.setLastGraphics(new Graphics(754));
                    int currentHP = killer.getHp();
                    bool has11Percent = (currentHP * 0.11) < currentHP;
                    int removeFromOpponent = (int)(target.getHp() * 0.20); //20% off opponents HP.
                    if (has11Percent)
                    {
                        killer.hit((int)(currentHP * 0.10));
                        target.hit(removeFromOpponent);
                        killer.getPackets().sendMessage("You sacrifice some of your own health to deal more damage to your opponent!");
                    }
                    break;

                case 9243: // Diamond.
                    target.setLastGraphics(new Graphics(758));
                    maxDamage *= 1.15;
                    //TODO this affects opponents range defence for X minutes.
                    break;

                case 9244: // Dragon.
                    bool hitsFire = true;
                    if (target is Player)
                    {
                        int shield = ((Player)target).getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD);
                        /*
                         * Opponent has anti-fire shield.
                         */
                        if (shield == 11283 || shield == 1540)
                        {
                            hitsFire = false;
                        }
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:RangeCombat.cs

示例7: getMagicAttack

 private static double getMagicAttack(Player p)
 {
     int magicBonus = p.getEquipment().getBonus(Equipment.BONUS.MAGIC_ATTACK);
     double magicLevel = Convert.ToDouble(p.getSkills().getCurLevel(Skills.SKILL.MAGIC));
     double power = 1.800;
     double amount = 0.0205;
     if (magicBonus >= 80)
     { // equivalent of max mage w/ zerker+whip
         amount = 0.0500;
     }
     else if (magicBonus >= 90)
     { // equivalent of max mage w/whip or mystic + ancient staff
         amount = 0.0780;
     }
     else if (magicBonus >= 105)
     { // equivalent of max mage w/ ancient staff
         amount = 0.920;
     }
     else if (magicBonus >= 115)
     { // equivalent of max mage w/ wand or better
         amount = 0.1110;
     }
     power *= (magicBonus * amount) + (magicLevel *= 0.0120);
     int prayer = p.getPrayers().getMagicPrayer();
     if (prayer > 0)
     {
         if (prayer == 1)
         {
             power *= 1.05;
         }
         else if (prayer == 2)
         {
             power *= 1.10;
         }
         else if (prayer == 3)
         {
             power *= 1.15;
         }
     }
     return power;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:41,代碼來源:CombatFormula.cs

示例8: doDialogue


//.........這裏部分代碼省略.........
                    p.getPackets().animateInterface(9827, 241, 1);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 32;
                    break;

                case 32:
                    p.getPackets().sendNPCHead(437, 241, 2);
                    p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3);
                    p.getPackets().modifyText("No coins, no entrance!", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    break;

                case 33:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Never mind.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    break;

                case 34:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Could you sell me a Skillcape of Agility?", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 35;
                    break;

                case 35:
                    p.getPackets().sendNPCHead(437, 244, 2);
                    p.getPackets().modifyText("Cap'n Izzy No-Beard", 244, 3);
                    if (p.getSkills().getMaxLevel(Skills.SKILL.AGILITY) < 99)
                    {
                        p.getPackets().modifyText("Unfortunatly not. I may only sell the Skillcape of Agility", 244, 4);
                        p.getPackets().modifyText("to those that have conquered the obstacles of Runescape,", 244, 5);
                        p.getPackets().modifyText("can climb like a cat and run like the wind! which err..", 244, 6);
                        p.getPackets().modifyText("isnt you. Is there anything else?", 244, 7);
                        newStatus = 6;
                    }
                    else
                    {
                        p.getPackets().modifyText("Indeed! You have reached level 99 Agility and have", 244, 4);
                        p.getPackets().modifyText("become a master of dexterity. It would be a pleasure", 244, 5);
                        p.getPackets().modifyText("to sell you an Agility skillcape and hood for a sum of", 244, 6);
                        p.getPackets().modifyText(SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " coins.", 244, 7);
                        newStatus = 36;
                    }
                    p.getPackets().animateInterface(9827, 244, 2);
                    p.getPackets().sendChatboxInterface2(244);
                    break;

                case 36:
                    p.getPackets().modifyText("I'll pay " + SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " coins.", 228, 2);
                    p.getPackets().modifyText(SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " is a crazy price!", 228, 3);
                    p.getPackets().sendChatboxInterface(228);
                    newStatus = 37;
                    break;

                case 37:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("I'll pay " + SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " coins.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
開發者ID:ramatronics,項目名稱:rsps,代碼行數:67,代碼來源:AgilityArena.cs

示例9: appendAppearanceUpdate


//.........這裏部分代碼省略.........
                        playerProps.addByte((byte)0);
                    }
                    Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST);
                    if (chest != null && chest.getDefinition() != null)
                    {
                        if (!ItemData.isFullBody(chest.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD));
                    }
                    Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT);
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if (!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(6));
                    }
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if (!ItemData.isFullMask(hat.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                    }
                }
                else
                {
                    playerProps.addUShort(-1);
                    playerProps.addUShort(app.getNpcId());
                    playerProps.addByte((byte)255);
                }
            }
            else
            {
                for (int i = 0; i < 12; i++)
                {
                    playerProps.addByte((byte)0);
                }
            }
            foreach (int colour in app.getColoursArray())
            {
                playerProps.addByte((byte)colour);
            }
            playerProps.addUShort(p.getEquipment().getStandWalkAnimation());
            playerProps.addLong(p.getLoginDetails().getLongName());
            playerProps.addByte((byte)p.getSkills().getCombatLevel());
            playerProps.addUShort(0);
            playerProps.addByte((byte)0);
            updateBlock.addByteA((byte)(playerProps.getLength() & 0xFF));
            updateBlock.addBytes(playerProps.toPacket().getData(), 0, playerProps.getLength());
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:PlayerUpdate.cs

示例10: resetVariables

 private void resetVariables(Player p)
 {
     p.setSkullCycles(0);
     p.getSpecialAttack().resetSpecial();
     p.setLastkiller(null);
     p.setDead(false);
     p.setEntityFocus(65535);
     p.setPoisonAmount(0);
     p.clearKillersHits();
     p.setLastVengeanceTime(0);
     p.setVengeance(false);
     p.removeTemporaryAttribute("willDie");
     p.setFrozen(false);
     p.removeTemporaryAttribute("unmovable");
     p.setAntifireCycles(0);
     p.setSuperAntipoisonCycles(0);
     p.setTeleblockTime(0);
     p.removeTemporaryAttribute("teleblocked");
     p.setTarget(null);
     p.setAttacker(null);
     foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL)))
         p.getSkills().setCurLevel(skill, p.getSkills().getMaxLevel(skill));
     p.getPackets().sendSkillLevels();
     Prayer.deactivateAllPrayers(p);
     if (p.getTemporaryAttribute("cantDoAnything") != null)
     {
         p.getAppearance().setInvisible(false);
         p.getUpdateFlags().setAppearanceUpdateRequired(true);
         p.removeTemporaryAttribute("cantDoAnything");
         p.removeTemporaryAttribute("unmovable");
         teleportToWaitingRoom(p, false);
         p.getPackets().closeInterfaces();
         p.getPackets().setMinimapStatus(0);
         p.getPackets().clearMapFlag();
     }
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:36,代碼來源:FightPits.cs

示例11: drinkPotion

        private static void drinkPotion(Player p, int i, int j, int slot)
        {
            //TODO antipoisons/antifire
            int lastPotion = -1;
            int delay = 500;
            long lastDrink = 0;
            if (p.isDead() || p.getTemporaryAttribute("willDie") != null)
            {
                return;
            }
            if (p.getDuel() != null)
            {
                if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_DRINKS))
                {
                    p.getPackets().sendMessage("Drinks have been disabled for this duel!");
                    return;
                }
            }
            if (p.getTemporaryAttribute("lastDrankPotion") != null)
            {
                lastPotion = (int)p.getTemporaryAttribute("lastDrankPotion");
            }
            if (p.getTemporaryAttribute("drinkPotionTimer") != null)
            {
                lastDrink = (int)p.getTemporaryAttribute("drinkPotionTimer");
            }
            int time = (j == lastPotion) ? 1000 : 500;
            if (Environment.TickCount - lastDrink < time)
            {
                return;
            }
            p.getPackets().closeInterfaces();
            p.setTemporaryAttribute("drinkPotionTimer", Environment.TickCount);
            p.setTemporaryAttribute("lastDrankPotion", j);
            p.setTarget(null);
            p.resetCombatTurns();
            p.setEntityFocus(65535);
            p.removeTemporaryAttribute("autoCasting");

            Event drinkPotionEvent = new Event(delay);
            drinkPotionEvent.setAction(() =>
            {
                drinkPotionEvent.stop();
                if (p.isDead() || p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) <= 0)
                {
                    return;
                }
                int item = i != 0 && POTIONS[i - 1][j] != -1 ? POTIONS[i - 1][j] : 229;
                if (!p.getInventory().replaceItemSlot(POTIONS[i][j], item, slot))
                {
                    return;
                }
                string drinkPotion = ItemData.forId(POTIONS[0][j]).getName().Replace("(", "").Replace(")", "").Replace("3", "").Replace("2", "").Replace("1", "").ToLower();
                p.getPackets().sendMessage("You drink some of your " + drinkPotion + ".");
                p.getPackets().sendMessage("You have " + (i == 0 ? "no" : i.ToString()) + " doses of potion left.");
                switch (j)
                {
                    case 0: //Attack potion [+3 and 10% of max attack]
                        statBoost(p, Skills.SKILL.ATTACK, 0.10, 3, false);
                        break;

                    case 1: //Antipoison potion
                        p.setPoisonAmount(0);
                        break;

                    case 2: //Strength potion [+3 and 10% of max strength]
                        statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
                        break;

                    case 3: //Restore potion [restores randomly between 10-39 points]
                        restorePotion(p, Skills.SKILL.DEFENCE, 10, 39);
                        restorePotion(p, Skills.SKILL.ATTACK, 10, 39);
                        restorePotion(p, Skills.SKILL.STRENGTH, 10, 39);
                        restorePotion(p, Skills.SKILL.RANGE, 10, 39);
                        restorePotion(p, Skills.SKILL.HITPOINTS, 10, 39);
                        break;

                    case 4: //Energy potion [restores 20% energy]
                        double newEnergy = p.getRunEnergy() * 0.20;
                        p.setRunEnergy(((p.getRunEnergy() + (int)newEnergy >= 100) ? 100 : (p.getRunEnergy() + (int)newEnergy)));
                        break;

                    case 5: //Defence potion [Should be +3 and 10% of max defence]
                        statBoost(p, Skills.SKILL.DEFENCE, 0.10, 3, false);
                        break;

                    case 6: //Agility potion [restores 2 or 3 agility points]
                        int newAgility = Misc.random(2, 3) + p.getSkills().getCurLevel(Skills.SKILL.AGILITY);
                        if (newAgility < p.getSkills().getMaxLevel(Skills.SKILL.AGILITY))
                            p.getSkills().setCurLevel(Skills.SKILL.AGILITY, newAgility);
                        break;

                    case 7: //Combat potion [Should be 10% of attack+strength and +3 to each].
                        statBoost(p, Skills.SKILL.ATTACK, 0.10, 3, false);
                        statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
                        break;

                    case 8: //Prayer potion, [heals 7-31, formula = 7+floor(prayerlevel/4)]
                        int newPrayer = 7 + (int)Math.Floor((double)(p.getSkills().getMaxLevel(Skills.SKILL.PRAYER) / 4)) + p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
                        if (newPrayer < p.getSkills().getCurLevel(Skills.SKILL.PRAYER))
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:Consumables.cs

示例12: statBoost

        public static void statBoost(Player p, Skills.SKILL skill, double percentage, int additionalLevels, bool decreaseStat)
        {
            int maxPossibleIncrease = (int)((double)p.getSkills().getMaxLevel(skill) * percentage) + additionalLevels;
            maxPossibleIncrease += p.getSkills().getMaxLevel(skill);

            if (!decreaseStat)
            { //increase stat
                p.getSkills().setCurLevel(skill, maxPossibleIncrease);
            }
            else
            {
                p.getSkills().setCurLevel(skill, p.getSkills().getCurLevel(skill) - maxPossibleIncrease);
                if (p.getSkills().getCurLevel(skill) <= 0)
                    p.getSkills().setCurLevel(skill, 1);
            }
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:16,代碼來源:Consumables.cs

示例13: addMagicXp

 protected static void addMagicXp(Player p, Entity target, double hit, int index, bool baseXp)
 {
     if (target is Npc)
     {
         double xp = 0;
         switch (index)
         {
             case 0: xp = 5.5; break; // Wind strike.
             case 1: xp = 7.5; break;// Water strike
             case 2: xp = 9.5; break;// Earth strike.
             case 3: xp = 11.5; break;// Fire strike.
             case 4: xp = 13.5; break;// Wind bolt.
             case 5: xp = 16.5; break;// Water bolt.
             case 6: xp = 19.5; break;// Earth bolt.
             case 7: xp = 21.5; break;// Fire bolt.
             case 8: xp = 25.5; break;// Wind blast.
             case 9: xp = 28.5; break;// Water blast.
             case 10: xp = 31.5; break;// Earth blast.
             case 11: xp = 34.5; break;// Fire blast.
             case 12: xp = 36.0; break;// Wind wave.
             case 13: xp = 37.5; break;// Water wave.
             case 14: xp = 40.0; break;// Earth wave.
             case 15: xp = 42.5; break;// Fire wave.
             case 32: xp = 24.5; break;// Crumble undead.
             case 33: xp = 30.0; break;// Slayer dart.
             case 34: xp = 30.0; break;// Bind.
             case 35: xp = 30.0; break;// Iban blast.
             case 36: xp = 60.0; break;// Snare.
             case 37: xp = 61.0; break;// Saradomin strike.
             case 38: xp = 61.0; break;// Claws of Guthix.
             case 39: xp = 61.0; break;// Flames of Zamorak.
             case 40: xp = 89.0; break;// Entangle.
             case 41: xp = 13.0; break;// Confuse.
             case 42: xp = 21.0; break;// Weaken.
             case 43: xp = 29.0; break;// Curse.
             case 44: xp = 83.0; break;// Enfeeble.
             case 45: xp = 90.0; break;// Stun.
             case 46: xp = 76.0; break;// Vulnerability.
             case 47: xp = 80.0; break;// Teleblock.
             case 16: xp = 30.0; break;// Smoke rush.
             case 17: xp = 31.0; break;// Shadow rush.
             case 18: xp = 33.0; break;// Blood rush.
             case 19: xp = 34.0; break;// Ice rush.
             case 20: xp = 36.0; break;// Smoke burst.
             case 21: xp = 37.0; break;// Shadow burst.
             case 22: xp = 39.0; break;// Blood burst.
             case 23: xp = 40.0; break;// Ice burst.
             case 24: xp = 42.0; break;// Smoke blitz.
             case 25: xp = 43.0; break;// Shadow blitz.
             case 26: xp = 45.0; break;// Blood blitz.
             case 27: xp = 46.0; break;// Ice blitz.
             case 28: xp = 48.0; break;// Smoke barrage.
             case 29: xp = 48.0; break;// Shadow barrage.
             case 30: xp = 51.0; break;// Blood barrage.
             case 31: xp = 52.0; break;// Ice barrage.
             case 48: xp = 36.0; break;// Miasmic rush.
             case 49: xp = 42.0; break;// Miasmic burst.
             case 50: xp = 48.0; break;// Miasmic blitz.
             case 51: xp = 54.0; break;// Miasmic barrage.
         }
         double finalXp = baseXp ? (xp + (hit * 2)) : (hit * 2);
         p.getSkills().addXp(Skills.SKILL.MAGIC, finalXp);
         p.getSkills().addXp(Skills.SKILL.HITPOINTS, hit * 1.33);
         target.addToHitCount(p, hit);
     }
     else if (target != null)
     {
         target.addToHitCount(p, hit);
     }
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:70,代碼來源:MagicCombat.cs

示例14: fightCaveAttacks


//.........這裏部分代碼省略.........
                        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 (prayer == PrayerData.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.random(49);
                        if (prayer == PrayerData.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.random(64);
                        if (prayer == PrayerData.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 -= (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);
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:FightCave.cs

示例15: levelUp

        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);
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:22,代碼來源:Skills.cs


注:本文中的RS2.Server.player.Player.getSkills方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。