Пример #1
0
        public void Update(NetworkMessageEventArgs CreateMsg)
        {
            LogTime = DateTime.Now.ToString();

            MessageStruct GameData = CreateMsg.Message.Struct("game");
            StringVals.Add(new KeyString((int)AStringValueKeys.Name, GameData.Value<string>("name")));
            LongVals.Add(new KeyLong((int)ALongValueKeys.Type, GameData.Value<long>("type")));
            LongVals.Add(new KeyLong((int)ALongValueKeys.Icon, GameData.Value<long>("icon")));
            LongVals.Add(new KeyLong((int)ALongValueKeys.Category, GameData.Value<long>("category")));
            LongVals.Add(new KeyLong((int)ALongValueKeys.Behavior, GameData.Value<long>("behavior")));

            int flags1 = GameData.Value<int>("flags1");
            if(flags1 != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.CreateFlags1, flags1));}
            int flags2 = 0;
            if((GameData.Value<int>("behavior") & 0x04000000) != 0){flags2 = GameData.Value<int>("flags2");}
            if(flags2 != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.CreateFlags2, flags2));}

            if((flags1 & 0x1) != 0) {StringVals.Add(new KeyString((int)AStringValueKeys.SecondaryName, GameData.Value<string>("namePlural")));}
            if((flags1 & 0x2) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.ItemSlots, GameData.Value<long>("itemSlots")));}
            if((flags1 & 0x4) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.PackSlots, GameData.Value<long>("packSlots")));}
            if((flags1 & 0x8) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Value, GameData.Value<long>("value")));}
            if((flags1 & 0x10) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Unknown10, GameData.Value<long>("unknown10")));}
            if((flags1 & 0x20) != 0) {DoubleVals.Add(new KeyDouble((int)ADoubleValueKeys.ApproachDistance, GameData.Value<double>("approachDistance")));}
            if((flags1 & 0x40) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Monarch, GameData.Value<long>("monarch")));}
            if((flags1 & 0x80) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.IconOutline, GameData.Value<long>("iconHighlight")));}
            if((flags1 & 0x100) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.MissileType, GameData.Value<long>("ammunition")));}
            if((flags1 & 0x200) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.EquipType, GameData.Value<long>("wieldType")));}
            if((flags1 & 0x400) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.UsesRemaining, GameData.Value<long>("uses")));}
            if((flags1 & 0x800) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.UsesTotal, GameData.Value<long>("usesLimit")));}
            if((flags1 & 0x1000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.StackCount, GameData.Value<long>("stack")));}
            if((flags1 & 0x2000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.StackMax, GameData.Value<long>("stackLimit")));}
            if((flags1 & 0x4000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Container, GameData.Value<long>("container")));}
            if((flags1 & 0x8000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Container, GameData.Value<long>("equipper")));}
            if((flags1 & 0x10000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.EquipableSlots, GameData.Value<long>("equipPossible")));}
            if((flags1 & 0x20000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.EquippedSlots, GameData.Value<long>("equipActual")));}
            if((flags1 & 0x40000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Coverage, GameData.Value<long>("coverage")));}
            if((flags1 & 0x80000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.UsageMask, GameData.Value<long>("useableOn")));}
            if((flags1 & 0x100000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Unknown100000, GameData.Value<long>("unknown100000")));}
            if((flags1 & 0x200000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Burden, GameData.Value<long>("burden")));}
            if((flags1 & 0x400000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.AssociatedSpell, GameData.Value<long>("spell")));}
            if((flags1 & 0x800000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Unknown800000, GameData.Value<long>("unknown800000")));}
            if((flags1 & 0x1000000) != 0) {DoubleVals.Add(new KeyDouble((int)ADoubleValueKeys.SalvageWorkmanship, GameData.Value<double>("workmanship")));}
            if((flags1 & 0x2000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.HouseOwner, GameData.Value<long>("owner")));}
            //0x4000000 is dwelling properties for access level
            if((flags1 & 0x8000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Unknown8000000, GameData.Value<long>("unknown8000000")));}
            if((flags1 & 0x10000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.HookMask, GameData.Value<long>("hookableOn")));}
            if((flags1 & 0x20000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.HookType, GameData.Value<long>("hookType")));}
            if((flags1 & 0x40000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.IconOverlay, GameData.Value<long>("iconOverlay")));}
            if((flags1 & 0x80000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.Material, GameData.Value<long>("material")));}

            if((flags2 & 0x4000000) != 0) {LongVals.Add(new KeyLong((int)ALongValueKeys.IconUnderlay, GameData.Value<long>("iconUnderlay")));}

            MessageStruct ModelData = CreateMsg.Message.Struct("model");

            int PaletteCount = ModelData.Value<int>("paletteCount");
            Palettes.Clear();

            if(PaletteCount != 0)
            {
                MessageStruct PaletteData = ModelData.Struct("palettes");
                for(int i = 0; i < PaletteCount; i++)
                {
                    Palettes.Add(PaletteData.Struct(i).Value<int>("palette"));
                }
            }

            int TextureCount = ModelData.Value<int>("textureCount");
            Textures.Clear();
            if(TextureCount != 0)
            {
                MessageStruct TextureData = ModelData.Struct("textures");
                for(int i = 0; i < TextureCount; i++)
                {
                    txture tmptxture = new txture();
                    tmptxture.Index = TextureData.Struct(i).Value<int>("index");
                    tmptxture.Old = TextureData.Struct(i).Value<int>("old");
                    tmptxture.New = TextureData.Struct(i).Value<int>("new");
                    Textures.Add(tmptxture);
                }
            }

            int ModelCount = ModelData.Value<int>("modelCount");
            Models.Clear();
            if(ModelCount != 0)
            {
                MessageStruct modelData = ModelData.Struct("models");
                for(int i = 0; i < ModelCount; i++)
                {
                    model mod = new model();
                    mod.Index = modelData.Struct(i).Value<int>("index");
                    mod.Model = modelData.Struct(i).Value<int>("model");
                    Models.Add(mod);
                }
            }

            MessageStruct PhysicsStruct = CreateMsg.Message.Struct("physics");
            KeyLong LongKey = LongVals.Where(x => x.Key == (int)ALongValueKeys.PhysicsDataFlags).FirstOrDefault();
            if(LongKey != null){LongKey.Val = PhysicsStruct.Value<int>("flags");}
            else{LongVals.Add(new KeyLong((int)ALongValueKeys.PhysicsDataFlags, PhysicsStruct.Value<int>("flags")));}

            MessageStruct PositionStruct = PhysicsStruct.Struct("position");
            Position = new PositionData(PositionStruct.Value<int>("landcell"), PositionStruct.Value<float>("x"), PositionStruct.Value<float>("y"), PositionStruct.Value<float>("z"));

            //Physics not decoded at this time
        }
Пример #2
0
        public AetherStats(NetworkMessageEventArgs e)
        {
            int key;
                KeyLong LongKey;
                KeyString StringKey;
                KeyResource ResourceKey;
                KeyQuad QuadKey;

                LogTime = DateTime.Now.ToString();
                Id = e.Message.Value<int>("character");
                MessageStruct EventStruct = e.Message.Struct("event");
                MessageStruct PropertyStruct = EventStruct.Struct("properties");

                int PropertyFlags = PropertyStruct.Value<int>("flags");
                if((PropertyFlags & (int)CharDecalFlags.LongValues) != 0)
                {
                    MessageStruct lMsg = PropertyStruct.Struct("dwords");
                    for(int i = 0; i < lMsg.Count; i++)
                    {
                        key = lMsg.Struct(i).Value<int>("key");
                        LongKey = LongVals.Where(x => x.Key == key).FirstOrDefault();
                        if(LongKey != null){LongKey.Val = lMsg.Struct(i).Value<long>("value");}
                        else{LongVals.Add(new KeyLong(key, lMsg.Struct(i).Value<long>("value")));}
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.BooleanValues) != 0)
                {
                    MessageStruct bMsg = PropertyStruct.Struct("booleans");
                    for(int i = 0; i < bMsg.Count; i++)
                    {
                        key = bMsg.Struct(i).Value<int>("key");
                        KeyBool BoolKey = BoolVals.Where(x => x.Key == key).FirstOrDefault();
                        if(BoolKey != null){BoolKey.Val = bMsg.Struct(i).Value<bool>("value");}
                        else{BoolVals.Add(new KeyBool(key, bMsg.Struct(i).Value<bool>("value")));}
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.DoubleValues) != 0)
                {
                    MessageStruct dMsg = PropertyStruct.Struct("doubles");
                    for(int i = 0; i < dMsg.Count; i++)
                    {
                        key = dMsg.Struct(i).Value<int>("key");
                        KeyDouble DoubleKey = DoubleVals.Where(x => x.Key == key).FirstOrDefault();
                        if(DoubleKey != null){DoubleKey.Val = dMsg.Struct(i).Value<double>("value");}
                        else{DoubleVals.Add(new KeyDouble(key, dMsg.Struct(i).Value<double>("value")));}
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.LinkValues) != 0)
                {
                    MessageStruct linkMsg = PropertyStruct.Struct("links");
                    for(int i = 0; i < linkMsg.Count; i++)
                    {
                        key = linkMsg.Struct(i).Value<int>("key");
            //						if(key == (int)LinkPropertyIds.AllegianceObject){}
                        if(key == (int)LinkPropertyIds.Container || key == (int)LinkPropertyIds.EquippedBy)
                        {
                            LongKey = LongVals.Where(x => x.Key == (int)LongValueKey.Container).FirstOrDefault();
                            if(LongKey != null){LongKey.Val =  linkMsg.Struct(i).Value<long>("value");}
                            else{LongVals.Add(new KeyLong((int)LongValueKey.Container,  linkMsg.Struct(i).Value<long>("value")));}
                        }
            //						if(key == (int)LinkPropertyIds.LastAttacker){}
                        if(key == (int)LinkPropertyIds.Monarch)
                        {
                            StringKey = StringVals.Where(x => x.Key == (int)StringValueKey.MonarchName).FirstOrDefault();
                            if(StringKey != null) {StringKey.Val =  linkMsg.Struct(i).Value<string>("value");}
                            else{StringVals.Add(new KeyString((int)StringValueKey.MonarchName,  linkMsg.Struct(i).Value<string>("value")));}
                        }
                        if(key == (int)LinkPropertyIds.OwnedBy || key == (int)LinkPropertyIds.Patron)
                        {
                            StringKey = StringVals.Where(x => x.Key == (int)StringValueKey.Patron).FirstOrDefault();
                            if(StringKey != null) {StringKey.Val =  linkMsg.Struct(i).Value<string>("value");}
                            else{StringVals.Add(new KeyString((int)StringValueKey.Patron,  linkMsg.Struct(i).Value<string>("value")));}
                        }
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.StringValues) != 0)
                {
                    MessageStruct sMsg = PropertyStruct.Struct("strings");
                    for(int i = 0; i < sMsg.Count; i++)
                    {
                        key = sMsg.Struct(i).Value<int>("key");
                        StringKey = StringVals.Where(x => x.Key == key).FirstOrDefault();
                        if(StringKey != null){StringKey.Val = sMsg.Struct(i).Value<string>("value");}
                        else{StringVals.Add(new KeyString(key, sMsg.Struct(i).Value<string>("value")));}
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.ResourceValues) != 0)
                {
                    MessageStruct rMsg = PropertyStruct.Struct("resources");
                    for(int i = 0; i < rMsg.Count; i++)
                    {
                        key = rMsg.Struct(i).Value<int>("key");
                        ResourceKey = ResourceVals.Where(x => x.Key == key).FirstOrDefault();
                        if(ResourceKey != null){ResourceKey.Val = rMsg.Struct(i).Value<int>("value");}
                        else{ResourceVals.Add(new KeyResource(key, rMsg.Struct(i).Value<int>("value")));}
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.QuadValues) != 0)
                {
                    MessageStruct qMsg = PropertyStruct.Struct("qwords");
                    for(int i = 0; i < qMsg.Count; i++)
                    {
                        key = qMsg.Struct(i).Value<int>("key");
                        QuadKey = QuadVals.Where(x => x.Key == key).FirstOrDefault();
                        if(QuadKey != null){QuadKey.Val = qMsg.Struct(i).Value<long>("value");}
                        else{QuadVals.Add(new KeyQuad(key, qMsg.Struct(i).Value<long>("value")));}
                    }
                }

                if((PropertyFlags & (int)CharDecalFlags.PositionValues) != 0)
                {
                    MessageStruct PositionStruct = PropertyStruct.Struct("positions");
                    LastCorpsePosition = new PositionData(PositionStruct.Value<int>("landcell"), PositionStruct.Value<float>("x"), PositionStruct.Value<float>("y"), PositionStruct.Value<float>("z"));
                }

                MessageStruct VectorStruct = EventStruct.Struct("vectors");
                int VectorFlags = VectorStruct.Value<int>("flags");

                if((VectorFlags & (int)CharVectorFlags.AttributeValues) != 0)
                {
                    MessageStruct AttribStruct;
                    int AttributeFlags = VectorStruct.Value<int>("attributeFlags");
                    if((AttributeFlags & (int)CharAttributeFlags.Strength) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("strength");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Strength).FirstOrDefault();
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp"));}
                        else{AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Strength, AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp")));}
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Endurance) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("endurance");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Endurance).FirstOrDefault();
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp"));}
                        else{AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Endurance, AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp")));}
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Quickness) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("quickness");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Quickness).FirstOrDefault();
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp"));}
                        else{AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Quickness, AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp")));}
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Coordination) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("coordination");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Coordination).FirstOrDefault();
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp"));}
                        else{AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Coordination, AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp")));}
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Focus) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("focus");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Focus).FirstOrDefault();
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp"));}
                        else{AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Focus, AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp")));}
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Self) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("self");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Self).FirstOrDefault();
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp"));}
                        else{AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Self, AttribStruct.Value<int>("raised"), AttribStruct.Value<int>("innate"), AttribStruct.Value<int>("xp")));}
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Health) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("health");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Health).FirstOrDefault();
                        CharKeyAttribute EndKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Endurance).FirstOrDefault();
                        int innate = 0;
                        if(EndKey != null) {innate = Convert.ToInt32((double)EndKey.Innate/2);}
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), innate, AttribStruct.Value<int>("xp")); AttribKey.UpdateCurrent(AttribStruct.Value<int>("current"));}
                        else
                        {
                            AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Health, AttribStruct.Value<int>("raised"), innate, AttribStruct.Value<int>("xp")));
                            AttribKey.UpdateCurrent(AttribStruct.Value<int>("current"));
                        }
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Stamina) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("stamina");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Stamina).FirstOrDefault();
                        CharKeyAttribute EndKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Endurance).FirstOrDefault();
                        int innate = 0;
                        if(EndKey != null) {innate = EndKey.Innate;}
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), innate, AttribStruct.Value<int>("xp")); AttribKey.UpdateCurrent(AttribStruct.Value<int>("current"));}
                        else
                        {
                            AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Stamina, AttribStruct.Value<int>("raised"), innate, AttribStruct.Value<int>("xp")));
                            AttribKey.UpdateCurrent(AttribStruct.Value<int>("current"));
                        }
                    }
                    if((AttributeFlags & (int)CharAttributeFlags.Mana) != 0)
                    {
                        AttribStruct = VectorStruct.Struct("mana");
                        CharKeyAttribute AttribKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Mana).FirstOrDefault();
                        CharKeyAttribute SelfKey = AttributeVals.Where(x => x.Key == (int)ACharAttributeKeys.Self).FirstOrDefault();
                        int innate = 0;
                        if(SelfKey != null) {innate = SelfKey.Innate;}
                        if(AttribKey != null){AttribKey.Update(AttribStruct.Value<int>("raised"), innate, AttribStruct.Value<int>("xp")); AttribKey.UpdateCurrent(AttribStruct.Value<int>("current"));}
                        else
                        {
                            AttributeVals.Add(new CharKeyAttribute((int)ACharAttributeKeys.Mana, AttribStruct.Value<int>("raised"), innate, AttribStruct.Value<int>("xp")));
                            AttribKey.UpdateCurrent(AttribStruct.Value<int>("current"));
                        }
                    }
                }

            //				MessageStruct GameData = CreateMsg.Message.Struct("game");
            //				StringVals.Add(new KeyString((int)StringValueKey.Name, GameData.Value<string>("name")));
            //				LongVals.Add(new KeyLong((int)LongValueKey.Type, GameData.Value<int>("type")));
            //				LongVals.Add(new KeyLong((int)LongValueKey.Icon, GameData.Value<int>("icon")));
            //				LongVals.Add(new KeyLong((int)LongValueKey.Category, GameData.Value<int>("category")));
            //				LongVals.Add(new KeyLong((int)LongValueKey.Behavior, GameData.Value<int>("behavior")));
            //
            //				int flags1 = GameData.Value<int>("flags1");
            //				if(flags1 != 0) {LongVals.Add(new KeyLong((int)LongValueKey.CreateFlags1, flags1));}
            //				int flags2 = 0;
            //				if((GameData.Value<int>("behavior") & 0x04000000) != 0){flags2 = GameData.Value<int>("flags2");}
            //				if(flags2 != 0) {LongVals.Add(new KeyLong((int)LongValueKey.CreateFlags2, flags2));}
            //
            //				if((flags1 & 0x1) != 0) {StringVals.Add(new KeyString((int)StringValueKey.SecondaryName, GameData.Value<string>("namePlural")));}
            //				if((flags1 & 0x2) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.ItemSlots, GameData.Value<int>("itemSlots")));}
            //				if((flags1 & 0x4) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.PackSlots, GameData.Value<int>("packSlots")));}
            //				if((flags1 & 0x8) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Value, GameData.Value<int>("value")));}
            //				if((flags1 & 0x10) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Unknown10, GameData.Value<int>("unknown10")));}
            //				if((flags1 & 0x20) != 0) {DoubleVals.Add(new KeyDouble((int)DoubleValueKey.ApproachDistance, GameData.Value<double>("approachDistance")));}
            //				if((flags1 & 0x40) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Monarch, GameData.Value<int>("monarch")));}
            //				if((flags1 & 0x80) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.IconOutline, GameData.Value<int>("iconHighlight")));}
            //				if((flags1 & 0x100) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.MissileType, GameData.Value<int>("ammunition")));}
            //				if((flags1 & 0x200) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.EquipType, GameData.Value<int>("wieldType")));}
            //				if((flags1 & 0x400) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.UsesRemaining, GameData.Value<int>("uses")));}
            //				if((flags1 & 0x800) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.UsesTotal, GameData.Value<int>("usesLimit")));}
            //				if((flags1 & 0x1000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.StackCount, GameData.Value<int>("stack")));}
            //
            //				if((flags1 & 0x2000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.StackMax, GameData.Value<int>("stackLimit")));}
            //				if((flags1 & 0x4000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Container, GameData.Value<int>("container")));}
            //				if((flags1 & 0x8000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Container, GameData.Value<int>("equipper")));}
            //				if((flags1 & 0x10000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.EquipableSlots, GameData.Value<int>("equipPossible")));}
            //				if((flags1 & 0x20000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.EquippedSlots, GameData.Value<int>("equipActual")));}
            //				if((flags1 & 0x40000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Coverage, GameData.Value<int>("coverage")));}
            //				if((flags1 & 0x80000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.UsageMask, GameData.Value<int>("useableOn")));}
            //				if((flags1 & 0x100000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Unknown100000, GameData.Value<int>("unknown100000")));}
            //				if((flags1 & 0x200000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Burden, GameData.Value<int>("burden")));}
            //				if((flags1 & 0x400000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.AssociatedSpell, GameData.Value<int>("spell")));}
            //				if((flags1 & 0x800000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Unknown800000, GameData.Value<int>("unknown800000")));}
            //				if((flags1 & 0x1000000) != 0) {DoubleVals.Add(new KeyDouble((int)DoubleValueKey.SalvageWorkmanship, GameData.Value<double>("workmanship")));}
            //				if((flags1 & 0x2000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.HouseOwner, GameData.Value<int>("owner")));}
            //				//0x4000000 is dwelling properties for access level
            //				if((flags1 & 0x8000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Unknown8000000, GameData.Value<int>("unknown8000000")));}
            //				if((flags1 & 0x10000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.HookMask, GameData.Value<int>("hookableOn")));}
            //				if((flags1 & 0x20000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.HookType, GameData.Value<int>("hookType")));}
            //				if((flags1 & 0x40000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.IconOverlay, GameData.Value<int>("iconOverlay")));}
            //				if((flags1 & 0x80000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.Material, GameData.Value<int>("material")));}
            //
            //				if((flags2 & 0x4000000) != 0) {LongVals.Add(new KeyLong((int)LongValueKey.IconUnderlay, GameData.Value<int>("iconUnderlay")));}
            //
            //
            //				MessageStruct ModelData = CreateMsg.Message.Struct("model");
            //
            //				int PaletteCount = ModelData.Value<int>("paletteCount");
            //
            //				if(PaletteCount != 0)
            //				{
            //					MessageStruct PaletteData = ModelData.Struct("palettes");
            //					for(int i = 0; i < PaletteCount; i++)
            //					{
            //						Palettes.Add(PaletteData.Struct(i).Value<int>("palette"));
            //					}
            //				}
            //
            //				int TextureCount = ModelData.Value<int>("textureCount");
            //				if(TextureCount != 0)
            //				{
            //					MessageStruct TextureData = ModelData.Struct("textures");
            //					for(int i = 0; i < TextureCount; i++)
            //					{
            //						txture tmptxture = new txture();
            //						tmptxture.Index = TextureData.Struct(i).Value<int>("index");
            //						tmptxture.Old = TextureData.Struct(i).Value<int>("old");
            //						tmptxture.New = TextureData.Struct(i).Value<int>("new");
            //						Textures.Add(tmptxture);
            //					}
            //				}
            //
            //				int ModelCount = ModelData.Value<int>("modelCount");
            //				if(ModelCount != 0)
            //				{
            //					MessageStruct modelData = ModelData.Struct("models");
            //					for(int i = 0; i < ModelCount; i++)
            //					{
            //						model mod = new model();
            //						mod.Index = modelData.Struct(i).Value<int>("index");
            //						mod.Model = modelData.Struct(i).Value<int>("model");
            //						Models.Add(mod);
            //					}
            //				}
            ////
            ////
            //				LongVals.Add(new KeyLong((int)LongValueKey.PhysicsDataFlags, CreateMsg.Message.Struct("physics").Value<int>("flags")));
            //				//Physics not decoded at this time
        }
Пример #3
0
        public void Set(NetworkMessageEventArgs e)
        {
            int key;
            KeyLong LongKey;
            KeyBool BoolKey;
            KeyString StringKey;
            switch(e.Message.Type)
            {
                case MessageType.AC_SET_OBJECT_DWORD:
                    key =  e.Message.Value<int>("key");
                    LongKey = LongVals.Where(x => x.Key == key).FirstOrDefault();
                    if(LongKey != null) {LongKey.Val = e.Message.Value<long>("value");}
                    else{LongVals.Add(new KeyLong(key, e.Message.Value<long>("value")));}
                    return;

                case MessageType.AC_SET_OBJECT_BOOLEAN:
                    key =  e.Message.Value<int>("key");
                    BoolKey = BoolVals.Where(x => x.Key == key).FirstOrDefault();
                    if(BoolKey != null) {BoolKey.Val = e.Message.Value<bool>("value");}
                    else{BoolVals.Add(new KeyBool(key, e.Message.Value<bool>("value")));}
                    return;

                case MessageType.AC_SET_OBJECT_STRING:
                    key =  e.Message.Value<int>("key");
                    StringKey = StringVals.Where(x => x.Key == key).FirstOrDefault();
                    if(StringKey != null) {StringKey.Val = e.Message.Value<string>("value");}
                    else{StringVals.Add(new KeyString(key, e.Message.Value<string>("value")));}
                    return;

                case MessageType.AC_SET_OBJECT_RESOURCE:
                    key =  e.Message.Value<int>("key");
                    KeyResource ResourceKey = ResourceVals.Where(x => x.Key == key).FirstOrDefault();
                    if(ResourceKey != null) {ResourceKey.Val = e.Message.Value<int>("value");}
                    else{ResourceVals.Add(new KeyResource(key, e.Message.Value<int>("value")));}
                    return;

                case MessageType.AC_SET_OBJECT_LINK:
                    key =  e.Message.Value<int>("key");
            //						if(key == (int)LinkPropertyIds.AllegianceObject){}
                    if(key == (int)LinkPropertyIds.Container || key == (int)LinkPropertyIds.EquippedBy)
                    {
                        LongKey = LongVals.Where(x => x.Key == (int)ALongValueKeys.Container).FirstOrDefault();
                        if(LongKey != null){LongKey.Val = e.Message.Value<long>("value");}
                        else{LongVals.Add(new KeyLong((int)ALongValueKeys.Container, e.Message.Value<long>("value")));}
                    }
            //						if(key == (int)LinkPropertyIds.LastAttacker){}
                    if(key == (int)LinkPropertyIds.Monarch)
                    {
                        StringKey = StringVals.Where(x => x.Key == (int)AStringValueKeys.MonarchName).FirstOrDefault();
                        if(StringKey != null) {StringKey.Val = e.Message.Value<string>("value");}
                        else{StringVals.Add(new KeyString((int)AStringValueKeys.MonarchName, e.Message.Value<string>("value")));}
                    }
                    if(key == (int)LinkPropertyIds.OwnedBy || key == (int)LinkPropertyIds.Patron)
                    {
                        StringKey = StringVals.Where(x => x.Key == (int)AStringValueKeys.Patron).FirstOrDefault();
                        if(StringKey != null) {StringKey.Val = e.Message.Value<string>("value");}
                        else{StringVals.Add(new KeyString((int)AStringValueKeys.Patron, e.Message.Value<string>("value")));}
                    }
                    return;

                case MessageType.AC_ADJUST_STACK:
                    LongKey = LongVals.Where(x => x.Key ==(int)ALongValueKeys.StackCount).FirstOrDefault();
                    if(LongKey != null) {LongKey.Val = e.Message.Value<long>("count");}
                    else{LongVals.Add(new KeyLong((int)ALongValueKeys.StackCount, e.Message.Value<long>("count")));}
                    return;

                case MessageType.AC_WIELD_OBJECT:
                    LongKey = LongVals.Where(x => x.Key == (int)ALongValueKeys.Container).FirstOrDefault();
                    if(LongKey != null) {LongKey.Val = e.Message.Value<long>("owner");}
                    else{LongVals.Add(new KeyLong((int)ALongValueKeys.Container, e.Message.Value<long>("owner")));}
                    return;

                case MessageType.AC_GAME_EVENT:
                    int Event = e.Message.Value<int>("event");
                    switch(Event)
                    {
                        case GameEvent.GE_INSERT_INVENTORY_ITEM:
                        case GameEvent.GE_SETPACK_CONTENTS:
                            LongKey = LongVals.Where(x => x.Key == (int)ALongValueKeys.Container).FirstOrDefault();
                            if(LongKey != null) {LongKey.Val = e.Message.Value<long>("container");}
                            else{LongVals.Add(new KeyLong((int)ALongValueKeys.Container, e.Message.Value<long>("container")));}
                            return;

                        case GameEvent.GE_UPDATE_HEALTH:
                            FractionalHealth = e.Message.Value<double>("health");
                            return;

                        case GameEvent.GE_UPDATE_MANA_BAR:
                            FractionalMana = e.Message.Value<double>("mana");
                            return;

                    }
                    return;
                case MessageType.AC_SET_POSITION_AND_MOTION:
                case MessageType.AC_LIFESTONE_MATERIALIZE:
                    MessageStruct PositionStruct = e.Message.Struct("position");
                    Position = new PositionData(PositionStruct.Value<int>("landcell"), PositionStruct.Value<float>("x"), PositionStruct.Value<float>("y"), PositionStruct.Value<float>("z"));
                    return;
            }
        }