예제 #1
0
 public void Sell(DateTime time, ulong id)
 {
     if (Weapons.ContainsKey(id))
     {
         var last = Weapons.GetLast(id);
         if (last.Sold == false)                                                                                                      // if not sold
         {
             Weapons[id] = new SuitWeapon(time, id, last.FDName, last.Name_Localised, last.Price, last.Class, last.WeaponMods, true); // new entry with this time but sold
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Weapons sold a weapon already sold " + id);
         }
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Weapons sold a weapon not seen " + id);
     }
 }
예제 #2
0
 public void Upgrade(DateTime time, ulong id, int cls, string[] weaponmods)
 {
     if (Weapons.ContainsKey(id))
     {
         var last = Weapons.GetLast(id);
         if (last.Sold == false) // if not sold
         {                       // new entry with the new class
             Weapons[id] = new SuitWeapon(time, id, last.FDName, last.Name_Localised, last.Price, cls, weaponmods, false);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Weapons upgrade but already sold " + id);
         }
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Weapons upgrade a weapon not seen " + id);
     }
 }
예제 #3
0
 public void Remove(ulong id, string slotname, SuitWeapon weap)
 {
     if (loadouts.ContainsKey(id))
     {
         var last = loadouts.GetLast(id);
         if (last.Modules.ContainsKey(slotname))
         {
             var ld = new SuitLoadout(last);
             ld.Modules.Remove(slotname);
             loadouts.Add(id, ld);
             System.Diagnostics.Debug.WriteLine("Suits Remove {0}-{1}-{2} with {3}", last.ID, last.Name, slotname, weap.Name_Localised);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Suits Remove Failed {0}-{1}-{2} with {3}", last.ID, last.Name, slotname, weap.Name_Localised);
         }
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Suits remove an unknown loadout " + id);
     }
 }
예제 #4
0
        public bool VerifyPresence(DateTime time, ulong id, string fdname, string namelocalised, long price, int cls, string[] weaponmods)
        {
            var w = Weapons.GetLast(id);

            if (w == null)
            {
                System.Diagnostics.Debug.WriteLine("Missing weapon {0} {1} {2}", id, fdname, namelocalised);
                Weapons[id] = new SuitWeapon(time, id, fdname, namelocalised, price, cls, weaponmods, false);
                return(false);
            }
            else
            {
                // if differs in cls, or weapons mods is null but new one isnt, or both are set but different
                if (w.Class != cls || (w.WeaponMods == null && weaponmods != null) || (w.WeaponMods != null && weaponmods != null && !w.WeaponMods.SequenceEqual(weaponmods)))
                {
                    //System.Diagnostics.Debug.WriteLine("Update weapon info {0} {1} {2}", id, fdname, namelocalised);
                    Weapons[id] = new SuitWeapon(time, id, fdname, namelocalised, w.Price, cls, weaponmods, false);
                    return(false);
                }
            }

            return(true);
        }
예제 #5
0
 public void Buy(DateTime time, ulong id, string fdname, string namelocalised, long price, int cls, string[] weaponmods)
 {
     Weapons[id] = new SuitWeapon(time, id, fdname, namelocalised, price, cls, weaponmods, false);
 }