public void sendSkillLevel(Skills.SKILL skill)
 {
     connection.SendPacket(new PacketBuilder().setId(38)
         .addByteA((byte)player.getSkills().getCurLevel(skill))
         .addInt1((int)player.getSkills().getXp(skill))
         .addByte((byte)skill).toPacket());
 }
 public Player(Connection connection)
 {
     this.connection = connection; //without this, new Packets(this); wouldn't function.
     if(connection != null)
         loginDetails = connection.getLoginDetails();
     appearance = new Appearance();
     follow = new Follow(this);
     bank = new Bank(this);
     inventory = new Inventory(this);
     equipment = new Equipment(this);
     friends = new Friends(this);
     prayers = new Prayers(this);
     skills = new Skills(this);
     attackStyle = new AttackStyle();
     packets = new Packets(this);
     localEnvironment = new LocalEnvironment(this);
     updateFlags = new AppearanceUpdateFlags(this);
     walkingQueue = new WalkingQueue(this);
     specialAttack = new SpecialAttack(this);
     chat = true;
     split = false;
     mouse = true;
     aid = false;
     magicType = 1;
     achievementDiaryTab = false;
     forgeCharge = 40;
     smallPouchAmount = 0;
     mediumPouchAmount = 0;
     largePouchAmount = 0;
     giantPouchAmount = 0;
     defenderWave = 0;
     autoRetaliate = false;
     vengeance = false;
     lastVengeanceTime = 0;
     poisonAmount = 0;
     specialAmount = 100;
     skullCycles = 0;
     recoilCharges = 40;
     barrowTunnel = -1;
     barrowKillCount = 0;
     barrowBrothersKilled = new bool[6];
     slayerPoints = 0;
     removedSlayerTasks = new string[4];
     for (int i = 0; i < removedSlayerTasks.Length; i++)
     {
         removedSlayerTasks[i] = "-";
     }
     agilityArenaStatus = 0;
     taggedLastAgilityPillar = false;
     paidAgilityArena = false;
     teleblockTime = 0;
     lastHit = -1;
     prayerDrainRate = 0;
     superAntipoisonCycles = 0;
     antifireCycles = 0;
     tradeRequests = new List<Player>();
     duelRequests = new List<Player>();
 }
	    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));
		    }
	    }
 public static void superRestorePotion(Player p, Skills.SKILL skill, double percentage)
 {
     percentage = p.getSkills().getMaxLevel(skill) * percentage;
     if (p.getSkills().getCurLevel(skill) == p.getSkills().getMaxLevel(skill) * percentage)
         return;
     if (p.getSkills().getCurLevel(skill) >= p.getSkills().getMaxLevel(skill))
         return;
     p.getSkills().setCurLevel(skill, p.getSkills().getCurLevel(skill) + (int)percentage);
     checkOverdose(p, skill);
     if (p.getSkills().getCurLevel(skill) <= 0)
         p.getSkills().setCurLevel(skill, 1);
 }
	    public static void restorePotion(Player p, Skills.SKILL skill, int minRestore, int maxRestore) {
            int restoreAmount = misc.random(minRestore, maxRestore);
            if (p.getSkills().getCurLevel(skill) >= p.getSkills().getMaxLevel(skill))
	            return;
            int mustRestore = p.getSkills().getMaxLevel(skill) - p.getSkills().getCurLevel(skill);
            if (restoreAmount > mustRestore) restoreAmount = mustRestore;
            p.getSkills().setCurLevel(skill, p.getSkills().getCurLevel(skill) + restoreAmount);
	        checkOverdose(p, skill);
	    }
	    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);
		    }
	    }