Created
April 18, 2011 15:21
-
-
Save Konctantin/925548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Автор: Konctantin <[email protected]> 2011-04-18 18:19:07 | |
Сохранивший состояние: Konctantin <[email protected]> 2011-04-18 18:19:07 | |
Предок: 34ee40512df803ac993a4d7b7361282ac982a103 (Merge branch 'kamilla-4.0.6' into packetviewer) | |
Потомок: 0000000000000000000000000000000000000000 (Изменения в рабочем каталоге, не зарегистрированные в индексе) | |
Ветвь: packetviewer | |
Следует за: | |
Предшествует: | |
Implement read Auras value | |
Signed-off-by: Konctantin <[email protected]> | |
-------------- Kamilla.WorldOfWarcraft/OpcodeDatas/AuraUpdates.cs -------------- | |
index d4b663a..b01cc4f 100644 | |
@@ -7,6 +7,8 @@ namespace Kamilla.WorldOfWarcraft.OpcodeDatas | |
{ | |
public class AuraUpdate : OpcodeData | |
{ | |
+ public const int MAX_EFFECT_INDEX = 3; | |
+ | |
public WowGuid Unit { get; private set; } | |
public byte Slot { get; private set; } | |
public uint SpellId { get; private set; } | |
----------- PacketViewer/UpdatePacketParser/FrmUpdatePacketParser.cs ----------- | |
index 72e02ca..f7ce1bd 100644 | |
@@ -13,8 +13,8 @@ namespace PacketViewer.UpdatePacketParser | |
{ | |
internal partial class FrmUpdatePacketParser : Form | |
{ | |
- UpdateParser m_parser; | |
- FrmUpdatePacketParserFilter m_filterForm; | |
+ private UpdateParser m_parser; | |
+ private FrmUpdatePacketParserFilter m_filterForm; | |
public FrmUpdatePacketParser(List<PacketParser> list) | |
{ | |
@@ -151,6 +151,12 @@ namespace PacketViewer.UpdatePacketParser | |
//{ | |
// m_parser.Phase = Reader.ReadUInt32(); | |
//} | |
+ | |
+ if (code == WowOpcodes.SMSG_AURA_UPDATE_ALL) | |
+ { | |
+ m_parser.ParseAurasAll(Reader); | |
+ } | |
+ | |
(sender as MyBackgroundWorker).Progress(i, parsers.Count); | |
Reader.Close(); | |
@@ -238,4 +244,4 @@ namespace PacketViewer.UpdatePacketParser | |
return new BinaryReader(new MemoryStream(uncompressedBytes)); | |
} | |
} | |
-} | |
+} | |
\ No newline at end of file | |
------------- PacketViewer/UpdatePacketParser/UpdateParser.Sql.cs ------------- | |
index 23ddbf3..a6919d4 100644 | |
@@ -1,6 +1,8 @@ | |
using System.Text; | |
+using System.Collections.Generic; | |
using Kamilla; | |
using Kamilla.WorldOfWarcraft; | |
+using Kamilla.WorldOfWarcraft.OpcodeDatas; | |
namespace PacketViewer.UpdatePacketParser | |
{ | |
@@ -124,7 +126,7 @@ namespace PacketViewer.UpdatePacketParser | |
var speedWalk = obj.GetFloatValue(UnitUpdateFields.UNIT_MOD_CAST_SPEED); | |
var boundingRadius = obj.GetFloatValue(UnitUpdateFields.UNIT_FIELD_BOUNDINGRADIUS); | |
var combatReach = obj.GetFloatValue(UnitUpdateFields.UNIT_FIELD_COMBATREACH); | |
- | |
+ var auras = GetAuras(obj); | |
#region Movement Type | |
var MovementType = 0; | |
@@ -166,14 +168,14 @@ namespace PacketViewer.UpdatePacketParser | |
{ | |
content.AppendFormatLine( | |
@"REPLACE INTO `creature_addon` VALUES ({0}, {1}, {2}, {3}, {4}, {5}, {6}, '{7}');", | |
- obj.WowGuid.Counter, mount, bytes1, sheath, pvpState, emote, sflags/*moveflags*/, string.Empty); | |
+ obj.WowGuid.Counter, mount, bytes1, sheath, pvpState, emote, sflags/*moveflags*/, auras); | |
} | |
if (mount != 0 || bytes1 != 0 || bytes2 != 0 || emote != 0 || sflags != 0) | |
{ | |
content.AppendFormatLine( | |
@"-- REPLACE INTO `creature_addon` VALUES ({0}, {1}, {2}, {3}, {4}, {5}, '{6}');", | |
- obj.WowGuid.Counter, mount, bytes1, bytes2, emote, sflags/*moveflags*/, string.Empty); | |
+ obj.WowGuid.Counter, mount, bytes1, bytes2, emote, sflags/*moveflags*/, auras); | |
} | |
if (scale != 1.0f)// default = 1 | |
@@ -375,5 +377,29 @@ namespace PacketViewer.UpdatePacketParser | |
return content.ToString(); | |
} | |
+ | |
+ private string GetAuras(WoWObject obj) | |
+ { | |
+ StringBuilder content = new StringBuilder(); | |
+ | |
+ if (Auras.ContainsKey(obj.WowGuid)) | |
+ { | |
+ foreach (AuraUpdate spellInfo in Auras[obj.WowGuid].Updates) | |
+ { | |
+ if (spellInfo.SpellId > 0 && (spellInfo.Flags & AuraFlags.NotCaster) != 0) | |
+ { | |
+ for (int i = 0; i < AuraUpdate.MAX_EFFECT_INDEX; ++i) | |
+ { | |
+ if ((spellInfo.Flags & AuraFlags.EffectIndex_0 + i) != 0) | |
+ { | |
+ content.AppendFormat("{0} {1} ", spellInfo.SpellId, i); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
+ return content.ToString().Trim(); | |
+ } | |
} | |
} | |
\ No newline at end of file | |
--------------- PacketViewer/UpdatePacketParser/UpdateParser.cs --------------- | |
index ef57e2b..513e623 100644 | |
@@ -5,12 +5,15 @@ using System.Text; | |
using System.Windows.Forms; | |
using Kamilla; | |
using Kamilla.WorldOfWarcraft; | |
+using Kamilla.WorldOfWarcraft.OpcodeDatas; | |
namespace PacketViewer.UpdatePacketParser | |
{ | |
internal partial class UpdateParser | |
{ | |
private readonly Dictionary<WowGuid, WoWObject> objects = new Dictionary<WowGuid, WoWObject>(); | |
+ private readonly Dictionary<WowGuid, AuraUpdateAll> m_auras = new Dictionary<WowGuid, AuraUpdateAll>(); | |
+ | |
private Dictionary<WowGuid, WoWObject> filtredObjects = new Dictionary<WowGuid, WoWObject>(); | |
public uint Map = 0; | |
@@ -80,7 +83,7 @@ namespace PacketViewer.UpdatePacketParser | |
objects[guid] = new WoWObject(typeId, movement, update.Data, Map, Area, Phase, flags); | |
} | |
- private static void ParseDestroyObjects(BinaryReader gr) | |
+ private void ParseDestroyObjects(BinaryReader gr) | |
{ | |
var count = gr.ReadUInt32(); | |
var guids = new ulong[count]; | |
@@ -88,6 +91,18 @@ namespace PacketViewer.UpdatePacketParser | |
guids[i] = gr.ReadPackedGuid().Raw; | |
} | |
+ public void ParseAurasAll(BinaryReader gr) | |
+ { | |
+ var aura = new AuraUpdateAll(); | |
+ aura.Read(gr); | |
+ if (aura.Unit.High == HighGuid.Unit || | |
+ aura.Unit.High == HighGuid.Unit2 || | |
+ aura.Unit.High == HighGuid.Vehicle || | |
+ aura.Unit.High == HighGuid.Vehicle2) | |
+ if (!m_auras.ContainsKey(aura.Unit)) | |
+ m_auras[aura.Unit] = aura; | |
+ } | |
+ | |
public void PrintObjectsType(ListView listView, ObjectTypeMask mask, CustomFilterMask customMask, int map, int area) | |
{ | |
filtredObjects.Clear(); | |
@@ -110,9 +125,11 @@ namespace PacketViewer.UpdatePacketParser | |
if ((customMask & CustomFilterMask.Units) != 0 && | |
(high == HighGuid.Unit || high == HighGuid.Unit2)) | |
continue; | |
+ | |
if ((customMask & CustomFilterMask.Pets) != 0 && ( | |
high == HighGuid.Pet || high == HighGuid.Pet2)) | |
continue; | |
+ | |
if ((customMask & CustomFilterMask.Vehicles) != 0 && | |
(high == HighGuid.Vehicle || high == HighGuid.Vehicle2)) | |
continue; | |
@@ -120,9 +137,11 @@ namespace PacketViewer.UpdatePacketParser | |
if ((customMask & CustomFilterMask.Objects) != 0 && | |
(high == HighGuid.GameObject || high == HighGuid.GameObject2)) | |
continue; | |
+ | |
if ((customMask & CustomFilterMask.Transport) != 0 && | |
(high == HighGuid.Transport || high == HighGuid.Transport2)) | |
continue; | |
+ | |
if ((customMask & CustomFilterMask.MoTransport) != 0 && | |
(high == HighGuid.MoTransport)) | |
continue; | |
@@ -343,6 +362,11 @@ namespace PacketViewer.UpdatePacketParser | |
get { return filtredObjects; } | |
} | |
+ public Dictionary<WowGuid, AuraUpdateAll> Auras | |
+ { | |
+ get { return m_auras; } | |
+ } | |
+ | |
public string GetSqlStatement() | |
{ | |
StringBuilder content = new StringBuilder(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment