コード例 #1
0
ファイル: NpcLoader.cs プロジェクト: exodus444/swtoremu2
        public static void LoadReferences(Models.GameObject obj, GomObject gom)
        {
            var npc = (Npc)obj;

            ulong npcCharacterCompanionOverride = gom.Data.ValueOrDefault <ulong>("npcCharacterCompanionOverride", 0);

            if (npcCharacterCompanionOverride > 0)
            {
                npc.CompanionOverride = Load(npcCharacterCompanionOverride);
            }
            // No references to load
        }
コード例 #2
0
 public static void LoadReferences(Models.GameObject obj, GomObject gom)
 {
     // No references to load
 }
コード例 #3
0
ファイル: ItemLoader.cs プロジェクト: exodus444/swtoremu2
 public void LoadObject(Models.GameObject obj, GomObject gom)
 {
     Load(obj, gom);
 }
コード例 #4
0
ファイル: ItemLoader.cs プロジェクト: exodus444/swtoremu2
 public void LoadReferences(Models.GameObject obj, GomObject gom)
 {
     var itm = (Models.Item)obj;
 }
コード例 #5
0
ファイル: ItemLoader.cs プロジェクト: exodus444/swtoremu2
        public static Item Load(Models.GameObject obj, GomObject gom)
        {
            var itm = (Models.Item)obj;

            itm.NodeId          = gom.Id;
            itm.Fqn             = gom.Name;
            itm.AppearanceColor = Models.AppearanceColorExtensions.ToAppearanceColor((string)gom.Data.ValueOrDefault <string>("itmEnhancementColor", null));
            itm.ArmorSpec       = Models.ArmorSpecExtensions.ToArmorSpec((long)gom.Data.ValueOrDefault <long>("itmArmorSpec", 0));
            itm.Binding         = Models.ItemBindingRuleExtensions.ToBindingRule((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmBindingRule", null));

            itm.CombinedStatModifiers = new ItemStatList();
            itm.ConsumedOnUse         = (bool)gom.Data.ValueOrDefault <bool>("itmConsumedOnUse", false);
            //itm.Conversation
            itm.ConversationFqn = gom.Data.ValueOrDefault <string>("itmConversation", null);

            var descLookup = (GomObjectData)(gom.Data.Get <Dictionary <object, object> >("locTextRetrieverMap")[DescLookupKey]);

            itm.DescriptionId = descLookup.Get <long>("strLocalizedTextRetrieverStringID");
            itm.Description   = StringTable.TryGetString(itm.Fqn, descLookup);

            itm.DisassembleCategory    = Models.ProfessionSubtypeExtensions.ToProfessionSubtype((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("prfDisassembleCategory", null));
            itm.Durability             = (int)gom.Data.ValueOrDefault <long>("itmMaxDurability", 0);
            itm.EnhancementCategory    = Models.EnhancementCategoryExtensions.ToEnhancementCategory((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmEnhancementCategory", null));
            itm.EnhancementSubCategory = Models.EnhancementSubCategoryExtensions.ToEnhancementSubCategory((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmEnhancementSubCategory", null));
            itm.EnhancementType        = Models.EnhancementTypeExtensions.ToEnhancementType((long)gom.Data.ValueOrDefault <long>("itmEnhancementType", 0));

            // Enhancement Slots
            itm.EnhancementSlots = new ItemEnhancementList();
            var enhancementSlots    = (List <object>)gom.Data.ValueOrDefault <List <object> >("itmEnhancementSlots", null);
            var enhancementDefaults = (List <object>)gom.Data.ValueOrDefault <List <object> >("itmEnhancementDefaults", null);

            if (enhancementSlots != null)
            {
                for (var i = 0; i < 5; i++)
                {
                    long slot = (long)enhancementSlots[i];
                    if (slot == 0)
                    {
                        continue;
                    }

                    ItemEnhancement enh = new ItemEnhancement();
                    enh.Slot           = EnhancementTypeExtensions.ToEnhancementType(slot);
                    enh.ModificationId = (ulong)enhancementDefaults[i];
                    if (enh.ModificationId != 0)
                    {
                        enh.Modification = ItemLoader.Load(enh.ModificationId);
                    }

                    // Don't add empty modulator/augment slots to gear since for some reason it seems to be on every damn modifiable item
                    if ((enh.Slot == EnhancementType.Modulator) && (enh.Modification == null))
                    {
                        continue;
                    }

                    itm.EnhancementSlots.Add(enh);
                }
            }

            itm.EquipAbilityId = gom.Data.ValueOrDefault <ulong>("itmEquipAbility", 0);
            itm.EquipAbility   = AbilityLoader.Load(itm.EquipAbilityId);

            itm.GiftRank = Models.GiftRankExtensions.ToGiftRank((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmGiftAffectionRank", null));
            itm.GiftType = Models.GiftTypeExtensions.ToGiftType((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmGiftType", null));
            itm.Icon     = gom.Data.ValueOrDefault <string>("itmIcon", String.Empty);
            TorLib.Icons.Add(itm.Icon);

            itm.ItemLevel    = (int)gom.Data.ValueOrDefault <long>("itmBaseLevel", 0);
            itm.MaxStack     = (int)gom.Data.ValueOrDefault <long>("itmStackMax", 0);
            itm.ModifierSpec = gom.Data.ValueOrDefault <long>("itmModifierSetID", 0);
            itm.MountSpec    = gom.Data.ValueOrDefault <long>("itmMountSpec", 0);

            var nameLookup = (GomObjectData)(gom.Data.Get <Dictionary <object, object> >("locTextRetrieverMap")[NameLookupKey]);

            itm.NameId = nameLookup.Get <long>("strLocalizedTextRetrieverStringID");
            itm.Name   = StringTable.TryGetString(itm.Fqn, nameLookup);
            if (itm.Name == null)
            {
                itm.Name = String.Empty;
            }
            itm.Id = (ulong)(itm.NameId >> 32);

            itm.Quality = Models.ItemQualityExtensions.ToItemQuality((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmBaseQuality", null));
            //if (itm.EnhancementType != EnhancementType.None)
            //{
            itm.Rating = Tables.ItemRating.GetRating(itm.ItemLevel, itm.Quality);
            //}
            //else
            //{
            //itm.Rating = Tables.ItemRating.GetRating(itm.ItemLevel, ItemQuality.Premium);
            //}
            itm.RequiresAlignment         = (bool)gom.Data.ValueOrDefault <bool>("itmAlignmentRequired", false);
            itm.RequiredAlignmentTier     = (int)gom.Data.ValueOrDefault <long>("itmRequiredAlignmentTier", int.MaxValue);
            itm.RequiredAlignmentInverted = (bool)gom.Data.ValueOrDefault <bool>("itmRequiredAlignmentInverted", false);

            itm.Field_4000000FAFE42471 = gom.Data.ValueOrDefault <long>("field_4000000FAFE42471", 0);

            // Required Classes
            itm.RequiredClasses = new ClassSpecList();
            var classMap = (Dictionary <object, object>)gom.Data.ValueOrDefault <Dictionary <object, object> >("itmRequiredClasses", null);

            if (classMap != null)
            {
                foreach (var kvp in classMap)
                {
                    if ((bool)kvp.Value)
                    {
                        var classSpec = ClassSpecLoader.Load((ulong)kvp.Key);
                        if (classSpec == null)
                        {
                            continue;
                        }
                        itm.RequiredClasses.Add(classSpec);
                    }
                }
            }

            itm.RequiredGender          = GenderExtensions.ToGender((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("itmGenderRequired", null));
            itm.RequiredLevel           = (int)gom.Data.ValueOrDefault <long>("itmMinimumLevel", 0);
            itm.RequiredProfession      = Models.ProfessionExtensions.ToProfession((ScriptEnum)gom.Data.ValueOrDefault <ScriptEnum>("prfProfessionRequired", null));
            itm.RequiredProfessionLevel = (int)gom.Data.ValueOrDefault <long>("prfProfessionLevelRequired", 0);
            itm.RequiresSocial          = (bool)gom.Data.ValueOrDefault <bool>("itmSocialScoreRequired", false);
            itm.RequiredSocialTier      = (int)gom.Data.ValueOrDefault <long>("itmRequiredSocialScoreTier", 0);
            itm.RequiredValorRank       = (int)gom.Data.ValueOrDefault <long>("itmRequiredValorRank", 0);

            // Item is a recipe/schematic
            GomObjectData schematic = (GomObjectData)gom.Data.ValueOrDefault <object>("prfLearnedSchematic", null);

            if (schematic != null)
            {
                itm.SchematicId = schematic.Get <ulong>("prfSchematicSpecId");
                itm.Schematic   = SchematicLoader.Load(itm.SchematicId);
            }

            itm.ShieldSpec = ArmorSpecExtensions.ToArmorSpec((long)gom.Data.ValueOrDefault <long>("itmShieldSpec", 0));

            // Valid Inventory Slots
            itm.Slots = new SlotTypeList();
            var slotList = (List <object>)gom.Data.ValueOrDefault <List <object> >("itmSlotTypes", null);

            if (slotList != null)
            {
                foreach (var slot in slotList)
                {
                    SlotType slotType = SlotTypeExtensions.ToSlotType((ScriptEnum)slot);
                    if (SlotTypeExtensions.IgnoreSlot(slotType))
                    {
                        continue;
                    }
                    itm.Slots.Add(slotType);
                }
            }

            // Item Stats
            var stats = (Dictionary <object, object>)gom.Data.ValueOrDefault <Dictionary <object, object> >("itmEquipModStats", null);

            itm.StatModifiers = new ItemStatList();
            if (stats != null)
            {
                foreach (var kvp in stats)
                {
                    ItemStat itmStat = new ItemStat();
                    itmStat.Stat     = StatExtensions.ToStat((ScriptEnum)kvp.Key);
                    itmStat.Modifier = (int)(float)kvp.Value;
                    itm.StatModifiers.Add(itmStat);
                }
            }

            // Combined Stats
            itm.CombinedStatModifiers = new ItemStatList();
            itm.CombinedRequiredLevel = itm.RequiredLevel;
            itm.CombinedRating        = itm.Rating;
            foreach (var stat in itm.StatModifiers)
            {
                var itmStat = new ItemStat();
                itmStat.Stat     = stat.Stat;
                itmStat.Modifier = stat.Modifier;
                itm.CombinedStatModifiers.Add(itmStat);
            }

            foreach (var mod in itm.EnhancementSlots)
            {
                if (mod.Modification != null)
                {
                    if (mod.Slot.IsBaseMod())
                    {
                        if (mod.Modification.RequiredLevel > itm.CombinedRequiredLevel)
                        {
                            itm.CombinedRequiredLevel = mod.Modification.RequiredLevel;
                        }
                        if (mod.Modification.Rating > itm.CombinedRating)
                        {
                            itm.CombinedRating = mod.Modification.Rating;
                        }
                    }

                    foreach (var stat in mod.Modification.CombinedStatModifiers)
                    {
                        ItemStat itmStat = itm.CombinedStatModifiers.FirstOrDefault(s => s.Stat == stat.Stat);
                        if (itmStat == null)
                        {
                            itmStat           = new ItemStat();
                            itmStat.Stat      = stat.Stat;
                            itmStat.Modifier += stat.Modifier;
                            itm.CombinedStatModifiers.Add(itmStat);
                        }
                        else
                        {
                            itmStat.Modifier += stat.Modifier;
                        }
                    }
                }
            }

            //itm.TreasurePackageSpec;
            itm.TreasurePackageId = (long)gom.Data.ValueOrDefault <long>("field_40000013407C89A3", 0);
            itm.TypeBitSet        = (int)(long)gom.Data.ValueOrDefault <long>("itmTypeBitSet", 0);
            itm.UniqueLimit       = (int)gom.Data.ValueOrDefault <long>("itmUniqueLimit", 0);

            itm.UseAbilityId = gom.Data.ValueOrDefault <ulong>("itmUsageAbility", 0);
            itm.UseAbility   = AbilityLoader.Load(itm.UseAbilityId);

            itm.Value           = (int)gom.Data.ValueOrDefault <long>("itmValue", 0);
            itm.VendorStackSize = (int)gom.Data.ValueOrDefault <long>("itmStackVendor", 0);
            itm.WeaponSpec      = WeaponSpecExtensions.ToWeaponSpec((ulong)gom.Data.ValueOrDefault <ulong>("cbtWeaponSpec", 0));

            //ulong dmgType = (ulong)gom.Data.ValueOrDefault<ulong>("cbtDamageType", 0);
            //itm.DamageType = ItemDamageTypeExtensions.ToItemDamageType(dmgType);
            switch (itm.WeaponSpec)
            {
            case WeaponSpec.Lightsaber:
            case WeaponSpec.Polesaber:
            case WeaponSpec.Pistol:
            case WeaponSpec.Rifle:
            case WeaponSpec.SniperRifle:
            case WeaponSpec.AssaultCannon:
            { itm.DamageType = ItemDamageType.Energy; break; }

            case WeaponSpec.Vibroblade:
            case WeaponSpec.VibrobladeTech:
            case WeaponSpec.Vibroknife:
            case WeaponSpec.Shotgun:
            case WeaponSpec.Electrostaff:
            case WeaponSpec.ElectrostaffTech:
            { itm.DamageType = ItemDamageType.Kinetic; break; }

            default:
            { itm.DamageType = ItemDamageType.None; break; }
            }

            itm.IsModdable = ((itm.Quality == ItemQuality.Prototype) && (itm.EnhancementSlots.Count > 1)) || itm.Quality == ItemQuality.Moddable;

            ItemSubCategoryExtensions.SetCategory(itm);

            return(itm);
        }
コード例 #6
0
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Schematic sch = (Models.Schematic)loadMe;
     Load(sch, obj);
 }
コード例 #7
0
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Quest qst = (Models.Quest)loadMe;
     Load(qst, obj);
 }
コード例 #8
0
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Placeable loadObj = (Models.Placeable)loadMe;
     Load(loadObj, obj);
 }
コード例 #9
0
ファイル: AbilityLoader.cs プロジェクト: exodus444/swtoremu2
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Ability abl = (Models.Ability)loadMe;
     Load(abl, obj);
 }
コード例 #10
0
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.MapNote mpn = (Models.MapNote)loadMe;
     Load(mpn, obj);
 }
コード例 #11
0
ファイル: NpcLoader.cs プロジェクト: exodus444/swtoremu2
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Npc npc = (Models.Npc)loadMe;
     Load(npc, obj);
 }
コード例 #12
0
ファイル: CodexLoader.cs プロジェクト: exodus444/swtoremu2
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Codex cdx = (Models.Codex)loadMe;
     Load(cdx, obj);
 }
コード例 #13
0
ファイル: ItemSetLoader.cs プロジェクト: exodus444/swtoremu2
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.ItemSet set = (Models.ItemSet)loadMe;
     Load(set, obj.Data);
 }
コード例 #14
0
 public void LoadObject(Models.GameObject loadMe, GomObject obj)
 {
     GomLib.Models.Encounter loadObj = (Models.Encounter)loadMe;
     Load(loadObj, obj);
 }
コード例 #15
0
ファイル: GameObject.cs プロジェクト: ninojeannet/BriqueArc
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="model">Le modèle de l'objet</param>
 public GameObject(Models.GameObject model)
 {
     this.model = model;
 }