public LoadOut(string name) { path = Path.Combine(Util.GetLoadoutFolder(), name + ".ini"); bool nu = false; if (!File.Exists(path)) { File.AppendAllText(path, ""); nu = true; } var ini = new IniParser(path); Name = ini.Name; if (!nu) { itemCount = Int32.Parse(ini.GetSetting("Def", "itemCount")); OwnerUse = ini.GetBoolSetting("Def", "ownerCanUse"); ModeratorUse = ini.GetBoolSetting("Def", "modCanUse"); NormalUse = ini.GetBoolSetting("Def", "normalCanUse"); } else { itemCount = 0; OwnerUse = true; NormalUse = true; ModeratorUse = true; } items = new Dictionary <int, LoadOutItem>(30); if (itemCount != 0) { LoadOutItem current; for (var i = 0; i < itemCount; i++) { string namee = ini.GetSetting(i.ToString(), "Name"); int amount; if (!Int32.TryParse(ini.GetSetting(i.ToString(), "Amount"), out amount)) { amount = Int32.MaxValue; } current = new LoadOutItem(namee, amount); items.Add(i, current); } } ini = null; if (Server.GetInstance().LoadOuts.ContainsKey(Name)) { Server.GetInstance().LoadOuts.Remove(Name); } Server.GetInstance().LoadOuts.Add(Name, this); }
public bool Add(LoadOutItem item) { if (itemCount >= 30) { Logger.LogDebug("[LoadOut] You may not add more then 30 items to one loadout."); return false; } items.Add(itemCount, item); itemCount++; if (Server.GetInstance().LoadOuts.ContainsKey(Name)) Server.GetInstance().LoadOuts.Remove(Name); Server.GetInstance().LoadOuts.Add(Name, this); return true; }
public bool Add(LoadOutItem item) { if (itemCount >= 30) { Logger.LogDebug("[LoadOut] You may not add more then 30 items to one loadout."); return(false); } items.Add(itemCount, item); itemCount++; if (Server.GetInstance().LoadOuts.ContainsKey(Name)) { Server.GetInstance().LoadOuts.Remove(Name); } Server.GetInstance().LoadOuts.Add(Name, this); return(true); }
public LoadOut(string name) { path = Path.Combine(Util.GetLoadoutFolder(), name + ".ini"); bool nu = false; if (!File.Exists(path)) { File.AppendAllText(path, ""); nu = true; } var ini = new IniParser(path); Name = ini.Name; if (!nu) { itemCount = Int32.Parse(ini.GetSetting("Def", "itemCount")); OwnerUse = ini.GetBoolSetting("Def", "ownerCanUse"); ModeratorUse = ini.GetBoolSetting("Def", "modCanUse"); NormalUse = ini.GetBoolSetting("Def", "normalCanUse"); } else { itemCount = 0; OwnerUse = true; NormalUse = true; ModeratorUse = true; } items = new Dictionary<int, LoadOutItem>(30); if (itemCount != 0) { LoadOutItem current; for (var i = 0; i < itemCount; i++) { string namee = ini.GetSetting(i.ToString(), "Name"); int amount; if (!Int32.TryParse(ini.GetSetting(i.ToString(), "Amount"), out amount)) amount = Int32.MaxValue; current = new LoadOutItem(namee, amount); items.Add(i, current); } } ini = null; if (Server.GetInstance().LoadOuts.ContainsKey(Name)) Server.GetInstance().LoadOuts.Remove(Name); Server.GetInstance().LoadOuts.Add(Name, this); }
public void Notice(LoadOutItem loItem) { string msg = String.Format("{0} {1}", InvItem.GetItemID(loItem.Name), loItem.Amount); Notice(msg); }
public void Notice(LoadOutItem loItem) { string msg = String.Format("{0} {1}", InvItem.GetItemID(loItem.Name), loItem.Amount); Notice(msg); }