示例#1
0
        public bool VerifyPresence(DateTime time, ulong id, string name, ulong suitid, SuitLoadout.LoadoutModule[] modules)// modules may be null
        {
            var s = loadouts.GetLast(id);

            if (s == null)
            {
                System.Diagnostics.Debug.WriteLine("Missing Loadout {0} {1} {2}", id, name, suitid);
                s = new SuitLoadout(time, id, name, suitid, false);
                foreach (var m in modules.EmptyIfNull())
                {
                    s.Modules[m.SlotName] = m;
                }
                loadouts[id] = s;
                return(false);
            }
            else
            {
                if (modules != null && (modules.Length != s.Modules.Count || !s.CompareModules(modules)))
                {
                    //System.Diagnostics.Debug.WriteLine("Update Loadout {0} {1} {2}", id, name, suitid);
                    s = new SuitLoadout(time, id, name, suitid, false);
                    foreach (var m in modules.EmptyIfNull())
                    {
                        s.Modules[m.SlotName] = m;
                    }
                    loadouts[id] = s;
                    return(false);
                }
            }

            return(true);
        }
        public void CreateLoadout(DateTime time, ulong id, string name, ulong suitid, SuitLoadout.LoadoutModule[] modules)
        {
            var s = new SuitLoadout(time, id, name, suitid, false);

            foreach (var m in modules.EmptyIfNull())
            {
                s.Modules[m.ModuleName] = m;
            }
            loadouts.Add(id, s);
        }
示例#3
0
        public void CreateLoadout(DateTime time, ulong id, string name, ulong suitid, SuitLoadout.LoadoutModule[] modules) // modules may be null
        {
            var s = new SuitLoadout(time, id, name, suitid, false);

            foreach (var m in modules.EmptyIfNull())
            {
                s.Modules[m.SlotName] = m;
            }
            loadouts[id] = s;
        }
 public void Rename(ulong id, string newname)
 {
     if (loadouts.ContainsKey(id))
     {
         var last = loadouts.GetLast(id);
         var ld   = new SuitLoadout(last);
         ld.Name = newname;
         loadouts.Add(id, ld);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Suits remove an unknown loadout " + id);
     }
 }
 public void Equip(ulong id, string slotname, SuitLoadout.LoadoutModule weap)
 {
     if (loadouts.ContainsKey(id))
     {
         var last = loadouts.GetLast(id);
         var ld   = new SuitLoadout(last);
         ld.Modules[slotname] = weap;
         loadouts.Add(id, ld);
         System.Diagnostics.Debug.WriteLine("Suits Equip {0}-{1}-{2} with {3}", last.ID, last.Name, slotname, weap.ModuleName_Localised);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Suits equip an unknown loadout " + id);
     }
 }
示例#6
0
 public void DeleteLoadout(DateTime time, ulong id)
 {
     if (loadouts.ContainsKey(id))
     {
         var last = loadouts.GetLast(id);
         if (last.Deleted == false)                                                  // if not deleted
         {
             loadouts[id] = new SuitLoadout(time, id, last.Name, last.SuitID, true); // new entry with this time but sold
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Suits deleted a loadout already deleted " + id);
         }
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Suits deleted an unknown loadout " + id);
     }
 }
 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);
     }
 }
 public SuitLoadout(SuitLoadout other)
 {
     EventTime = other.EventTime; ID = other.ID; Name = other.Name; SuitID = other.SuitID; Deleted = other.Deleted;
     Modules   = new Dictionary <string, LoadoutModule>(other.Modules); // shallow clone
 }
示例#9
0
 public void SwitchTo(DateTime utc, ulong id)
 {
     loadouts[CURLOADOUTID] = new SuitLoadout(utc, id, null, 0, false);
 }