public void execute(Player player, string[] arguments) { if (arguments.Length == 0) { player.getPackets().sendMessage("[Test Damage command]: ::testdmg dmg ::testdmg 2000"); return; } int dmg = 0; Hits.Hit hit; if (!int.TryParse(arguments[0], out dmg)) { dmg = 0; hit = new Hits.Hit(dmg, Hits.HitType.NO_DAMAGE); } else { hit = new Hits.Hit(dmg, Hits.HitType.NORMAL_DAMAGE); } player.getHits().setHit1(hit); player.getUpdateFlags().setHitUpdateRequired(true); }
private static void appendHitUpdate(Player p, PacketBuilder updateBlock) { int ratio = (p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) * 255) / p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS); if (p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) > p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS)) ratio = (p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS) * 255) / p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS); if(p.getHits().getHitDamage1() < 128) //damage can be either addByte [for damage less then 128 otherwise UShort] updateBlock.addByte((byte)p.getHits().getHitDamage1()); else updateBlock.addUShort(p.getHits().getHitDamage1() + 0x8000); updateBlock.addByteA((byte)p.getHits().getHitType1()); updateBlock.addByteS(ratio); }
private static void appendHit2Update(Player p, PacketBuilder updateBlock) { updateBlock.addByte((byte)p.getHits().getHitDamage2()); updateBlock.addByteS((byte)p.getHits().getHitType2()); }