public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Conditional"); writer.WriteIndent(); writer.WriteLine("-Expression"); writer.Indent += 2; Condition.Print(writer); writer.Indent -= 2; writer.WriteIndent(); writer.WriteLine("-True"); writer.Indent += 2; IfTrue.Print(writer); writer.Indent -= 2; writer.WriteIndent(); writer.WriteLine("-False"); writer.Indent += 2; IfFalse.Print(writer); writer.Indent -= 2; }
public void Dump(IndentTextWriter writer) { var prefix = (Definition == null ? "UNDEFINED " : ""); var length = Packet.Length - Packet.HeaderSize; writer.WriteLine(TimeStampcreator(Timestamp) + string.Format(prefix + Sender + " Packet #{0} ({1}), Length: {2} bytes", Packet.PacketId.RawId, Packet.PacketId, length)); writer.IndentLevel++; if (Definition != null) { //Definition.Structure.Render(this, writer); m_parsedPacket.RenderTo(writer); } // display the remainder as hexadecimal byte-string var remainderLength = Packet.Length - Packet.Position; if (remainderLength > 0) { var byteStr = new List <string>(); while (Packet.Position < Packet.Length) { byteStr.Add(string.Format("{0:X2}", Packet.ReadByte())); } writer.WriteLine("Remainder (" + remainderLength + " bytes): " + byteStr.ToString(" ")); } writer.IndentLevel--; }
public static void DumpFactionTemplate(FactionTemplateEntry entry, IndentTextWriter writer) { writer.WriteLine("Id: " + entry.Id); writer.WriteLine("FactionId: " + entry.FactionId); writer.WriteLine("Flags: " + entry.Flags); /// <summary> /// The Faction-Group mask of this faction. /// </summary> writer.WriteLine("FactionGroup: " + entry.FactionGroup); /// <summary> /// Mask of Faction-Groups this faction is friendly towards /// </summary> writer.WriteLine("FriendGroup: " + entry.FriendGroup); /// <summary> /// Mask of Faction-Groups this faction is hostile towards /// </summary> writer.WriteLine("EnemyGroup: " + entry.EnemyGroup); writer.WriteLine("Explicit Enemies:"); writer.IndentLevel++; for (var i = 0; i < entry.EnemyFactions.Length; i++) { writer.WriteLine(i + ": " + entry.EnemyFactions[i]); } writer.IndentLevel--; writer.WriteLine("Explicit Friends:"); writer.IndentLevel++; for (var i = 0; i < entry.FriendlyFactions.Length; i++) { writer.WriteLine(i + ": " + entry.FriendlyFactions[i]); } writer.IndentLevel--; writer.WriteLine(); }
public static void WriteFactionTemplatesByFlag() { var templatesByFlag = new Dictionary<FactionTemplateFlags, List<FactionTemplateEntry>>(); foreach (var faction in FactionMgr.ByTemplateId.Where(faction => faction != null)) { foreach (FactionTemplateFlags member in Enum.GetValues(typeof(FactionTemplateFlags))) { if (faction.Template.Flags.HasAnyFlag(member)) { if (!templatesByFlag.ContainsKey(member)) { templatesByFlag.Add(member, new List<FactionTemplateEntry>()); templatesByFlag[member].Add(faction.Template); } else templatesByFlag[member].Add(faction.Template); } } } using (var writer = new IndentTextWriter(DumpFile)) { foreach (var flag in templatesByFlag.Keys) { writer.WriteLine(); writer.WriteLine("##############################################"); writer.WriteLine(flag); writer.WriteLine("##############################################"); writer.WriteLine(); foreach (var value in templatesByFlag[flag]) DumpFactionTemplate(value, writer); } } }
public int Visit(FuncDeclaration declaration) { _writer.Write("func "); _writer.Write(declaration.Name.Contents); _writer.Write('('); var sep = ""; foreach (var param in declaration.Parameters) { _writer.Write(sep); sep = ", "; _writer.Write(param.Name.Contents); _writer.Write(": "); _writer.Write(param.Type); } _writer.Write(')'); if (declaration.ReturnType != null) { _writer.Write(": "); _writer.Write(declaration.ReturnType); } _writer.WriteLine(); declaration.Body.Accept(this); return(0); }
public static void WriteVehicles() { Tools.StartRealm(); NPCMgr.Initialize(); NPCMgr.LoadNPCDefs(); using (var writer = new IndentTextWriter(ToolConfig.OutputDir + "Vehicles.txt")) { foreach (var entry in NPCMgr.GetAllEntries()) { if (entry.IsVehicle) { writer.WriteLine(entry); } } foreach (var entry in NPCMgr.GetAllEntries()) { if (entry.IsVehicle) { entry.Dump(writer); writer.WriteLine(); writer.WriteLine(" ################################### "); writer.WriteLine(); } } } }
private static void ExtractVehicleIds(ParsedUpdatePacket packet) { foreach (var block in packet.Blocks) { if (block.Type == UpdateType.Create) { var movement = block.Movement; if ((movement.UpdateFlags & UpdateFlags.Vehicle) != 0) { var isChar = block.EntityId.High == HighId.Player; string suffix; if (isChar) { suffix = ""; } else { suffix = string.Format(" {0} ({1})", block.EntityId.Entry, (int)block.EntityId.Entry); } writer.WriteLine("{0}{1}", isChar ? "Player" : "NPC", suffix); writer.IndentLevel++; writer.WriteLine("VehicleId: " + movement.VehicleId); writer.WriteLine("VehicleAimAdjustment: " + movement.VehicleAimAdjustment); writer.WriteLine("Hoverheight: " + block.GetFloat(UnitFields.HOVERHEIGHT)); writer.IndentLevel--; } } } }
public void Dump(string indent, IndentTextWriter writer) { writer.WriteLine(indent + "UpdateBlock: " + EntityId + " (FieldCount: " + UpdateCount + ")"); writer.IndentLevel++; writer.WriteLine(indent + "Type: " + Type); if (m_movement != null) { writer.WriteLine(); writer.WriteLine(indent + "Movement:"); m_movement.Dump(indent + "\t", writer); } writer.WriteLine(); if (EntityIds != null) { writer.WriteLine(); writer.WriteLine(indent + "EntityIds:"); foreach (var id in EntityIds) { writer.WriteLine(indent + "\t" + id); } } if (Values != null) { writer.WriteLine(indent + "Fields:"); var renderer = FieldRenderUtil.GetRenderer(EntityId.ObjectType); // use the exact if its available if (m_movement != null) { renderer = FieldRenderUtil.GetRenderer(m_movement.ObjectTypeId); // } writer.IndentLevel++; uint size = 0; for (uint i = 0; i < SetIndices.Length; i++) { var index = SetIndices[i]; size = renderer.Render(index, Values, writer); while (size > 1 && SetIndices.Length > i + 1) { // check if we can skip the next indices var next = SetIndices[i + 1]; if (next != index + 4) { break; } size--; i++; } } writer.IndentLevel--; } writer.WriteLine(); writer.IndentLevel--; }
public static void DumpQuest(IndentTextWriter writer, QuestTemplate quest) { writer.WriteLine("Quest: " + quest); writer.IndentLevel++; quest.Dump(writer); writer.IndentLevel--; writer.WriteLine(); writer.WriteLine("##################################################################"); writer.WriteLine(); }
public void WriteLine(string content) { try { writer.WriteLine(content); } catch (Exception e) { OnException(e); } }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("List Comprehension"); writer.WriteIndent(); writer.WriteLine("-Body"); writer.Indent += 2; Body.Print(writer); writer.Indent -= 2; }
public void RenderTo(IndentTextWriter writer) { if (IsSimple) { var str = m_structure.Name + ": " + Value; if (m_structure.SegmentType != null) { str += " (" + Utility.ChangeType(Value, m_structure.SegmentType, false) + ")"; } writer.WriteLine(str); } else { var indented = m_structure != null && m_structure.Name != null && m_subSegments.Count > 0; if (indented) { writer.IndentLevel++; writer.WriteLine(m_structure.Name + ": "); } if (IsList) { var i = 0; foreach (var element in m_list) { // ReSharper disable PossibleNullReferenceException writer.WriteLine(m_structure.Name + " #" + i++ + ": "); // ReSharper restore PossibleNullReferenceException writer.IndentLevel++; foreach (var elementSegment in element.SubSegments.Values) { elementSegment.RenderTo(writer); } writer.IndentLevel--; } } else { foreach (var segment in m_subSegments.Values) { segment.RenderTo(writer); } } if (indented) { writer.IndentLevel--; } } }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Object"); foreach (var value in Values) { writer.WriteIndent(); writer.WriteLine("-" + value.Key); writer.Indent += 2; value.Value.Print(writer); writer.Indent -= 2; } }
public static void ParsePacket(ParsablePacketInfo info, IndentTextWriter writer) { PacketAnalyzer.Dump(info, writer); writer.WriteLine(); ((IDisposable)info.Packet).Dispose(); }
protected static void HandlePacket(PacketParser parser) { var pac = parser.ParsedPacket; s_Writer.WriteLine(@"INSERT INTO `gameobject_roots` KEYS (entry, Type, displayid, Name) " + "VALUES ({0}, {1}, {2}, {3})", pac["Entry"].UIntValue, pac["Type"].UIntValue, pac["DisplayId"].UIntValue, pac["Name"].StringValue); }
public void Write(IndentTextWriter writer) { writer.WriteLine((object)this); ++writer.IndentLevel; writer.WriteLine("MapId: " + (object)this.MapId); writer.WriteLine("Position: " + (object)this.Position); writer.WriteLineNotDefault <float>(this.Radius, "Radius: " + (object)this.Radius); writer.WriteLineNotDefault <float>( (float)((double)this.BoxLength + (double)this.BoxWidth + (double)this.BoxHeight + (double)this.BoxYaw), "Box Length: " + (object)this.BoxLength + ", Width: " + (object)this.BoxWidth + ", Height: " + (object)this.BoxHeight + ", Yaw: " + (object)this.BoxYaw); if (this.Template != null) { this.Template.Write(writer); } --writer.IndentLevel; }
public uint Render(uint index, byte[] values, IndentTextWriter writer) { var fieldNum = index / 4; var field = Fields.Get(fieldNum); if (field != null) { string strVal; var len = field.Renderer(field, values, out strVal); writer.WriteLine(field.Name + ": " + strVal); return len; } if (values[index] != 0) { writer.WriteLine("{0}: {1}", fieldNum, values[index]); } return 1; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Prefix {0}", Operation); writer.Indent++; Right.Print(writer); writer.Indent--; }
public void Write(IndentTextWriter writer) { writer.WriteLine(this); writer.IndentLevel++; writer.WriteLine("MapId: " + MapId); writer.WriteLine("Position: " + Position); writer.WriteLineNotDefault(Radius, "Radius: " + Radius); writer.WriteLineNotDefault(BoxLength + BoxWidth + BoxHeight + BoxYaw, "Box Length: " + BoxLength + ", Width: " + BoxWidth + ", Height: " + BoxHeight + ", Yaw: " + BoxYaw); if (Template != null) { Template.Write(writer); } writer.IndentLevel--; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine(IsReadOnly ? "Const": "Var"); foreach (var declaration in Declarations) { writer.WriteIndent(); writer.WriteLine("-" + declaration.Name + (declaration.Initializer != null ? " =" : "")); if (declaration.Initializer != null) { writer.Indent += 2; declaration.Initializer.Print(writer); writer.Indent -= 2; } } }
public static void DumpToFile() { Init(); using (var writer = new IndentTextWriter(DumpFile)) { foreach (var at in AreaTriggerMgr.AreaTriggers) { if (at != null) { at.Write(writer); writer.WriteLine(); writer.WriteLine("##############################################"); writer.WriteLine(); } } } }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Field {0}", Name); writer.Indent++; Left.Print(writer); writer.Indent--; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Yield"); writer.Indent++; Value.Print(writer); writer.Indent--; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Foreach - {0}", Identifier); writer.WriteIndent(); writer.WriteLine("-Expression"); writer.Indent += 2; Expression.Print(writer); writer.Indent -= 2; writer.WriteIndent(); writer.WriteLine("-Block"); writer.Indent += 2; Block.Print(writer); writer.Indent -= 2; }
public static void WriteNPCs() { Tools.StartRealm(); NPCMgr.Initialize(); NPCMgr.LoadNPCDefs(); using (var writer = new IndentTextWriter(DumpFile)) { foreach (var entry in NPCMgr.GetAllEntries()) { entry.Dump(writer); writer.WriteLine(); writer.WriteLine(" ################################### "); writer.WriteLine(); } } WriteVehicles(); }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Indexer"); writer.WriteIndent(); writer.WriteLine("-Left"); writer.Indent += 2; Left.Print(writer); writer.Indent += 2; writer.WriteIndent(); writer.WriteLine("-Index"); writer.Indent += 2; Index.Print(writer); writer.Indent -= 2; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Pipeline"); writer.Indent++; Left.Print(writer); Right.Print(writer); writer.Indent--; }
public uint Render(uint index, byte[] values, IndentTextWriter writer) { var fieldNum = index / 4; var field = Fields.Get(fieldNum); if (field != null) { string strVal; var len = field.Renderer(field, values, out strVal); writer.WriteLine(field.Name + ": " + strVal); return(len); } if (values[index] != 0) { writer.WriteLine("{0}: {1}", fieldNum, values[index]); } return(1); }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("While"); writer.WriteIndent(); writer.WriteLine("-Condition"); writer.Indent += 2; Condition.Print(writer); writer.Indent -= 2; writer.WriteIndent(); writer.WriteLine("-Do"); writer.Indent += 2; Block.Print(writer); writer.Indent -= 2; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("For"); if (Initializer != null) { writer.WriteIndent(); writer.WriteLine("-Initializer"); writer.Indent += 2; Initializer.Print(writer); writer.Indent -= 2; } if (Condition != null) { writer.WriteIndent(); writer.WriteLine("-Condition"); writer.Indent += 2; Condition.Print(writer); writer.Indent -= 2; } if (Increment != null) { writer.WriteIndent(); writer.WriteLine("-Increment"); writer.Indent += 2; Increment.Print(writer); writer.Indent -= 2; } writer.WriteIndent(); writer.WriteLine("-Block"); writer.Indent += 2; Block.Print(writer); writer.Indent -= 2; }
public override void Print(IndentTextWriter writer) { writer.WriteIndent(); writer.WriteLine("Switch"); writer.WriteIndent(); writer.WriteLine("-Expression"); writer.Indent += 2; Expression.Print(writer); writer.Indent -= 2; foreach (var branch in Branches) { writer.WriteIndent(); writer.WriteLine("-Cases"); writer.Indent += 2; foreach (var condition in branch.Conditions) { condition.Print(writer); } writer.Indent -= 2; writer.WriteIndent(); writer.WriteLine(" Do"); writer.Indent += 2; branch.Block.Print(writer); writer.Indent -= 2; } if (DefaultBlock != null) { writer.WriteIndent(); writer.WriteLine("-Default"); writer.Indent += 2; DefaultBlock.Print(writer); writer.Indent -= 2; } }
public static void WriteQuests(string fileName, //Func<QuestTemplate, Dictionary<string, QuestTemplate>, bool> filter, Func<TextWriter, QuestTemplate, bool> extraOuput) { using (var writer = new IndentTextWriter(new StreamWriter(ToolConfig.OutputDir + fileName + ".txt", false))) { var quests = new List<QuestTemplate>(10000); foreach (var quest in QuestMgr.Templates) { if (quest == null) continue; //if (filter == null || filter(quest, quests)) //{ // quests[quest.Title] = quest; //} quests.Add(quest); } writer.WriteLine("Found {0} Quests:", quests.Count); writer.WriteLine(); if (extraOuput != null) { foreach (var quest in quests) { writer.WriteLine("{0} (Id: {1})", quest.DefaultTitle, quest.Id); extraOuput(writer, quest); } } writer.WriteLine(); writer.WriteLine("##########################################"); writer.WriteLine(); foreach (var spell in quests) { DumpQuest(writer, spell); } } }
public override void Print(IndentTextWriter writer) { var discardResult = Parent == null || Parent is BlockExpression; writer.WriteIndent(); writer.WriteLine("Postfix {0}" + (discardResult ? " - Result not used" : ""), Operation); writer.Indent++; Left.Print(writer); writer.Indent--; }
/*public static void Dump(byte[] packetContent, bool isSingleBlock, IndentTextWriter writer) * { * Dump(packetContent, isSingleBlock, writer, false); * } * * public static void Dump(PacketIn packet, IndentTextWriter writer) * { * Dump(GetBytes(packet), false, writer, false); * } * * public static void Dump(byte[] packetContent, bool isSingleBlock, IndentTextWriter writer, bool isCompressed) * { * Dump(DateTime.Now, packetContent, isSingleBlock, writer, isCompressed); * }*/ public static void Dump(DateTime timeStamp, byte[] packetContent, bool isSingleBlock, IndentTextWriter writer, bool isCompressed) { if (isCompressed) { packetContent = UpdateFieldsUtil.Decompress(packetContent); } var packet = new ParsedUpdatePacket(packetContent, isSingleBlock); writer.WriteLine(""); packet.Dump("", writer); }
/// <summary> /// Renders the given log file to the given output. /// </summary> /// <param name="file">The file from where to read the ksniffer-style logs</param> /// <param name="output">A StreamWriter or Console.Out etc</param> public static void ConvertLog(string logFile, TextWriter output) { // @"F:\coding\C#\WCell\Dumps\Dump_Spells.txt" var writer = new IndentTextWriter(output); FieldRenderUtil.IsOldEntity = false; var log = File.ReadAllLines(logFile); var packets = Extract(log); foreach (var packet in packets) { PacketAnalyzer.Render(packet, writer); writer.WriteLine(); packet.Dispose(); } }
/// <summary> /// Renders a single WoW - Packet /// </summary> public static void Dump(ParsablePacketInfo info, IndentTextWriter writer) { var packet = info.Packet; if (packet.PacketId.IsUpdatePacket) { ParsedUpdatePacket.Dump(info.Timestamp, packet.ReadBytes(packet.Length - packet.HeaderSize), false, writer, packet.PacketId.RawId == (uint)RealmServerOpCode.SMSG_COMPRESSED_UPDATE_OBJECT); } else { var parser = new PacketParser(info); parser.Parse(); parser.Dump(writer); } writer.WriteLine(); }
/*public static void Dump(byte[] packetContent, bool isSingleBlock, IndentTextWriter writer) { Dump(packetContent, isSingleBlock, writer, false); } public static void Dump(PacketIn packet, IndentTextWriter writer) { Dump(GetBytes(packet), false, writer, false); } public static void Dump(byte[] packetContent, bool isSingleBlock, IndentTextWriter writer, bool isCompressed) { Dump(DateTime.Now, packetContent, isSingleBlock, writer, isCompressed); }*/ public static void Dump(DateTime timeStamp, byte[] packetContent, bool isSingleBlock, IndentTextWriter writer, bool isCompressed) { if (isCompressed) { packetContent = UpdateFieldsUtil.Decompress(packetContent); } var packet = new ParsedUpdatePacket(packetContent, isSingleBlock); writer.WriteLine(""); packet.Dump("", writer); }
public void Write(IndentTextWriter writer) { writer.WriteLine("Type: " + Type); writer.WriteLineNotDefault(RequiredItemId, "RequiredItemId: " + RequiredItemId); writer.WriteLineNotDefault(RequiredItem2Id, "RequiredItem2Id: " + RequiredItem2Id); writer.WriteLineNotDefault(RequiredHeroicKeyId, "RequiredHeroicKeyId: " + RequiredHeroicKeyId); writer.WriteLineNotDefault(RequiredHeroicKey2Id, "RequiredHeroicKey2Id: " + RequiredHeroicKey2Id); writer.WriteLineNotDefault(RequiredQuestId, "RequiredQuestId: " + RequiredQuestId); writer.WriteLineNotDefault(RequiredLevel, "RequiredLevel: " + RequiredLevel); writer.WriteLineNotDefault(RequiredHeroicKeyId, "RequiredHeroicKeyId: " + RequiredHeroicKeyId); writer.WriteLineNotDefault(RequiredHeroicKeyId, "RequiredHeroicKeyId: " + RequiredHeroicKeyId); }
public void Dump(IndentTextWriter writer) { writer.WriteLine("{3}{0} (Id: {1}, {2})", DefaultName, Id, NPCId, Rank != 0 ? Rank + " " : ""); if (!string.IsNullOrEmpty(DefaultTitle)) { writer.WriteLine("Title: " + DefaultTitle); } if (Type != 0) { writer.WriteLine("Type: " + Type); } if (EntryFlags != 0) { writer.WriteLine("EntryFlags: " + EntryFlags); } if (Family != null) { writer.WriteLine("Family: " + Family); } if (IsLeader) { writer.WriteLine("Leader"); } writer.WriteLine("DisplayIds: " + DisplayIds.ToString(", ")); if (TrainerEntry != null) { writer.WriteLine("Trainer " //+ "for {0} {1}", // TrainerEntry.RequiredRace != 0 ? TrainerEntry.RequiredRace.ToString() : "", // TrainerEntry.RequiredClass != 0 ? TrainerEntry.RequiredClass.ToString() : "" ); } WriteFaction(writer); writer.WriteLineNotDefault(IsBoss, "Boss"); writer.WriteLine("Level: {0} - {1}", MinLevel, MaxLevel); writer.WriteLine("Health: {0} - {1}", MinHealth, MaxHealth); writer.WriteLineNotDefault(MinMana, "Mana: {0} - {1}", MinMana, MaxMana); writer.WriteLineNotDefault(NPCFlags, "Flags: " + NPCFlags); writer.WriteLineNotDefault(DynamicFlags, "DynamicFlags: " + DynamicFlags); writer.WriteLineNotDefault(UnitFlags, "UnitFlags: " + UnitFlags); writer.WriteLineNotDefault(ExtraFlags, "ExtraFlags: " + string.Format("0x{0:X}", ExtraFlags)); writer.WriteLineNotDefault(AttackTime + OffhandAttackTime, "AttackTime: " + AttackTime, "Offhand: " + OffhandAttackTime); writer.WriteLineNotDefault(RangedAttackTime, "RangedAttackTime: " + RangedAttackTime); writer.WriteLineNotDefault(AttackPower, "AttackPower: " + AttackPower); writer.WriteLineNotDefault(RangedAttackPower, "RangedAttackPower: " + RangedAttackPower); //writer.WriteLineNotDefault(OffhandAttackPower, "OffhandAttackPower: " + OffhandAttackPower); writer.WriteLineNotDefault(MinDamage + MaxDamage, "Damage: {0} - {1}", MinDamage, MaxDamage); writer.WriteLineNotDefault(RangedMinDamage + RangedMaxDamage, "RangedDamage: {0} - {1}", RangedMinDamage, RangedMaxDamage); writer.WriteLineNotDefault(OffhandMinDamage + OffhandMaxDamage, "OffhandDamage: {0} - {1}", OffhandMinDamage, OffhandMaxDamage); var resistances = new List<string>(8); for (var i = 0; i < Resistances.Length; i++) { var res = Resistances[i]; if (res > 0) { resistances.Add(string.Format("{0}: {1}", (DamageSchool)i, res)); } } if (Scale != 1) { writer.WriteLine("Scale: " + Scale); } var cr = GetRandomModel().CombatReach; var br = GetRandomModel().BoundingRadius; writer.WriteLine("CombatReach: " + cr); writer.WriteLine("BoundingRadius: " + br); writer.WriteLineNotDefault(resistances.Count, "Resistances: " + resistances.ToString(", ")); writer.WriteLineNotDefault(MoneyDrop, "MoneyDrop: " + MoneyDrop); writer.WriteLineNotDefault(InvisibilityType, "Invisibility: " + InvisibilityType); writer.WriteLineNotDefault(MovementType, "MovementType: " + MovementType); writer.WriteLineNotDefault(WalkSpeed + RunSpeed + FlySpeed, "Speeds - Walking: {0}, Running: {1}, Flying: {2} ", WalkSpeed, RunSpeed, FlySpeed); writer.WriteLineNotDefault(LootId + SkinLootId + PickPocketLootId, "{0}{1}{2}", LootId != 0 ? "Lootable " : "", SkinLootId != 0 ? "Skinnable " : "", PickPocketLootId != 0 ? "Pickpocketable" : ""); if (AddonData != null) { writer.WriteLineNotDefault(AddonData.MountModelId, "Mount: " + AddonData.MountModelId); writer.WriteLineNotDefault(AddonData.Auras.Count, "Auras: " + AddonData.Auras.ToString(", ")); } var spells = Spells; if (spells != null && spells.Count > 0) { writer.WriteLine("Spells: " + Spells.ToString(", ")); } if (Equipment != null) { writer.WriteLine("Equipment: {0}", Equipment.ItemIds.Where(id => id != 0).ToString(", ")); } if (DifficultyOverrideEntryIds != null && DifficultyOverrideEntryIds.Any(id => id != 0)) { var parts = new List<string>(4); for (var i = 0u; i < 3; i++) { var id = DifficultyOverrideEntryIds[i]; if (id != 0) { var entry = NPCMgr.GetEntry(id); MapTemplate map; MapDifficultyEntry diff; if (entry != null && (map = GetMapTemplate()) != null && (diff = map.GetDifficulty(i)) != null) { parts.Add(string.Format("{0} ({1}) = " + id + " (" + (uint)id + ")", diff.IsHeroic ? "Heroic" : "Normal", diff.MaxPlayerCount)); } else { parts.Add("(unknown difficulty) = " + id + " (" + (uint)id + ")"); } } } writer.WriteLine("DifficultyOverrides: {0}", parts.ToString("; ")); } if (KillCreditIds != null && KillCreditIds.Any(id => id != 0)) { var parts = new List<string>(2); for (var i = 0u; i < UnitConstants.MaxKillCredits; i++) { var id = KillCreditIds[i]; if (id != 0) { var entry = NPCMgr.GetEntry(id); if (entry != null) { parts.Add(id + " (" + (uint)id + ")"); } } } writer.WriteLine("KillCredits: {0}", parts.ToString("; ")); } //if (inclFaction) //{ // writer.WriteLineNotDefault(DefaultFactionId, "Faction: " + DefaultFactionId); //} }
public void Dump(string indent, IndentTextWriter writer) { writer.WriteLine(indent + PacketParser.TimeStampcreator(TimeStamp) + " Update Packet:"); writer.IndentLevel++; foreach (var block in m_blocks) { block.Dump(indent, writer); block.Dispose(); //writer.WriteLine(indent + "#########################################"); //writer.WriteLine(); } writer.IndentLevel--; }
public void Dump(IndentTextWriter writer) { writer.WriteLine("{3}{0} (Id: {1}, {2})", DefaultName, Id, NPCId, Rank != 0 ? Rank + " " : ""); if (!string.IsNullOrEmpty(DefaultTitle)) { writer.WriteLine("Title: " + DefaultTitle); } if (Type != 0) { writer.WriteLine("Type: " + Type); } if (EntryFlags != 0) { writer.WriteLine("EntryFlags: " + EntryFlags); } if (Family != null) { writer.WriteLine("Family: " + Family); } if (IsLeader) { writer.WriteLine("Leader"); } writer.WriteLine("DisplayIds: " + DisplayIds.ToString(", ")); if (TrainerEntry != null) { writer.WriteLine("Trainer " //+ "for {0} {1}", // TrainerEntry.RequiredRace != 0 ? TrainerEntry.RequiredRace.ToString() : "", // TrainerEntry.RequiredClass != 0 ? TrainerEntry.RequiredClass.ToString() : "" ); } WriteFaction(writer); writer.WriteLineNotDefault(IsBoss, "Boss"); writer.WriteLine("Level: {0} - {1}", MinLevel, MaxLevel); writer.WriteLine("Health: {0} - {1}", MinHealth, MaxHealth); writer.WriteLineNotDefault(MinMana, "Mana: {0} - {1}", MinMana, MaxMana); writer.WriteLineNotDefault(NPCFlags, "Flags: " + NPCFlags); writer.WriteLineNotDefault(DynamicFlags, "DynamicFlags: " + DynamicFlags); writer.WriteLineNotDefault(UnitFlags, "UnitFlags: " + UnitFlags); writer.WriteLineNotDefault(ExtraFlags, "ExtraFlags: " + ExtraFlags.ToString("0x:X")); writer.WriteLineNotDefault(AttackTime + OffhandAttackTime, "AttackTime: " + AttackTime, "Offhand: " + OffhandAttackTime); writer.WriteLineNotDefault(RangedAttackTime, "RangedAttackTime: " + RangedAttackTime); writer.WriteLineNotDefault(AttackPower, "AttackPower: " + AttackPower); writer.WriteLineNotDefault(RangedAttackPower, "RangedAttackPower: " + RangedAttackPower); writer.WriteLineNotDefault(OffhandAttackPower, "OffhandAttackPower: " + OffhandAttackPower); writer.WriteLineNotDefault(MinDamage + MaxDamage, "Damage: {0} - {1}", MinDamage, MaxDamage); writer.WriteLineNotDefault(RangedMinDamage + RangedMaxDamage, "RangedDamage: {0} - {1}", RangedMinDamage, RangedMaxDamage); writer.WriteLineNotDefault(OffhandMinDamage + OffhandMaxDamage, "OffhandDamage: {0} - {1}", OffhandMinDamage, OffhandMaxDamage); var resistances = new List<string>(8); for (var i = 0; i < Resistances.Length; i++) { var res = Resistances[i]; if (res > 0) { resistances.Add(string.Format("{0}: {1}", (DamageSchool)i, res)); } } if (Scale != 1) { writer.WriteLine("Scale: " + Scale); } var cr = GetRandomModel().CombatReach; var br = GetRandomModel().BoundingRadius; writer.WriteLine("CombatReach: " + cr); writer.WriteLine("BoundingRadius: " + br); writer.WriteLineNotDefault(resistances.Count, "Resistances: " + resistances.ToString(", ")); writer.WriteLineNotDefault(MoneyDrop, "MoneyDrop: " + MoneyDrop); writer.WriteLineNotDefault(InvisibilityType, "Invisibility: " + InvisibilityType); writer.WriteLineNotDefault(MovementType, "MovementType: " + MovementType); writer.WriteLineNotDefault(WalkSpeed + RunSpeed + FlySpeed, "Speeds - Walking: {0}, Running: {1}, Flying: {2} ", WalkSpeed, RunSpeed, FlySpeed); writer.WriteLineNotDefault(LootId + SkinLootId + PickPocketLootId, "{0}{1}{2}", LootId != 0 ? "Lootable " : "", SkinLootId != 0 ? "Skinnable " : "", PickPocketLootId != 0 ? "Pickpocketable" : ""); writer.WriteLineNotDefault(Auras.Count, "Auras: " + Auras.ToString(", ")); var spells = Spells; if (spells != null && spells.Count > 0) { writer.WriteLine("Spells: " + Spells.ToString(", ")); } writer.WriteLineNotDefault(ExtraA9Flags, "ExtraA9Flags: " + ExtraA9Flags); //if (inclFaction) //{ // writer.WriteLineNotDefault(DefaultFactionId, "Faction: " + DefaultFactionId); //} }
public void Dump(IndentTextWriter writer) { var prefix = (Definition == null ? "UNDEFINED " : ""); var length = Packet.Length - Packet.HeaderSize; writer.WriteLine(TimeStampcreator(Timestamp) + string.Format(prefix + Sender + " Packet #{0} ({1}), Length: {2} bytes", Packet.PacketId.RawId, Packet.PacketId, length)); writer.IndentLevel++; if (Definition != null) { //Definition.Structure.Render(this, writer); m_parsedPacket.RenderTo(writer); } // display the remainder as hexadecimal byte-string var remainderLength = Packet.Length - Packet.Position; if (remainderLength > 0) { var byteStr = new List<string>(); while (Packet.Position < Packet.Length) { byteStr.Add(string.Format("{0:X2}", Packet.ReadByte())); } writer.WriteLine("Remainder (" + remainderLength + " bytes): " + byteStr.ToString(" ")); } writer.IndentLevel--; }