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


C# Player.getEquipment方法代碼示例

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


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

示例1: getProtectedItem1

 public static int[] getProtectedItem1(Player p)
 {
     int[] protectedItem = new int[2];
     protectedItem[0] = -1;
     for (int i = 0; i < 28; i++)
     {
         if (p.getInventory().getSlot(i).itemId == -1) continue;
         int price = p.getInventory().getSlot(i).getDefinition().getPrice().getMaximumPrice();
         if ((price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()))
         {
             protectedItem[0] = p.getInventory().getSlot(i).getItemId();
             protectedItem[1] = INVENTORY;
         }
     }
     foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP)))
     {
         if (equip == ItemData.EQUIP.NOTHING) continue;
         if (p.getEquipment().getSlot(equip).itemId == -1) continue;
         int price = p.getEquipment().getSlot(equip).getDefinition().getPrice().getMaximumPrice();
         if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
         {
             protectedItem[0] = p.getEquipment().getSlot(equip).getItemId();
             protectedItem[1] = EQUIPMENT;
         }
     }
     return protectedItem;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:27,代碼來源:ProtectedItems.cs

示例2: execute

        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[Info command]: ::info npcId (example ::info 1)");
                return;
            }

            int npcId = 0;

            if (!int.TryParse(arguments[0], out npcId))
            {
                player.getPackets().sendMessage("[Info command]: ::info npcId (example ::info 1)");
                return;
            }
            if (npcId < 0 || npcId > NpcData.getTotalNpcDefinitions())
                return;

            player.getPackets().sendMessage("ATT = " + (int)CombatFormula.getMeleeAttack(player) + " DEF = " + (int)CombatFormula.getMeleeDefence(player, player) + " SPEC = " + (int)CombatFormula.getMeleeAttack(player) * CombatFormula.getSpecialAttackBonus(player.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON)));
            player.getPackets().sendMessage("NPC ATT = " + (int)CombatFormula.getNPCMeleeAttack(new Npc(npcId)) + " NPC DEF = " + (int)CombatFormula.getNPCMeleeDefence(new Npc(npcId)));
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:21,代碼來源:Info.cs

示例3: emote

        /**
         * 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.
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:Skillcape.cs

示例4: getRangeStrength


//.........這裏部分代碼省略.........
         31, // addy arrow
         100, // addy bolt
         10, // addy dart
         28, // addy jav
         14, // addy knife
         23, // addy thrownaxe
         12, // barbed bolts
         75, // black bolts
         6, // black dart
         8, // black knife
         28, // blurite bolt
         55, // bolt rack
         49, // bone bolts
         100, // broad tipped bolts
         7, // bronze arrow
         10, // bronze bolts
         1, // bronze dart
         6, // bronze jav
         3, // bronze knife
         5, // bronze thrownaxe
         70, // full crystal bow
         145, // corrupt morr jav
         117, // corrupt morr thrownaxe
         105, // diamond bolt
         60, // dragon arrow
         117, // dragon bolts
         20, // dragon dart
         85, // emerald bolts
         16, // guam tar
         49, // harralander tar
         16, // ice arrows
         10, // iron arrows
         46, // iron bolts
         3, // iron dart
         10, // iron javelin
         4, // iron knife
         7, // iron thrownaxe
         28, // kebbit bolts
         38, // long kebbit bolts
         22, // mith arrow
         82, // mith bolts
         7, // mithril dart
         18, // mithril javelin
         10, // mith knife
         16, // mith thrownaxe
         145, // morrigans javelin
         117, // morrigans thrownaxe
         22, // ogre arrow
         120, // onyx bolts
         48, // pearl bolts
         15, // red chinchompa
         103, // ruby bolts
         49, // rune arrow
         14, // rune dart
         42, // rune javelin
         24, // rune knife
         36, // rune thrownaxe
         115, // rune bolts
         83, // sapphire bolts
         36, // silver bolts
         16, // steel arrow
         64, // steel bolts
         4, // steel dart
         12, // steel javelin
         7, // steel knife
         11, // steel thrownaxe
         31, // tarromin tar
         49, // obsidian ring
         66, // topaz bolts
         7, // training arrows
         10, // opal bolts
         10, // opal bolts (e)
         28, // jade bolts
         28, // jade bolts (e)
         46, // pearl bolts(e)
         64, // topaz bolts (e)
         82, // emerald bolts (e)
         82, // sapphire bolts (e)
         100, // ruby bolts (e)
         100, // diamond bolts (e)
         117, // dragon bolts (e)
         115, // onyx bolts (e)
         }
     };
     for (int i = 0; i < items[1].Length; i++)
     {
         if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == items[0][i])
         {
             return items[1][i];
         }
     }
     for (int i = 0; i < items[1].Length; i++)
     {
         if (p.getEquipment().getItemInSlot(ItemData.EQUIP.ARROWS) == items[0][i])
         {
             return items[1][i];
         }
     }
     return 0;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:CombatFormula.cs

示例5: getHighestDefBonus

 private static int getHighestDefBonus(Player p)
 {
     int bonus = 0;
     for (int i = 5; i < 8; i++)
     {
         if (p.getEquipment().getBonus(i) > bonus)
         {
             bonus = p.getEquipment().getBonus(i);
         }
     }
     return bonus;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:12,代碼來源:CombatFormula.cs

示例6: wearingTorag

 public static bool wearingTorag(Player p)
 {
     return p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) == 4751 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4747 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) == 4749 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.HAT) == 4745;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:7,代碼來源:CombatFormula.cs

示例7: wearingKaril

 public static bool wearingKaril(Player p)
 {
     return p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) == 4738 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4734 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) == 4736 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.HAT) == 4732;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:7,代碼來源:CombatFormula.cs

示例8: wearingDharok

 public static bool wearingDharok(Player p)
 {
     return p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) == 4722 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4718 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) == 4720 &&
     p.getEquipment().getItemInSlot(ItemData.EQUIP.HAT) == 4716;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:7,代碼來源:CombatFormula.cs

示例9: handleOperateItem

 private void handleOperateItem(Player player, Packet packet)
 {
     int item = packet.readShortA();
     int slot = packet.readLEShort();
     int interfaceId = packet.readLEShort();
     int childId = packet.readLEShort();
     if (slot < 0 || slot > 13 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
     {
         return;
     }
     ItemData.EQUIP equipSlot = (ItemData.EQUIP)slot;
     if (player.getEquipment().getItemInSlot(equipSlot) == item)
     {
         SkillHandler.resetAllSkills(player);
         player.getPackets().closeInterfaces();
         if (JewelleryTeleport.useJewellery(player, player.getEquipment().getItemInSlot(equipSlot), slot, true))
         {
             return;
         }
         else
             if (equipSlot == ItemData.EQUIP.CAPE && Skillcape.emote(player))
             {
                 return;
             }
         player.getPackets().sendMessage("This item isn't operable.");
     }
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:27,代碼來源:ItemInteract.cs

示例10: handleEquipItem

 private void handleEquipItem(Player player, Packet packet)
 {
     int item = packet.readLEShort();
     int slot = packet.readShortA();
     int interfaceId = packet.readInt();
     if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
     {
         return;
     }
     SkillHandler.resetAllSkills(player);
     if (player.getInventory().getItemInSlot(slot) == item)
     {
         //player.getPackets().closeInterfaces();
         if (RuneCraft.emptyPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot)))
         {
             return;
         }
         player.getEquipment().equipItem(player.getInventory().getItemInSlot(slot), slot);
     }
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:20,代碼來源:ItemInteract.cs

示例11: canCastSpell


//.........這裏部分代碼省略.........
                         return false;
                     }
                     if (p.getDuel().getStatus() == 6 && ((Player)target).getDuel().getStatus() == 6)
                     {
                         return true;
                     }
                 }
             }
             p.getPackets().sendMessage("That isn't your opponent.");
             return false;
         }
         if (i == 47)
         {
             if (((Player)target).getTemporaryAttribute("teleblocked") != null)
             {
                 p.getPackets().sendMessage("That player already has a teleportation block upon them.");
                 return false;
             }
         }
         if (!Location.inWilderness(target.getLocation()))
         {
             p.getPackets().sendMessage("That player isn't in the wilderness.");
             return false;
         }
         if (!Location.inWilderness(p.getLocation()))
         {
             p.getPackets().sendMessage("You aren't in the wilderness.");
             return false;
         }
         int killerWildLevel = p.getLocation().wildernessLevel();
         int targetWildLevel = ((Player)target).getLocation().wildernessLevel();
         int killerCombatLevel = p.getSkills().getCombatLevel();
         int targetCombatLevel = ((Player)target).getSkills().getCombatLevel();
         int highest = killerCombatLevel > targetCombatLevel ? killerCombatLevel : targetCombatLevel;
         int lowest = highest == killerCombatLevel ? targetCombatLevel : killerCombatLevel;
         int difference = (highest - lowest);
         if (difference > killerWildLevel || difference > targetWildLevel)
         {
             ((Player)p).getPackets().sendMessage("You must move deeper into the wilderness to attack that player.");
             return false;
         }
     }
     if (!Location.inMultiCombat(target.getLocation()))
     {
         if (p.getAttacker() != null && !p.getAttacker().Equals(target))
         {
             p.getPackets().sendMessage("You are already in combat!");
             return false;
         }
         if (target.getAttacker() != null && !target.getAttacker().Equals(p))
         {
             string type = target is Player ? "player" : "npc";
             p.getPackets().sendMessage("That " + type + " is already in combat.");
             return false;
         }
     }
     if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < SPELL_LEVEL[i])
     {
         p.getPackets().sendMessage("You need a Magic level of " + SPELL_LEVEL[i] + " to cast that spell.");
         return false;
     }
     if (!hasRunes(p, RUNES[i], RUNE_AMOUNTS[i]))
     {
         p.getPackets().sendMessage("You do not have enough runes to cast that spell.");
         return false;
     }
     if (NEEDS_STAFF[i])
     {
         if ((i != 38 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != STAFF[i]) || (i == 38 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != 8841 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != STAFF[i]))
         {
             p.getPackets().sendMessage("You need to wield " + STAFF_NAME[i] + " to cast this spell.");
             return false;
         }
     }
     if (i == 37)
     {
         if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) != 2412)
         {
             p.getPackets().sendMessage("You need to wear the Cape of Saradomin to be able to cast Saradomin Strike.");
             return false;
         }
     }
     if (i == 38)
     {
         if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) != 2413)
         {
             p.getPackets().sendMessage("You need to wear the Cape of Guthix to be able to cast Claws of Guthix.");
             return false;
         }
     }
     if (i == 39)
     {
         if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) != 2414)
         {
             p.getPackets().sendMessage("You need to wear the Cape of Zamorak to be able to cast Flames of Zamorak.");
             return false;
         }
     }
     return true;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:MagicCombat.cs

示例12: newMagicAttack


//.........這裏部分代碼省略.........
                attemptMagicAttackEvent.setAction(() =>
                {
                    if (Environment.TickCount - p.getLastAttack() > delay)
                    {
                        attemptMagicAttackEvent.stop();
                        newMagicAttack(p, target, id, ancients);
                    }
                });
                Server.registerEvent(attemptMagicAttackEvent);

                p.getWalkingQueue().resetWalkingQueue();
                p.getPackets().clearMapFlag();
                p.setLastCombatType(Combat.CombatType.MAGE);
                return;
            }
            if (fakeNPC && !monsterInArea(p, target))
            {
                p.removeTemporaryAttribute("autoCasting");
                Combat.resetCombat(p, 1);
                return;
            }
            int endGfx = END_GFX[index];
            double damage = Misc.random(CombatFormula.getMagicHit(p, target, getSpellMaxHit(p, index)));
            bool mp = false;
            bool magicProtect = mp;
            if (target is Player)
            {
                mp = ((Player)target).getPrayers().getHeadIcon() == PrayerData.MAGIC;
            }
            if (magicProtect)
            {
                damage *= 0.60;
            }
            if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841)
            {
                damage *= 1.10; // void mace 10% hit increase.
            }
            if (damage == 0 && index != 41 && index != 42 && index != 43 && index != 44 && index != 45 && index != 46 && index != 47)
            {
                endGfx = 85;
            }
            if (!deleteRunes(p, RUNES[index], RUNE_AMOUNTS[index]))
            {
                p.setTarget(null);
                return;
            }
            p.getFollow().setFollowing(null);
            p.getWalkingQueue().resetWalkingQueue();
            p.getPackets().clearMapFlag();
            p.setFaceLocation(target.getLocation());
            if (HANDS_GFX[index] != -1)
            {
                p.setLastGraphics(new Graphics(HANDS_GFX[index], 0, getStartingGraphicHeight(index)));
            }
            p.setLastAnimation(new Animation(SPELL_ANIM[index]));
            p.getPackets().closeInterfaces();
            if (target is Player)
            {
                ((Player)target).getPackets().closeInterfaces();
            }
            target.setAttacker(p);
            p.setTarget(target);
            target.setLastAttacked(Environment.TickCount);
            p.setLastAttack(Environment.TickCount);
            p.setLastMagicAttack(Environment.TickCount);
            p.setCombatTurns(p.getAttackSpeed());
開發者ID:ramatronics,項目名稱:rsps,代碼行數:67,代碼來源:MagicCombat.cs

示例13: hasGodCapeAndStaff

 private static bool hasGodCapeAndStaff(Player p)
 {
     if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 2415 && p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) == 2412)
     {
         return true;
     }
     if ((p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 2416 || p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841) && p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) == 2413)
     {
         return true;
     }
     if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 2417 && p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) == 2414)
     {
         return true;
     }
     return false;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:16,代碼來源:MagicCombat.cs

示例14: handleClickOne

 private void handleClickOne(Player player, Packet packet)
 {
     int slot = packet.readShortA();
     int item = packet.readUShort();
     int childId = packet.readUShort();
     int interfaceId = packet.readUShort();
     if (slot < 0 || slot > 28 || player.isDead())
     {
         return;
     }
     Console.WriteLine("Click One Slot = " + slot);
     player.getPackets().closeInterfaces();
     Console.WriteLine("InterfaceOption 1: interfaceId: " + interfaceId);
     switch (interfaceId)
     {
         case 387: // Unequip item
             if (slot < 14 && player.getEquipment().getItemInSlot((ItemData.EQUIP)slot) == item)
             {
                 player.getEquipment().unequipItem((ItemData.EQUIP)slot);
             }
             break;
     }
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:23,代碼來源:InterfaceOptions.cs

示例15: getProtectedItem2

 public static int[] getProtectedItem2(Player p)
 {
     int[] protectedItem = new int[2];
     protectedItem[0] = -1;
     int[] protectedItem1 = getProtectedItem1(p);
     bool save;
     for (int i = 0; i < 28; i++)
     {
         if (p.getInventory().getSlot(i).itemId == -1) continue;
         int amt = p.getInventory().getItemAmount(p.getInventory().getItemInSlot(i));
         int price = p.getInventory().getSlot(i).getDefinition().getPrice().getMaximumPrice();
         if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
         {
             save = true;
             if (protectedItem1[1] == INVENTORY)
             {
                 if (protectedItem1[0] == p.getInventory().getItemInSlot(i))
                 {
                     if (amt < 2)
                     {
                         save = false;
                     }
                 }
             }
             if (save)
             {
                 protectedItem[0] = p.getInventory().getSlot(i).getItemId();
                 protectedItem[1] = INVENTORY;
             }
         }
     }
     foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP)))
     {
         if (equip == ItemData.EQUIP.NOTHING) continue;
         if (p.getEquipment().getSlot(equip).itemId == -1) continue;
         int price = p.getEquipment().getSlot(equip).getDefinition().getPrice().getMaximumPrice();
         int amt = p.getEquipment().getAmountInSlot(equip);
         if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
         {
             save = true;
             if (protectedItem1[1] == EQUIPMENT)
             {
                 if (protectedItem1[0] == p.getEquipment().getItemInSlot(equip))
                 {
                     if (amt < 2)
                     {
                         save = false;
                     }
                 }
             }
             if (save)
             {
                 protectedItem[0] = p.getEquipment().getSlot(equip).getItemId();
                 protectedItem[1] = EQUIPMENT;
             }
         }
     }
     return protectedItem;
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:59,代碼來源:ProtectedItems.cs


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