public static SkillDistribution[] GetSkillDistribution() { int skip = (Core.ML ? 0 : Core.SE ? 1 : Core.AOS ? 3 : 6); SkillDistribution[] distribs = new SkillDistribution[SkillInfo.Table.Length - skip]; for (int i = 0; i < distribs.Length; ++i) { distribs[i] = new SkillDistribution(SkillInfo.Table[i]); } int totalSkillCap = PrestigeLevelConfig.IsEnabled ? PrestigeLevelConfig.LevelThreeSkillCap : Config.Get("PlayerCaps.TotalSkillCap", 7000); foreach (Mobile mob in World.Mobiles.Values) { if (mob.SkillsTotal >= 1500 && mob.SkillsTotal <= (totalSkillCap + 200) && mob is PlayerMobile) { Skills skills = mob.Skills; for (int i = 0; i < skills.Length - skip; ++i) { Skill skill = skills[i]; if (skill.BaseFixedPoint >= 1000) { distribs[i].m_NumberOfGMs++; } } } } return(distribs); }
public static SkillDistribution[] GetSkillDistribution() { int skip = (Core.ML ? 0 : Core.SE ? 1 : Core.AOS ? 3 : 6); //TODO: Change for ML SkillDistribution[] distribs = new SkillDistribution[SkillInfo.Table.Length - skip]; for (int i = 0; i < distribs.Length; ++i) { distribs[i] = new SkillDistribution(SkillInfo.Table[i]); } foreach (Mobile mob in World.Mobiles.Values) { if (mob.SkillsTotal >= 1500 && mob.SkillsTotal <= 7200 && mob is PlayerMobile) { Skills skills = mob.Skills; for (int i = 0; i < skills.Length - skip; ++i) { Skill skill = skills[i]; if (skill.BaseFixedPoint >= 1000) { distribs[i].m_NumberOfGMs++; } } } } return(distribs); }
public static SkillDistribution[] GetSkillDistribution() { SkillDistribution[] distribs = new SkillDistribution[SkillInfo.Table.Length]; for (int i = 0; i < distribs.Length; ++i) distribs[i] = new SkillDistribution(SkillInfo.Table[i]); foreach (Mobile mob in World.Mobiles.Values) { if (mob.SkillsTotal >= 1500 && mob.SkillsTotal <= (Config.Get("PlayerCaps.TotalSkillCap", 7000) + 200) && mob is PlayerMobile) { Skills skills = mob.Skills; for (int i = 0; i < skills.Length; ++i) { Skill skill = skills[i]; if (skill.BaseFixedPoint >= 1000) distribs[i].m_NumberOfGMs++; } } } return distribs; }
public static SkillDistribution[] GetSkillDistribution() { var distribs = new SkillDistribution[SkillInfo.Table.Length]; for (int i = 0; i < distribs.Length; ++i) { distribs[i] = new SkillDistribution(SkillInfo.Table[i]); } foreach (Mobile mob in World.Mobiles.Values) { if (mob.SkillsTotal < 1500 || mob.SkillsTotal > 7200 || !(mob is PlayerMobile)) { continue; } Skills skills = mob.Skills; int skip = mob.EraML ? 0 : mob.EraSE ? 1 : mob.EraAOS ? 3 : 6; for (int i = 0; i < skills.Length - skip; ++i) { Skill skill = skills[i]; if (skill.BaseFixedPoint >= 1000) { ++distribs[i].m_NumberOfGMs; } } } return(distribs); }
public static Chart CompileSkillChart( SkillDistribution[] distribs ) { PieChart chart = new PieChart( "GM Skill Distribution", "graphs_skill_distrib", true ); for ( int i = 0; i < 12; ++i ) chart.Items.Add( distribs[i].m_Skill.Name, distribs[i].m_NumberOfGMs ); int rem = 0; for ( int i = 12; i < distribs.Length; ++i ) rem += distribs[i].m_NumberOfGMs; chart.Items.Add( "Other", rem ); return chart; }
public static Report CompileSkillReport( SkillDistribution[] distribs ) { Report report = new Report( "Skill Report", "300" ); report.Columns.Add( "70%", "left", "Name" ); report.Columns.Add( "30%", "center", "GMs" ); for ( int i = 0; i < distribs.Length; ++i ) report.Items.Add( distribs[i].m_Skill.Name, distribs[i].m_NumberOfGMs, "N0" ); return report; }
public static SkillDistribution[] GetSkillDistribution() { int skip = ( Core.SE ? 0 : Core.AOS ? 2 : 5 ); SkillDistribution[] distribs = new SkillDistribution[SkillInfo.Table.Length - skip]; for ( int i = 0; i < distribs.Length; ++i ) distribs[i] = new SkillDistribution( SkillInfo.Table[i] ); foreach ( Mobile mob in World.Mobiles.Values ) { if ( mob.SkillsTotal >= 1500 && mob.SkillsTotal <= 7200 && mob is PlayerMobile ) { Skills skills = mob.Skills; for ( int i = 0; i < skills.Length - skip; ++i ) { Skill skill = skills[i]; if ( skill.BaseFixedPoint >= 1000 ) distribs[i].m_NumberOfGMs++; } } } return distribs; }
public EntityUpdate(BinaryReader reader) { byte[] uncompressed = Zlib.Decompress(reader.ReadBytes(reader.ReadInt32())); MemoryStream stream = new MemoryStream(uncompressed); BinaryReader r = new BinaryReader(stream); guid = r.ReadInt64(); var bitfield = r.ReadInt64(); if (Tools.GetBit(bitfield, 0)) { position = new LongVector(r); } if (Tools.GetBit(bitfield, 1)) { rotation = new FloatVector(r); } if (Tools.GetBit(bitfield, 2)) { velocity = new FloatVector(r); } if (Tools.GetBit(bitfield, 3)) { acceleration = new FloatVector(r); } if (Tools.GetBit(bitfield, 4)) { extraVel = new FloatVector(r); } if (Tools.GetBit(bitfield, 5)) { viewportPitch = r.ReadSingle(); } if (Tools.GetBit(bitfield, 6)) { physicsFlags = r.ReadInt32(); } if (Tools.GetBit(bitfield, 7)) { hostility = r.ReadByte(); } if (Tools.GetBit(bitfield, 8)) { entityType = r.ReadInt32(); } if (Tools.GetBit(bitfield, 9)) { mode = r.ReadByte(); } if (Tools.GetBit(bitfield, 10)) { modeTimer = r.ReadInt32(); } if (Tools.GetBit(bitfield, 11)) { combo = r.ReadInt32(); } if (Tools.GetBit(bitfield, 12)) { lastHitTime = r.ReadInt32(); } if (Tools.GetBit(bitfield, 13)) { appearance = new Appearance(r); } if (Tools.GetBit(bitfield, 14)) { entityFlags = r.ReadInt16(); } if (Tools.GetBit(bitfield, 15)) { roll = r.ReadInt32(); } if (Tools.GetBit(bitfield, 16)) { stun = r.ReadInt32(); } if (Tools.GetBit(bitfield, 17)) { slow = r.ReadInt32(); } if (Tools.GetBit(bitfield, 18)) { ice = r.ReadInt32(); } if (Tools.GetBit(bitfield, 19)) { wind = r.ReadInt32(); } if (Tools.GetBit(bitfield, 20)) { showPatchTime = r.ReadInt32(); } if (Tools.GetBit(bitfield, 21)) { entityClass = r.ReadByte(); } if (Tools.GetBit(bitfield, 22)) { specialization = r.ReadByte(); } if (Tools.GetBit(bitfield, 23)) { charge = r.ReadSingle(); } if (Tools.GetBit(bitfield, 24)) { unused24 = new FloatVector(r); } if (Tools.GetBit(bitfield, 25)) { unused25 = new FloatVector(r); } if (Tools.GetBit(bitfield, 26)) { rayHit = new FloatVector(r); } if (Tools.GetBit(bitfield, 27)) { HP = r.ReadSingle(); } if (Tools.GetBit(bitfield, 28)) { MP = r.ReadSingle(); } if (Tools.GetBit(bitfield, 29)) { block = r.ReadSingle(); } if (Tools.GetBit(bitfield, 30)) { multipliers = new Multipliers(r); } if (Tools.GetBit(bitfield, 31)) { unused31 = r.ReadByte(); } if (Tools.GetBit(bitfield, 32)) { unused32 = r.ReadByte(); } if (Tools.GetBit(bitfield, 33)) { level = r.ReadInt32(); } if (Tools.GetBit(bitfield, 34)) { XP = r.ReadInt32(); } if (Tools.GetBit(bitfield, 35)) { parentOwner = r.ReadInt64(); } if (Tools.GetBit(bitfield, 36)) { unused36 = r.ReadInt64(); } if (Tools.GetBit(bitfield, 37)) { powerBase = r.ReadByte(); } if (Tools.GetBit(bitfield, 38)) { unused38 = r.ReadInt32(); } if (Tools.GetBit(bitfield, 39)) { unused39 = new IntVector(r); } if (Tools.GetBit(bitfield, 40)) { spawnPos = new LongVector(r); } if (Tools.GetBit(bitfield, 41)) { unused41 = new IntVector(r); } if (Tools.GetBit(bitfield, 42)) { unused42 = r.ReadByte(); } if (Tools.GetBit(bitfield, 43)) { consumable = new Item(r); } if (Tools.GetBit(bitfield, 44)) { equipment = new Item[13]; for (int i = 0; i < 13; i++) { equipment[i] = new Item(r); } } if (Tools.GetBit(bitfield, 45)) { name = new string(r.ReadChars(16)); name = name.Substring(0, name.IndexOf("\0")); } if (Tools.GetBit(bitfield, 46)) { skillDistribution = new SkillDistribution(r); } if (Tools.GetBit(bitfield, 47)) { manaCubes = r.ReadInt32(); } }
public void Filter(EntityUpdate previous) { if (position != null) { if (Math.Abs(position.x - previous.position.x) < 100000 && Math.Abs(position.y - previous.position.y) < 100000 && Math.Abs(position.z - previous.position.z) < 100000) { position = null; } } rotation = null; if (velocity != null) { if (Math.Abs(velocity.z - previous.velocity.z) < 2) { velocity = null; } } if (acceleration != null) { if (Math.Abs(acceleration.x - previous.acceleration.x) < 10 && Math.Abs(acceleration.y - previous.acceleration.y) < 10 && Math.Abs(acceleration.z - previous.acceleration.z) < 10) { acceleration = null; } } if (extraVel != null) { if (Math.Abs(extraVel.x) < 1 && Math.Abs(extraVel.y) < 1 && Math.Abs(extraVel.z) < 1) { extraVel = null; } } viewportPitch = null; physicsFlags = null; if (modeTimer != null && modeTimer > 100) { previous.modeTimer = modeTimer;//necessary for rayhit filtering modeTimer = null; } lastHitTime = null; if (roll != null && !(roll > 500)) { roll = null; } if (stun != null && stun < previous.stun) { stun = null; } if (slow != null && slow < previous.slow) { slow = null; } if (ice != null && ice < previous.ice) { ice = null; } if (wind != null && wind < previous.wind) { wind = null; } showPatchTime = null; if (charge != null) { if (Math.Abs((float)(charge - previous.charge)) < 0.1f) { charge = null; } } unused24 = null; unused25 = null; if (rayHit != null) { if (previous.mode == 0 || previous.modeTimer > 1500 || //current could be null (Math.Abs(rayHit.x - previous.rayHit.x) < 1.5f && Math.Abs(rayHit.y - previous.rayHit.y) < 1.5f && Math.Abs(rayHit.z - previous.rayHit.z) < 1.5f)) { rayHit = null; } } MP = null; multipliers = null; unused31 = null; unused32 = null; XP = null; unused36 = null; powerBase = null; unused38 = null; unused39 = null; spawnPos = null; unused41 = null; unused42 = null; skillDistribution = null; manaCubes = null; }
public static SkillDistribution[] GetSkillDistribution() { var distribs = new SkillDistribution[SkillInfo.Table.Length]; for (int i = 0; i < distribs.Length; ++i) { distribs[i] = new SkillDistribution(SkillInfo.Table[i]); } foreach (Mobile mob in World.Mobiles.Values) { if (mob.SkillsTotal < 1500 || mob.SkillsTotal > 7200 || !(mob is PlayerMobile)) { continue; } Skills skills = mob.Skills; int skip = mob.EraML ? 0 : mob.EraSE ? 1 : mob.EraAOS ? 3 : 6; for (int i = 0; i < skills.Length - skip; ++i) { Skill skill = skills[i]; if (skill.BaseFixedPoint >= 1000) { ++distribs[i].m_NumberOfGMs; } } } return distribs; }
static void ProcessPacket(int packetid) { switch (packetid) { case 0: #region entityUpdate var entityUpdate = new EntityUpdate(reader); if (players.ContainsKey(entityUpdate.guid)) { entityUpdate.Merge(players[entityUpdate.guid]); } else { players.Add(entityUpdate.guid, entityUpdate); } if (players[entityUpdate.guid].name == "malox") { maloxGuid = entityUpdate.guid; var x = players[entityUpdate.guid].position.x - players[personalGuid].position.x; var y = players[entityUpdate.guid].position.y - players[personalGuid].position.y; double distance = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)); if (distance > 65536 * 40) { var follow = new EntityUpdate { position = players[entityUpdate.guid].position, guid = personalGuid }; follow.Write(writer); } if (entityUpdate.modeTimer < 50) { var shoot = new Shoot() { attacker = personalGuid, chunkX = (int)players[personalGuid].position.x / 0x1000000, chunkY = (int)players[personalGuid].position.y / 0x1000000, position = players[personalGuid].position, particles = 1f, mana = 1f, scale = 1f, projectile = 0, }; shoot.position.x = players[maloxGuid].position.x + (long)(players[maloxGuid].rayHit.x * 0x10000); shoot.position.y = players[maloxGuid].position.y + (long)(players[maloxGuid].rayHit.y * 0x10000); shoot.position.z = players[maloxGuid].position.z + (long)((players[maloxGuid].rayHit.z + 15) * 0x10000); shoot.velocity.z = -40f; //shoot.velocity.x = (float)players[maloxGuid].position.x / 0x10000f + players[maloxGuid].rayHit.x - (float)players[personalGuid].position.x / 0x10000f; //shoot.velocity.y = (float)players[maloxGuid].position.y / 0x10000f + players[maloxGuid].rayHit.y - (float)players[personalGuid].position.y / 0x10000f; //shoot.velocity.z = (float)players[maloxGuid].position.z / 0x10000f + players[maloxGuid].rayHit.z - (float)players[personalGuid].position.z / 0x10000f; int range = 20; shoot.position.x -= (range - 1) / 2 * 0x10000; shoot.position.y -= (range - 1) / 2 * 0x10000; for (int i = 0; i < range; i++) { for (int j = 0; j < range; j++) { shoot.Write(writer); shoot.position.x += 0x10000; } shoot.position.x -= range * 0x10000; shoot.position.y += 0x10000; } } } break; #endregion case 2: #region complete new EntityUpdate() { lastHitTime = (int)stopWatch.ElapsedMilliseconds }.Write(writer); break; #endregion case 4: #region serverupdate var serverUpdate = new ServerUpdate(reader); foreach (var hit in serverUpdate.hits) { if (hit.target == personalGuid) { stopWatch.Restart(); players[personalGuid].HP -= hit.damage; var life = new EntityUpdate() { HP = players[personalGuid].HP, }; life.Write(writer); if (players[personalGuid].HP <= 0) { life.HP = 1623f; life.Write(writer); } } } break; #endregion case 5: #region time var time = new Time(reader); break; #endregion case 10: #region chat var chatMessage = new ChatMessage(reader, true); if (chatMessage.sender == 0) { Console.ForegroundColor = ConsoleColor.DarkGray; } else { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write(players[chatMessage.sender].name + ": "); Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine(chatMessage.message); if (chatMessage.message == "!give_me_items") { var port = new EntityUpdate { position = players[chatMessage.sender].position, guid = personalGuid }; port.Write(writer); players[personalGuid].position = port.position; var items = new List <Item>(); var rng = new Random(); for (byte i = 3; i <= 9; i++) { items.Add(new Item() { type = i, modifier = rng.Next(0x7FFFFFFF), rarity = 4, level = (short)players[chatMessage.sender].level }); } items[5].material = (byte)rng.Next(11, 12); items[6].material = (byte)rng.Next(11, 12); items.Add(items[6]); byte armorMaterial; switch (players[chatMessage.sender].entityClass) { case 0: //warrior //items[0].subtype = 0; items[0].material = 1; for (int i = 0; i < 6; i++) { items.Add(new Item() { type = 3, material = 1, modifier = rng.Next(0x7FFFFFFF), rarity = 4, level = (short)players[chatMessage.sender].level }); } items[8].subtype = 1; items[9].subtype = 2; items[10].subtype = 13; items[11].subtype = 15; items[12].subtype = 16; items[13].subtype = 17; armorMaterial = 1; break; case 1: //mage items[0].subtype = 10; items[0].material = 2; for (int i = 0; i < 3; i++) { items.Add(new Item() { type = 3, material = (byte)rng.Next(11, 12), modifier = rng.Next(0x7FFFFFFF), rarity = 4, level = (short)players[chatMessage.sender].level }); } items[8].subtype = 11; items[8].material = 2; items[9].subtype = 12; items[10].subtype = 12; armorMaterial = 25; break; case 2: //ranger items[0].subtype = 6; items[0].material = 2; for (int i = 0; i < 2; i++) { items.Add(new Item() { type = 3, material = 2, modifier = rng.Next(0x7FFFFFFF), rarity = 4, level = (short)players[chatMessage.sender].level }); } items[8].subtype = 7; items[9].subtype = 8; armorMaterial = 26; break; case 3: //rogue items[0].subtype = 3; items[0].material = 1; for (int i = 0; i < 2; i++) { items.Add(new Item() { type = 3, material = 1, modifier = rng.Next(0x7FFFFFFF), rarity = 4, level = (short)players[chatMessage.sender].level }); } items[8].subtype = 4; items[9].subtype = 5; armorMaterial = 27; break; default: goto case 0; } for (int i = 1; i <= 4; i++) { items[i].material = armorMaterial; } foreach (var that in items) { var drop = new EntityAction { type = (int)Database.ActionType.drop, item = that }; drop.Write(writer); } //item = new Item { // type = 3, // 3 = weapon // rarity = 4, // 4 = legendary // level = 647, // material = 1 //} } else if (chatMessage.message == "!come_here") { var port = new EntityUpdate { position = players[chatMessage.sender].position, guid = personalGuid }; port.Write(writer); } break; #endregion case 15: #region mapseed var mapSeed = new MapSeed(reader); break; #endregion case 16: #region join var join = new Join(reader); personalGuid = join.guid; var playerstats = new EntityUpdate() { position = new LongVector(), rotation = new FloatVector(), velocity = new FloatVector(), acceleration = new FloatVector(), extraVel = new FloatVector(), viewportPitch = 0, physicsFlags = 0b00000000_00000000_00000000_00010001, //17 hostility = 0, entityType = 0, mode = 0, modeTimer = 0, combo = 0, lastHitTime = 0, appearance = new Appearance() { character_size = new FloatVector() { x = 0.9600000381f, y = 0.9600000381f, z = 2.160000086f }, head_model = 1236, hair_model = 1280, hand_model = 430, foot_model = 432, body_model = 1, tail_model = -1, shoulder2_model = -1, wings_model = -1, head_size = 1.00999999f, body_size = 1f, hand_size = 1f, foot_size = 0.9800000191f, shoulder2_size = 1f, weapon_size = 0.9499999881f, tail_size = 0.8000000119f, shoulder_size = 1f, wings_size = 1f, body_offset = new FloatVector() { z = -5f }, head_offset = new FloatVector() { y = 0.5f, z = 5f }, hand_offset = new FloatVector() { x = 6f, }, foot_offset = new FloatVector() { x = 3f, y = 1f, z = -10.5f }, back_offset = new FloatVector() { y = -8f, z = 2f }, }, entityFlags = 0b00000000_00000000_00000000_00100000, //64 roll = 0, stun = 0, slow = 0, ice = 0, wind = 0, showPatchTime = 0, entityClass = 2, specialization = 0, charge = 0, unused24 = new FloatVector(), unused25 = new FloatVector(), rayHit = new FloatVector(), HP = 1623f, MP = 0, block = 1, multipliers = new Multipliers() { HP = 100, attackSpeed = 1, damage = 1, armor = 1, resi = 1, }, unused31 = 0, unused32 = 0, level = 500, XP = 0, parentOwner = 0, unused36 = 0, powerBase = 0, unused38 = 0, unused39 = new IntVector(), spawnPos = new LongVector(), unused41 = new IntVector(), unused42 = 0, consumable = new Item(), equipment = new Item[13], name = "ET_bot", skillDistribution = new SkillDistribution() { ability1 = 5, ability2 = 5, ability3 = 5, }, manaCubes = 0, }; for (int i = 0; i < 13; i++) { playerstats.equipment[i] = new Item(); } playerstats.Write(writer); stopWatch.Start(); players.Add(personalGuid, playerstats); break; #endregion case 17: //serving sending the right version if yours is wrong #region version var version = new ProtocolVersion(reader); break; #endregion case 18: #region server full //empty break; #endregion default: Console.WriteLine(string.Format("unknown packet id: {0}", packetid)); break; } }