コード例 #1
0
 void ProcessLoadout(Legacy.Solar.Loadout ld, GameData.SystemObject obj)
 {
     foreach (var key in ld.Equip.Keys)
     {
         var val = ld.Equip[key];
         if (val == null)
         {
             continue;
         }
         GameData.Items.Equipment equip = GetEquipment(val);
         if (equip != null)
         {
             if (key.StartsWith("__noHardpoint", StringComparison.Ordinal))
             {
                 obj.LoadoutNoHardpoint.Add(equip);
             }
             else
             {
                 if (!obj.Loadout.ContainsKey(key))
                 {
                     obj.Loadout.Add(key, equip);
                 }
             }
         }
     }
 }
コード例 #2
0
 public void AddCargo(GameData.Items.Equipment equip, string hardpoint, int count)
 {
     if (equip.Good?.Ini.Combinable ?? false)
     {
         if (!string.IsNullOrEmpty(hardpoint))
         {
             throw new InvalidOperationException("Tried to mount combinable item");
         }
         var slot = Items.FirstOrDefault(x => equip.Good.Equipment == x.Equipment);
         if (slot == null)
         {
             CargoItem dbItem = null;
             if (dbChar != null)
             {
                 dbItem = new CargoItem()
                 {
                     ItemCount = count, ItemName = equip.Nickname
                 };
                 dbChar.Character.Items.Add(dbItem);
                 dbChar.ApplyChanges();
             }
             Items.Add(new NetCargo()
             {
                 Equipment = equip, Count = count, DbItem = dbItem
             });
         }
         else
         {
             if (dbChar != null)
             {
                 slot.DbItem.ItemCount += count;
                 dbChar.ApplyChanges();
             }
             slot.Count += count;
         }
     }
     else
     {
         CargoItem dbItem = null;
         if (dbChar != null)
         {
             dbItem = new CargoItem()
             {
                 ItemCount = count, Hardpoint = hardpoint, ItemName = equip.Nickname
             };
             dbChar.Character.Items.Add(dbItem);
             dbChar.ApplyChanges();
         }
         Items.Add(new NetCargo()
         {
             Equipment = equip, Hardpoint = hardpoint, Count = count, DbItem = dbItem
         });
     }
 }
コード例 #3
0
 GameData.Items.Equipment GetEquipment(Legacy.Equipment.AbstractEquipment val)
 {
     GameData.Items.Equipment equip = null;
     if (val is Legacy.Equipment.Light)
     {
         equip = GetLight((Legacy.Equipment.Light)val);
     }
     else if (val is Legacy.Equipment.InternalFx)
     {
         var eq = new GameData.Items.AnimationEquipment();
         eq.Animation = ((Legacy.Equipment.InternalFx)val).UseAnimation;
         equip        = eq;
     }
     if (val is Legacy.Equipment.AttachedFx)
     {
         equip = GetAttachedFx((Legacy.Equipment.AttachedFx)val);
     }
     if (val is Legacy.Equipment.PowerCore)
     {
         var pc = (val as Legacy.Equipment.PowerCore);
         if (pc.MaterialLibrary != null)
         {
             resource.LoadMat(ResolveDataPath(pc.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(pc.DaArchetype));
         equip = new GameData.Items.PowerEquipment()
         {
             Model = drawable
         };
     }
     if (val is Legacy.Equipment.Thruster)
     {
         var th = (val as Legacy.Equipment.Thruster);
         resource.LoadMat(ResolveDataPath(th.MaterialLibrary));
         var drawable = resource.GetDrawable(ResolveDataPath(th.DaArchetype));
         equip = new GameData.Items.ThrusterEquipment()
         {
             Drain       = th.PowerUsage,
             Force       = th.MaxForce,
             Model       = drawable,
             HpParticles = th.HpParticles,
             Particles   = GetEffect(th.Particles)
         };
     }
     return(equip);
 }
コード例 #4
0
 GameData.Items.Equipment GetEquipment(Data.Equipment.AbstractEquipment val)
 {
     GameData.Items.Equipment equip = null;
     if (val is Data.Equipment.Light)
     {
         equip = GetLight((Data.Equipment.Light)val);
     }
     else if (val is Data.Equipment.InternalFx)
     {
         var eq = new GameData.Items.AnimationEquipment();
         eq.Animation = ((Data.Equipment.InternalFx)val).UseAnimation;
         equip        = eq;
     }
     if (val is Data.Equipment.AttachedFx)
     {
         equip = GetAttachedFx((Data.Equipment.AttachedFx)val);
     }
     if (val is Data.Equipment.PowerCore)
     {
         var pc = (val as Data.Equipment.PowerCore);
         if (pc.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(pc.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(pc.DaArchetype));
         equip = new GameData.Items.PowerEquipment()
         {
             Model = drawable
         };
     }
     if (val is Data.Equipment.Gun)
     {
         var gn = (val as Data.Equipment.Gun);
         if (gn.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(gn.MaterialLibrary));
         }
         var    drawable = resource.GetDrawable(ResolveDataPath(gn.DaArchetype));
         var    mn       = fldata.Equipment.Munitions.FirstOrDefault((x) => x.Nickname.Equals(gn.ProjectileArchetype, StringComparison.OrdinalIgnoreCase));
         var    effect   = fldata.Effects.FindEffect(mn.ConstEffect);
         string visbeam;
         if (effect == null)
         {
             visbeam = "";
         }
         else
         {
             visbeam = effect.VisBeam ?? "";
         }
         var mequip = new GameData.Items.MunitionEquip()
         {
             Def = mn,
             ConstEffect_Beam = fldata.Effects.BeamSpears.FirstOrDefault((x) => x.Nickname.Equals(visbeam, StringComparison.OrdinalIgnoreCase)),
             ConstEffect_Bolt = fldata.Effects.BeamBolts.FirstOrDefault((x) => x.Nickname.Equals(visbeam, StringComparison.OrdinalIgnoreCase))
         };
         equip = new GameData.Items.GunEquipment()
         {
             Model    = drawable,
             Munition = mequip,
             Def      = gn
         };
     }
     if (val is Data.Equipment.Thruster)
     {
         var th = (val as Data.Equipment.Thruster);
         resource.LoadResourceFile(ResolveDataPath(th.MaterialLibrary));
         var drawable = resource.GetDrawable(ResolveDataPath(th.DaArchetype));
         equip = new GameData.Items.ThrusterEquipment()
         {
             Drain       = th.PowerUsage,
             Force       = th.MaxForce,
             Model       = drawable,
             HpParticles = th.HpParticles,
             Particles   = GetEffect(th.Particles)
         };
     }
     equip.Nickname  = val.Nickname;
     equip.HPChild   = val.HPChild;
     equip.LODRanges = val.LODRanges;
     return(equip);
 }
コード例 #5
0
ファイル: LegacyGameData.cs プロジェクト: gp-alex/Librelancer
 GameData.Items.Equipment GetEquipment(Legacy.Equipment.AbstractEquipment val)
 {
     GameData.Items.Equipment equip = null;
     if (val is Legacy.Equipment.Light)
     {
         equip = GetLight((Legacy.Equipment.Light)val);
     }
     else if (val is Legacy.Equipment.InternalFx)
     {
         var eq = new GameData.Items.AnimationEquipment();
         eq.Animation = ((Legacy.Equipment.InternalFx)val).UseAnimation;
         equip        = eq;
     }
     if (val is Legacy.Equipment.AttachedFx)
     {
         equip = GetAttachedFx((Legacy.Equipment.AttachedFx)val);
     }
     if (val is Legacy.Equipment.PowerCore)
     {
         var pc = (val as Legacy.Equipment.PowerCore);
         if (pc.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(pc.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(pc.DaArchetype));
         equip = new GameData.Items.PowerEquipment()
         {
             Model = drawable
         };
     }
     if (val is Legacy.Equipment.Gun)
     {
         var gn = (val as Legacy.Equipment.Gun);
         if (gn.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(gn.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(gn.DaArchetype));
         equip = new GameData.Items.GunEquipment()
         {
             Model           = drawable,
             TurnRateRadians = MathHelper.DegreesToRadians(gn.TurnRate)
         };
     }
     if (val is Legacy.Equipment.Thruster)
     {
         var th = (val as Legacy.Equipment.Thruster);
         resource.LoadResourceFile(ResolveDataPath(th.MaterialLibrary));
         var drawable = resource.GetDrawable(ResolveDataPath(th.DaArchetype));
         equip = new GameData.Items.ThrusterEquipment()
         {
             Drain       = th.PowerUsage,
             Force       = th.MaxForce,
             Model       = drawable,
             HpParticles = th.HpParticles,
             Particles   = GetEffect(th.Particles)
         };
     }
     equip.Nickname  = val.Nickname;
     equip.HPChild   = val.HPChild;
     equip.LODRanges = val.LODRanges;
     return(equip);
 }