Esempio n. 1
0
        public Weenie.Weenie ConvertToWeenie(out List <string> messages)
        {
            messages = new List <string>();
            Weenie.Weenie w = new Weenie.Weenie
            {
                DataObjectId  = WeenieId,
                WeenieClassId = WeenieId
            };

            w.IntProperties.Add(new Shared.IntProperty()
            {
                IntPropertyId = (int)IntPropertyId.WeenieType,
                Value         = WeenieTypeId
            });

            IntStats.ForEach(stat =>
            {
                w.IntProperties.Add(new Shared.IntProperty()
                {
                    IntPropertyId = stat.Key,
                    Value         = stat.Value
                });
            });

            Int64Stats?.ForEach(stat =>
            {
                w.Int64Properties.Add(new Shared.Int64Property()
                {
                    Int64PropertyId = stat.Key,
                    Value           = stat.Value
                });
            });

            FloatStats?.ForEach(stat =>
            {
                w.DoubleProperties.Add(new Shared.DoubleProperty()
                {
                    DoublePropertyId = stat.Key,
                    Value            = stat.Value
                });
            });

            DidStats?.ForEach(stat =>
            {
                w.DidProperties.Add(new Shared.DataIdProperty()
                {
                    DataIdPropertyId = stat.Key,
                    Value            = stat.Value
                });
            });

            BoolStats?.ForEach(stat =>
            {
                w.BoolProperties.Add(new Shared.BoolProperty()
                {
                    BoolPropertyId = stat.Key,
                    Value          = stat.BoolValue
                });
            });

            StringStats?.ForEach(stat =>
            {
                w.StringProperties.Add(new Shared.StringProperty()
                {
                    StringPropertyId = stat.Key,
                    Value            = stat.Value
                });
            });

            Book?.Pages.ForEach(page =>
            {
                w.BookProperties.Add(new Shared.BookPage()
                {
                    AuthorAccount = page.AuthorAccount,
                    AuthorId      = page.AuthorId,
                    AuthorName    = page.AuthorName,
                    IgnoreAuthor  = page.IgnoreAuthor ?? false,
                    Page          = 1 + (uint)Book.Pages.IndexOf(page),
                    PageText      = page.PageText
                });
            });

            Skills?.ForEach(skill =>
            {
                w.Skills.Add(new Shared.Skill()
                {
                    SkillId         = skill.SkillId,
                    Ranks           = skill.Skill.Ranks,
                    ExperienceSpent = skill.Skill.XpInvested,
                    Status          = skill.Skill.TrainedLevel,
                    BaseValue       = 0
                });
            });

            Spells?.ForEach(spell =>
            {
                w.Spells.Add(new Shared.Spell()
                {
                    SpellId     = spell.SpellId,
                    Probability = spell.Stats.CastingChance
                });
            });

            Positions?.ForEach(position =>
            {
                w.Positions.Add(new Shared.Position()
                {
                    X            = position.Position.Frame.Position.X,
                    Y            = position.Position.Frame.Position.Y,
                    Z            = position.Position.Frame.Position.Z,
                    QW           = position.Position.Frame.Rotations.W,
                    QX           = position.Position.Frame.Rotations.X,
                    QY           = position.Position.Frame.Rotations.Y,
                    QZ           = position.Position.Frame.Rotations.Z,
                    Landblock    = position.Position.LandCellId,
                    PositionType = position.PositionType
                });
            });

            GeneratorTable?.ForEach(entry =>
            {
                Shared.GeneratorTable gt = new Shared.GeneratorTable
                {
                    Frame = new Shared.Frame()
                };
                gt.Frame.Origin = new Shared.Origin();
                gt.Frame.Angles = new Shared.Angles();

                PropertyCopier <GeneratorTable, Shared.GeneratorTable> .Copy(entry, gt);
                gt.Frame.Angles.W = entry.Frame.Rotations.W;
                gt.Frame.Angles.X = entry.Frame.Rotations.X;
                gt.Frame.Angles.Y = entry.Frame.Rotations.Y;
                gt.Frame.Angles.Z = entry.Frame.Rotations.Z;
                gt.Frame.Origin.X = entry.Frame.Position.X;
                gt.Frame.Origin.Y = entry.Frame.Position.Y;
                gt.Frame.Origin.Z = entry.Frame.Position.Z;

                w.GeneratorTable.Add(gt);
            });

            uint emoteSetCounter = 0;

            if (EmoteTable != null)
            {
                emoteSetCounter = (uint)EmoteTable?.Count;
            }

            uint emoteCounter = 0;
            uint holdCategory = 0;

            EmoteTable?.ForEach(category =>
            {
                if (category.EmoteCategoryId != holdCategory)
                {
                    holdCategory = (uint)category.EmoteCategoryId;

                    if (holdCategory != 0)
                    {
                        emoteSetCounter--;
                    }
                }

                category.Emotes.ForEach(e =>
                {
                    var es = new Shared.EmoteSet()
                    {
                        EmoteSetGuid    = Guid.NewGuid(),
                        ClassId         = e.ClassId,
                        EmoteCategoryId = e.Category,
                        MaxHealth       = e.MaxHealth,
                        MinHealth       = e.MinHealth,
                        Probability     = e.Probability,
                        Quest           = e.Quest,
                        Style           = e.Style,
                        SubStyle        = e.SubStyle,
                        SortOrder       = emoteSetCounter,
                        VendorType      = e.VendorType
                    };

                    emoteCounter = 0;
                    e.Emotes.ForEach(ea =>
                    {
                        es.Emotes.Add(new Shared.Emote()
                        {
                            Amount              = ea.Amount,
                            Amount64            = ea.Amount64,
                            CreationProfile     = ea?.Item?.Convert(),
                            Delay               = ea.Delay ?? 0f,
                            Deleted             = false,
                            Display             = ea.Display,
                            EmoteTypeId         = ea.EmoteActionType,
                            EmoteGuid           = Guid.NewGuid(),
                            EmoteSetGuid        = es.EmoteSetGuid,
                            Extent              = ea.Extent ?? 0f,
                            HeroXp64            = ea.HeroXp64,
                            Maximum             = ea.Max,
                            Maximum64           = ea.Maximum64,
                            MaximumFloat        = ea.FMax,
                            Message             = ea.Message,
                            Minimum             = ea.Min,
                            Minimum64           = ea.Minimum64,
                            MinimumFloat        = ea.FMin,
                            Motion              = (MotionCommand?)ea.Motion,
                            Percent             = ea.Percent,
                            PhysicsScript       = (PhysicsScriptType?)ea.PScript,
                            PositionLandBlockId = null, // no source
                            PositionX           = ea.Frame?.Position.X,
                            PositionY           = ea.Frame?.Position.Y,
                            PositionZ           = ea.Frame?.Position.Z,
                            RotationW           = ea.Frame?.Rotations.W,
                            RotationX           = ea.Frame?.Rotations.X,
                            RotationY           = ea.Frame?.Rotations.Y,
                            RotationZ           = ea.Frame?.Rotations.Z,
                            Sound               = ea.Sound,
                            SpellId             = ea.SpellId,
                            Stat          = ea.Stat,
                            TestString    = ea.TestString,
                            TreasureClass = (TreasureClass?)ea.TreasureClass,
                            TreasureType  = (uint?)ea.TreasureType,
                            SortOrder     = emoteCounter,
                            WealthRating  = (WealthRating?)ea.WealthRating
                        });
                        emoteCounter++;
                    });
                    w.EmoteTable.Add(es);
                });
            });

            CreateList?.ForEach(ci =>
            {
                w.CreateList.Add(ci.Convert());
            });

            if (w.HasAbilities)
            {
                w.Abilities.Strength     = Attributes.Strength.Convert(AbilityId.Strength);
                w.Abilities.Endurance    = Attributes.Endurance.Convert(AbilityId.Endurance);
                w.Abilities.Coordination = Attributes.Coordination.Convert(AbilityId.Coordination);
                w.Abilities.Quickness    = Attributes.Quickness.Convert(AbilityId.Quickness);
                w.Abilities.Focus        = Attributes.Focus.Convert(AbilityId.Focus);
                w.Abilities.Self         = Attributes.Self.Convert(AbilityId.Self);

                w.Vitals.Health  = Attributes.Health.Convert(AbilityId.Health);
                w.Vitals.Stamina = Attributes.Stamina.Convert(AbilityId.Stamina);
                w.Vitals.Mana    = Attributes.Mana.Convert(AbilityId.Mana);
            }

            Body?.BodyParts?.ForEach(bp =>
            {
                var part = new Shared.BodyPart()
                {
                    BodyHeight     = bp.BodyPart.BH,
                    BodyPartType   = (BodyPartType)bp.Key,
                    Damage         = bp.BodyPart.DVal,
                    DamageType     = (DamageType)bp.BodyPart.DType,
                    DamageVariance = bp.BodyPart.DVar
                };

                if (bp.BodyPart.ArmorValues != null)
                {
                    part.ArmorValues.Base     = bp.BodyPart.ArmorValues.BaseArmor;
                    part.ArmorValues.Acid     = bp.BodyPart.ArmorValues.ArmorVsAcid;
                    part.ArmorValues.Bludgeon = bp.BodyPart.ArmorValues.ArmorVsBludgeon;
                    part.ArmorValues.Cold     = bp.BodyPart.ArmorValues.ArmorVsCold;
                    part.ArmorValues.Electric = bp.BodyPart.ArmorValues.ArmorVsElectric;
                    part.ArmorValues.Fire     = bp.BodyPart.ArmorValues.ArmorVsFire;
                    part.ArmorValues.Nether   = bp.BodyPart.ArmorValues.ArmorVsNether;
                    part.ArmorValues.Pierce   = bp.BodyPart.ArmorValues.ArmorVsPierce;
                    part.ArmorValues.Slash    = bp.BodyPart.ArmorValues.ArmorVsSlash;
                }

                if (bp.BodyPart.SD != null)
                {
                    part.TargetingData.HighLeftBack   = bp.BodyPart.SD.HLB;
                    part.TargetingData.HighLeftFront  = bp.BodyPart.SD.HLF;
                    part.TargetingData.HighRightBack  = bp.BodyPart.SD.HRB;
                    part.TargetingData.HighRightFront = bp.BodyPart.SD.HRF;
                    part.TargetingData.LowLeftBack    = bp.BodyPart.SD.LLB;
                    part.TargetingData.LowLeftFront   = bp.BodyPart.SD.LLF;
                    part.TargetingData.LowRightBack   = bp.BodyPart.SD.LRB;
                    part.TargetingData.LowRightFront  = bp.BodyPart.SD.LRF;
                    part.TargetingData.MidLeftBack    = bp.BodyPart.SD.MLB;
                    part.TargetingData.MidLeftFront   = bp.BodyPart.SD.MLF;
                    part.TargetingData.MidRightBack   = bp.BodyPart.SD.MRB;
                    part.TargetingData.MidRightFront  = bp.BodyPart.SD.MRF;
                }

                w.BodyParts.Add(part);
            });

            return(w);
        }
Esempio n. 2
0
        public Weenie.Weenie Convert(out List <string> warnings)
        {
            warnings = new List <string>();
            Weenie.Weenie w = new Weenie.Weenie();
            w.DataObjectId  = WCID;
            w.WeenieClassId = WCID;

            w.IntProperties.Add(new Shared.IntProperty()
            {
                IntPropertyId = (int)IntPropertyId.WeenieType, Value = (int)WeenieType
            });

            foreach (var kvp in IntValues)
            {
                w.IntProperties.Add(new Shared.IntProperty()
                {
                    IntPropertyId = int.Parse(kvp.Key), Value = kvp.Value
                });
            }

            foreach (var kvp in LongValues)
            {
                w.Int64Properties.Add(new Shared.Int64Property()
                {
                    Int64PropertyId = int.Parse(kvp.Key), Value = kvp.Value
                });
            }

            foreach (var kvp in BoolValues)
            {
                w.BoolProperties.Add(new Shared.BoolProperty()
                {
                    BoolPropertyId = int.Parse(kvp.Key), Value = kvp.Value
                });
            }

            foreach (var kvp in DoubleValues)
            {
                w.DoubleProperties.Add(new Shared.DoubleProperty()
                {
                    DoublePropertyId = int.Parse(kvp.Key), Value = kvp.Value
                });
            }

            foreach (var kvp in StringValues)
            {
                w.StringProperties.Add(new Shared.StringProperty()
                {
                    StringPropertyId = int.Parse(kvp.Key), Value = kvp.Value
                });
            }

            foreach (var kvp in DIDValues)
            {
                w.DidProperties.Add(new Shared.DataIdProperty()
                {
                    DataIdPropertyId = int.Parse(kvp.Key), Value = kvp.Value
                });
            }

            if (Extra1 != null)
            {
                warnings.Add("GDLWeenie contained 'Extra1' data - this data will be lost.");
            }

            if (Extra1 != null)
            {
                warnings.Add("GDLWeenie contained 'Extra2Items' data - this data will be lost.");
            }

            if (Extra1 != null)
            {
                warnings.Add("GDLWeenie contained 'Extra3Items' data - this data will be lost.");
            }

            return(w);
        }