当前位置: 首页>>代码示例>>C#>>正文


C# Player.getSkills方法代码示例

本文整理汇总了C#中RunescapeServer.player.Player.getSkills方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getSkills方法的具体用法?C# Player.getSkills怎么用?C# Player.getSkills使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RunescapeServer.player.Player的用法示例。


在下文中一共展示了Player.getSkills方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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:slapglif,项目名称:runescape-server-csharp,代码行数:10,代码来源:Master.cs

示例2: getPlayerMaxHit

        public static double getPlayerMaxHit(Player player, int strBonusIncrease)
        {
            AttackStyle.CombatSkill fightType = player.getAttackStyle().getSkill();
            double myCurStrength = player.getSkills().getCurLevel(Skills.SKILL.STRENGTH);
            double myEquipStrengthBonus = (player.getEquipment().getBonus(Equipment.BONUS.STRENGTH) + strBonusIncrease);
            double fightingStyle = 0;
            double powerMultiplier = 1;
            double dharokModifier = 1;
            double damageMultiplier = 1;
            int strPrayer = player.getPrayers().getStrengthPrayer();
            if (strPrayer == 1)
            {
                powerMultiplier += 0.05;
            }
            else if (strPrayer == 2)
            {
                powerMultiplier += 0.1;
            }
            else if (strPrayer == 3)
            {
                powerMultiplier += 0.15;
            }
            else if (player.getPrayers().getSuperPrayer() == 1)
            {
                powerMultiplier += 0.18;
            }
            else if (player.getPrayers().getSuperPrayer() == 2)
            {
                powerMultiplier += 0.23;
            }

            if (wearingMeleeVoid(player))
            {
                damageMultiplier += 0.1;
            } else if (wearingDharok(player))
            {
                dharokModifier = (player.getSkills().getGreaterLevel(Skills.SKILL.HITPOINTS) - player.getSkills().getCurLevel(Skills.SKILL.HITPOINTS)) * 0.1;
            }
            if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE))
            {
                fightingStyle = 3;
            } else if (fightType.Equals(AttackStyle.CombatSkill.CONTROLLED))
            {
                fightingStyle = 1;
            }

            double cumulativeStrength = ((myCurStrength) * (powerMultiplier) + fightingStyle) * dharokModifier;
            //Can't change this. For huge damage it's a visual effect, not real maxHit!
            double maxHit = ((13 + (cumulativeStrength) + (myEquipStrengthBonus / 8) + ((cumulativeStrength * myEquipStrengthBonus) / 64)) * damageMultiplier) / 10; // NEW MAX HIT FORMULA
            return maxHit;
        }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:51,代码来源:CombatFormula.cs

示例3: 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:slapglif,项目名称:runescape-server-csharp,代码行数:48,代码来源:SetLevel.cs

示例4: fightCaveAttacks

	    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)) {
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:FightCave.cs

示例5: doRedemption

	    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);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:20,代码来源:DeathEvent.cs

示例6: 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:slapglif,项目名称:runescape-server-csharp,代码行数:12,代码来源:Consumables.cs

示例7: prayerDrainEvent

	    public static void prayerDrainEvent(Player p) {
            Event prayerDrainEvent = new Event(5000 + misc.random(5000));
            prayerDrainEvent.setAction(() => {
				if (p.getTemporaryAttribute("atBarrows") == null) {
					prayerDrainEvent.stop();
					return;
				}
				int currentPrayer = p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
				int maxLevel = p.getSkills().getMaxLevel(Skills.SKILL.PRAYER);
				int levelBy10 = currentPrayer - (maxLevel / 6);
				if (currentPrayer > 0) {
					p.getSkills().setCurLevel(Skills.SKILL.PRAYER, levelBy10);
					p.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
				}
				int[] array = p.getLocation().getZ() == 0 ? HEADS[1] : HEADS[0];
				int head = array[misc.random(array.Length - 1)];
				int slot = misc.random(5);
				if (slot == 0) {
					slot=1;
				}
				p.getPackets().itemOnInterface(24, slot, 100,head);
				p.getPackets().animateInterface(2085, 24, slot);
				prayerDrainEvent.setTick(5000 + misc.random(15000));
				
                Event animateEvent = new Event(4000);
                animateEvent.setAction(() => {
                    p.getPackets().itemOnInterface(24, slot, 100, -1);
                    p.getPackets().animateInterface(-1, 24, slot);
					animateEvent.stop();
				});
                Server.registerEvent(animateEvent);
		    });
            Server.registerEvent(prayerDrainEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:34,代码来源:Barrows.cs

示例8: 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:slapglif,项目名称:runescape-server-csharp,代码行数:34,代码来源:FightPits.cs

示例9: getRangeMaxHit

	    public static double getRangeMaxHit(Player p, int bow, int arrow) {
            /*
            int a = p.getEquipment().getBonus(Equipment.BONUS.CRUSH_ATTACK);
            int b = p.getEquipment().getBonus(Equipment.BONUS.CRUSH_DEFENCE);
            int c = p.getEquipment().getBonus(Equipment.BONUS.MAGIC_ATTACK);
            int d = p.getEquipment().getBonus(Equipment.BONUS.MAGIC_DEFENCE);
            int e = p.getEquipment().getBonus(Equipment.BONUS.PRAYER);
            int f = p.getEquipment().getBonus(Equipment.BONUS.RANGED_ATTACK);
            int g = p.getEquipment().getBonus(Equipment.BONUS.RANGED_DEFENCE);
            int h = p.getEquipment().getBonus(Equipment.BONUS.SLASH_ATTACK);
            int i = p.getEquipment().getBonus(Equipment.BONUS.SLASH_DEFENCE);
            int j = p.getEquipment().getBonus(Equipment.BONUS.STAB_ATTACK);
            int k = p.getEquipment().getBonus(Equipment.BONUS.STAB_DEFENCE);
            int l = p.getEquipment().getBonus(Equipment.BONUS.STRENGTH);
            int m = p.getEquipment().getBonus(Equipment.BONUS.SUMMONING);
            */

            double rangeLevel = p.getSkills().getCurLevel(Skills.SKILL.RANGE);
            //TODO: use rangeAttackBonus in the formula somehow!.
            double rangeAttackBonus = p.getEquipment().getBonus(Equipment.BONUS.RANGED_ATTACK);
		    double rangeAttackMultipler = 1.00;
		    double rangeAttack = 0;
            int rangedWeaponArrowStrength = getRangeWeaponArrowStrength(p);
		    int rangePrayer = p.getPrayers().getRangePrayer();

            if (rangePrayer == 1)
                rangeAttackMultipler *= 1.05; //5% increase
            else if (rangePrayer == 2)
                rangeAttackMultipler *= 1.10; //10% increase
            else if (rangePrayer == 3)
                rangeAttackMultipler *= 1.15; //15% increase

		    if (wearingRangeVoid(p)) {
                rangeAttackMultipler *= 1.15; //15% increase
		    }
            rangeAttack = (rangeLevel * rangeAttackMultipler);
		    if (p.getAttackStyle().getStyle().Equals(AttackStyle.CombatStyle.RANGE_ACCURATE)) {
                rangeAttack += 3.00;
		    }
            double rangeMaxHit = ((rangeAttack + 8) * (rangedWeaponArrowStrength + 64) / 640);
            return rangeMaxHit;
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:42,代码来源:CombatFormula.cs

示例10: doObstacle

	    public static void doObstacle(Player p, int index) {
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
            switch (index)
            {
                case 0: // 3 planks, northern (east side)
                case 1: // 3 planks, middle (east side)
                case 2: // 3 planks, southern (east side)
                case 3: // 3 planks, northern (west side)
                case 4: // 3 planks, middle (west side)
                case 5: // 3 planks, southern (west side)
                    int logXCoord = index <= 2 ? (int)AGILITY_ARENA_OBJECTS[index][1] + 1 : (int)AGILITY_ARENA_OBJECTS[index][1] - 1;
                    int logDirectionX = index <= 2 ? -7 : +7;
                    CoordinateEvent plankObstaclesCoordinateEvent = new CoordinateEvent(p, new Location(logXCoord, (int)AGILITY_ARENA_OBJECTS[index][2], 3));
                    plankObstaclesCoordinateEvent.setAction(() =>
                    {
                        bool running = p.getWalkingQueue().isRunToggled();
                        p.getWalkingQueue().setRunToggled(false);
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setTemporaryAttribute("unmovable", true);
                        p.getAppearance().setWalkAnimation(155);
                        p.getUpdateFlags().setAppearanceUpdateRequired(true);
                        p.getWalkingQueue().forceWalk(logDirectionX, 0);
                        Event plankObstaclesEvent = new Event(4300);
                        plankObstaclesEvent.setAction(() =>
                        {
                            plankObstaclesEvent.stop();
                            p.removeTemporaryAttribute("unmovable");
                            p.getAppearance().setWalkAnimation(-1);
                            p.getUpdateFlags().setAppearanceUpdateRequired(true);
                            p.getSkills().addXp(Skills.SKILL.AGILITY, (double)AGILITY_ARENA_OBJECTS[index][3]);
                            p.getWalkingQueue().setRunToggled(running);
                        });
                        Server.registerEvent(plankObstaclesEvent);
                    });
                    Server.registerCoordinateEvent(plankObstaclesCoordinateEvent);
                    break;

                case 6: //Handholds obstacle east of planks.
                case 7: //Handholds obstacle west of planks.
                    int handHoldsDirectionX = 1;
                    int handHoldsDirectionY = 1;
                    if (index == 6) {
                        handHoldsDirectionX = -1;
                        handHoldsDirectionY = +1;
                    } else if (index == 7) {
                        handHoldsDirectionX = +1;
                        handHoldsDirectionY = -1;
                    }
                    CoordinateEvent handholdsObstacleCoordinateEvent = new CoordinateEvent(p, new Location((int)AGILITY_ARENA_OBJECTS[index][1], (int)AGILITY_ARENA_OBJECTS[index][2], 3));
                    handholdsObstacleCoordinateEvent.setAction(() =>
                    {
                        bool running = p.getWalkingQueue().isRunToggled();
                        p.getWalkingQueue().setRunToggled(false);
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setTemporaryAttribute("unmovable", true);
                        p.setLastAnimation(new Animation(1121));
                        p.setFaceLocation(new Location(p.getLocation().getX(), p.getLocation().getY() + handHoldsDirectionY, 3));
                        Event handholdsObstaclesEvent = new Event(700);
                        int handholdsObstaclesCounter = 0;
                        handholdsObstaclesEvent.setAction(() =>
                        {
                            p.setLastAnimation(new Animation(1122));
                            int regionX = p.getUpdateFlags().getLastRegion().getRegionX();
                            int regionY = p.getUpdateFlags().getLastRegion().getRegionY();
                            int lX = (p.getLocation().getX() - ((regionX - 6) * 8));
                            int lY = (p.getLocation().getY() - ((regionY - 6) * 8));
                            p.setForceMovement(new ForceMovement(lX, lY, lX + handHoldsDirectionX, lY, 0, 5, 0));
                            if (handholdsObstaclesCounter++ >= 7)
                            {
                                p.setLastAnimation(new Animation(65535));
                                handholdsObstaclesEvent.stop();
                                p.removeTemporaryAttribute("unmovable");
                                p.getSkills().addXp(Skills.SKILL.AGILITY, (double)AGILITY_ARENA_OBJECTS[index][3]);
                                p.getWalkingQueue().setRunToggled(running);
                                return;
                            }
                            Event teleportEvent = new Event(500);
                            teleportEvent.setAction(() =>
                            {
                                teleportEvent.stop();
                                p.teleport(new Location(p.getLocation().getX() + handHoldsDirectionX, p.getLocation().getY(), 3));
                            });
                            Server.registerEvent(teleportEvent);
                        });
                        Server.registerEvent(handholdsObstaclesEvent);
                    });
                    Server.registerCoordinateEvent(handholdsObstacleCoordinateEvent);
                    break;
            }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:94,代码来源:Obstacles.cs

示例11: savePlayer

        public bool savePlayer(Player p)
        {
            if (p == null) return false;
            try
            {
                string username = p.getLoginDetails().getUsername().ToLower();

                /* Character saving code goes here */
                XmlTextWriter writer = new XmlTextWriter(misc.getServerPath() + @"\accounts\" + username + ".xml", null);
                writer.Formatting = Formatting.Indented;
                writer.WriteStartElement("Player");
                    writer.WriteStartElement("Login"); 
                        writer.WriteElementString("Password", p.getLoginDetails().getPassword());
                        writer.WriteElementString("Rights", p.getRights().ToString());
                        writer.WriteElementString("BankPin", p.getBank().getBankPin());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Position");
                        writer.WriteElementString("X", p.getLocation().getX().ToString());
                        writer.WriteElementString("Y", p.getLocation().getY().ToString());
                        writer.WriteElementString("Z", p.getLocation().getZ().ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Settings");
                        writer.WriteElementString("RunEnergy", p.getRunEnergy().ToString());
                        writer.WriteStartElement("PrivacySettings"); 
                            writer.WriteElementString("Public", p.getFriends().getPrivacyOption(0).ToString());
                            writer.WriteElementString("Private", p.getFriends().getPrivacyOption(1).ToString());
                            writer.WriteElementString("Trade", p.getFriends().getPrivacyOption(2).ToString());
                        writer.WriteEndElement();
                    writer.WriteEndElement();

                    writer.WriteStartElement("Friends");
                        foreach(long friend in p.getFriends().getFriendsList())
                            writer.WriteElementString("Friend", friend.ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Ignores");
                        foreach (long ignore in p.getFriends().getIgnoresList())
                            writer.WriteElementString("Ignore", ignore.ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Stats");
                        foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL))) {
                             writer.WriteStartElement(skill.ToString()); //skill name.
                                writer.WriteElementString("CurrentLevel", p.getSkills().getCurLevel(skill).ToString());
                                writer.WriteElementString("XP", p.getSkills().getXp(skill).ToString());
                            writer.WriteEndElement();
                        }
                    writer.WriteEndElement();

                    Item item;
                    writer.WriteStartElement("EquipmentItems");
                    foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP))) {
                        if (equip == ItemData.EQUIP.NOTHING) continue;
                        item = p.getEquipment().getSlot(equip);
                        if (item.getItemId() == -1) continue; //empty slot.

                        writer.WriteStartElement(equip.ToString());
                            writer.WriteElementString("Id", item.getItemId().ToString());
                            writer.WriteElementString("Amount", item.getItemAmount().ToString());
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();

                    writer.WriteStartElement("InventoryItems");
                        for (int i = 0; i < Inventory.MAX_INVENTORY_SLOTS; i++) {
                            item = p.getInventory().getSlot(i);
                            if (item.getItemId() == -1) continue; //empty slot.

                            writer.WriteStartElement("Item");
                                writer.WriteElementString("Slot", i.ToString());
                                writer.WriteElementString("Id", item.getItemId().ToString());
                                writer.WriteElementString("Amount", item.getItemAmount().ToString());
                            writer.WriteEndElement();
                        }
                    writer.WriteEndElement();

                    writer.WriteStartElement("BankItems");
                    for (int i = 0; i < Bank.MAX_BANK_SLOTS; i++)
                    {
                        item = p.getBank().getSlot(i);
                        if (item.getItemId() == -1) continue; //empty slot.

                        writer.WriteStartElement("Item");
                            writer.WriteElementString("Slot", i.ToString());
                            writer.WriteElementString("Id", item.getItemId().ToString());
                            writer.WriteElementString("Amount", item.getItemAmount().ToString());
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                writer.WriteEndElement();
                //Write the XML to file and close the writer    
                writer.Close();
            }
            catch (Exception)
            {
                return false;
            }
 
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:LoginHandler.cs

示例12: getMeleeAttack

	    public static double getMeleeAttack(Player p) {
            //TODO: implement all Equipment Bonuses to be used for all of these Defence/Melee Attack functions.
            /*
            int a = p.getEquipment().getBonus(Equipment.BONUS.CRUSH_ATTACK);
            int b = p.getEquipment().getBonus(Equipment.BONUS.CRUSH_DEFENCE);
            int c = p.getEquipment().getBonus(Equipment.BONUS.MAGIC_ATTACK);
            int d = p.getEquipment().getBonus(Equipment.BONUS.MAGIC_DEFENCE);
            int e = p.getEquipment().getBonus(Equipment.BONUS.PRAYER);
            int f = p.getEquipment().getBonus(Equipment.BONUS.RANGED_ATTACK);
            int g = p.getEquipment().getBonus(Equipment.BONUS.RANGED_DEFENCE);
            int h = p.getEquipment().getBonus(Equipment.BONUS.SLASH_ATTACK);
            int i = p.getEquipment().getBonus(Equipment.BONUS.SLASH_DEFENCE);
            int j = p.getEquipment().getBonus(Equipment.BONUS.STAB_ATTACK);
            int k = p.getEquipment().getBonus(Equipment.BONUS.STAB_DEFENCE);
            int l = p.getEquipment().getBonus(Equipment.BONUS.STRENGTH);
            int m = p.getEquipment().getBonus(Equipment.BONUS.SUMMONING);
            */

		    int highestAttackBonus = getHighestAttackBonus(p);
            int attackLevel = p.getSkills().getCurLevel(Skills.SKILL.ATTACK);
            double multipler = 1.00;

		    if (p.getPrayers().getAttackPrayer() == 1) {
                multipler *= 1.05; //5% increase
		    } else if (p.getPrayers().getAttackPrayer() == 2) {
                multipler *= 1.10; //10% increase
		    } else if (p.getPrayers().getAttackPrayer() == 3 || p.getPrayers().getSuperPrayer() == 1) {
                multipler *= 1.15; //15% increase
		    } else if (p.getPrayers().getSuperPrayer() == 2) {
                multipler *= 1.20; //20% increase
		    }
		    if (wearingMeleeVoid(p)) {
                multipler *= 1.10; //10% increase
		    }

            double effectiveAttack = (attackLevel * multipler);
            return effectiveAttack * (highestAttackBonus > 0 ? highestAttackBonus : 1);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:38,代码来源:CombatFormula.cs

示例13: loadPlayer


//.........这里部分代码省略.........
                    }
                }

                loginElement = xmlDocument.SelectSingleNode("/Player/Ignores");
                if (loginElement != null && loginElement.HasChildNodes)
                {
                    XmlNodeList childs = loginElement.ChildNodes; //number of Friends

                    foreach (XmlElement element in childs)
                    {
                        if (element.Name == "Ignore") {
                            if (long.TryParse(element.InnerText, out lTemp))
                                createdPlayer.getFriends().getIgnoresList().Add(lTemp);
                        }
                    }
                }

                loginElement = xmlDocument.SelectSingleNode("/Player/Stats");
                if (loginElement != null && loginElement.HasChildNodes)
                {
                    XmlNode skillNode;
                    foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL)))
                    {
                        skillNode = loginElement.SelectSingleNode("/Player/Stats/" + skill.ToString());

                        foreach (XmlElement element in skillNode.ChildNodes)
                        { //CurrentLevel/XP
                            switch (element.Name)
                            {
                                case "CurrentLevel":
                                    if (!int.TryParse(element.InnerText, out temp))
                                    {
                                        if (skill != Skills.SKILL.HITPOINTS)
                                            createdPlayer.getSkills().setCurLevel(skill, 1);
                                        else
                                            createdPlayer.getSkills().setCurLevel(skill, 10);
                                        break;
                                    }
                                    createdPlayer.getSkills().setCurLevel(skill, temp);
                                    break;
                                case "XP":
                                    if (!Double.TryParse(element.InnerText, out dTemp))
                                    {
                                        if (skill != Skills.SKILL.HITPOINTS)
                                            createdPlayer.getSkills().setXp(skill, 0);
                                        else
                                            createdPlayer.getSkills().setXp(skill, 1184);
                                        break;
                                    }
                                    createdPlayer.getSkills().setXp(skill, dTemp);
                                    break;
                            }
                        }
                    }
                }

                loginElement = xmlDocument.SelectSingleNode("/Player/EquipmentItems");
                if (loginElement != null && loginElement.HasChildNodes)
                {
                    XmlNode skillNode;

                    foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP))) {
                        if (equip == ItemData.EQUIP.NOTHING) continue;
                        skillNode = loginElement.SelectSingleNode("/Player/EquipmentItems/" + equip.ToString());
                        if (skillNode == null) continue;
                        int id = -1, amount = 0;
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:67,代码来源:LoginHandler.cs

示例14: 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))
                            p.getSkills().setCurLevel(Skills.SKILL.PRAYER, newPrayer);
                        checkOverdose(p, Skills.SKILL.PRAYER);
						break;
						
					case 9: //Summoning potion [25% of players summoning + 7]
                        int newSummoning = (7 + (int)((double)p.getSkills().getMaxLevel(Skills.SKILL.SUMMONING) * 0.25)) + p.getSkills().getCurLevel(Skills.SKILL.SUMMONING);
                        if (newSummoning < p.getSkills().getCurLevel(Skills.SKILL.SUMMONING))
                            p.getSkills().setCurLevel(Skills.SKILL.SUMMONING, newSummoning);

                        statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
						break;
						
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:Consumables.cs

示例15: 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:slapglif,项目名称:runescape-server-csharp,代码行数:6,代码来源:Consumables.cs


注:本文中的RunescapeServer.player.Player.getSkills方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。