public static void DbItemsStack <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db) { try { IntLineStream lines = new IntLineStream(debug.OldPath); lines.Remove(db); string line; TkDictionary <TKey, string[]> phantom = _getPhantomTable(debug); if (phantom != null) { var itemDb = debug.AbsractDb.GetDb <TKey>(ServerDbs.Items).Table; // Check if the phantom values differ from the Items1 foreach (var tuple in phantom) { if (debug.AbsractDb.Table.ContainsKey(tuple.Key)) { continue; } var key = tuple.Key; var elements = tuple.Value; var tuple1 = itemDb.TryGetTuple(key); if (tuple1 != null) { string val1 = tuple1.GetValue <string>(ServerItemAttributes.Stack); string val2 = elements[1]; if (val1 != val2) { lines.Delete(tuple1.GetKey <int>()); } } } } foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); string item1 = tuple.GetValue <string>(ServerItemAttributes.Stack); if (item1 == "") { lines.Delete(key); continue; } line = String.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture), item1 }.ToArray()); lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbItemsBuyingStore <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db) { try { IntLineStream lines = new IntLineStream(debug.OldPath); lines.Remove(db); string line; TkDictionary <TKey, string[]> phantom = _getPhantomTable(debug); if (phantom != null) { var itemDb = debug.AbsractDb.GetDb <TKey>(ServerDbs.Items).Table; // Check if the phantom values differ from the Items1 foreach (var tuple in phantom) { if (debug.AbsractDb.Table.ContainsKey(tuple.Key)) { continue; } var key = tuple.Key; var tuple1 = itemDb.TryGetTuple(key); if (tuple1 != null) { bool val1 = tuple1.GetValue <bool>(ServerItemAttributes.BuyingStore); if (val1 != true) { lines.Delete(tuple1.GetKey <int>()); } } } } foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); bool item1 = tuple.GetValue <bool>(ServerItemAttributes.BuyingStore); if (!item1) { lines.Delete(key); continue; } line = key.ToString(CultureInfo.InvariantCulture) + " // " + tuple.GetValue <string>(ServerItemAttributes.AegisName); lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbSkillsCastCommaRange <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db, int from, int length) { try { IntLineStream lines = new IntLineStream(debug.OldPath); lines.Remove(db); string line; foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); List <string> items = tuple.GetRawElements().Skip(from).Take(length).Select(p => p.ToString()).ToList(); if (items.All(p => p == "0")) { lines.Delete(key); continue; } line = string.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture) }.Concat(items).ToArray()); lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbItemsBuyingStore <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db) { try { IntLineStream lines = new IntLineStream(db.UsePreviousOutput ? debug.FilePath : debug.OldPath); lines.Remove(db); string line; foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); bool item1 = tuple.GetValue <bool>(ServerItemAttributes.BuyingStore); if (!item1) { lines.Delete(key); continue; } line = key.ToString(CultureInfo.InvariantCulture) + " // " + tuple.GetValue <string>(ServerItemAttributes.AegisName); lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbItemsStack <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db) { try { IntLineStream lines = new IntLineStream(db.UsePreviousOutput ? debug.FilePath : debug.OldPath); lines.Remove(db); string line; foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); string item1 = tuple.GetValue <string>(ServerItemAttributes.Stack); if (item1 == "") { lines.Delete(key); continue; } line = string.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture), item1 }.ToArray()); lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbItemsNouse <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db) { try { IntLineStream lines = new IntLineStream(db.UsePreviousOutput ? debug.FilePath : debug.OldPath); lines.Remove(db); string line; NoUse nouse = new NoUse(); foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); string item1 = tuple.GetValue <string>(ServerItemAttributes.NoUse); nouse.Override = ParserHelper.GetVal(item1, "override", "100"); nouse.Sitting = ParserHelper.GetVal(item1, "sitting", "false"); if (nouse.Override == "100" && nouse.Sitting == "false") { lines.Delete(key); continue; } line = string.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture), nouse.Sitting == "true" ? "1" : "0", nouse.Override }.ToArray()); lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbSkillsNoCastCommaRange <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db, int from, int length) { try { IntLineStream lines = new IntLineStream(debug.OldPath); lines.Remove(db); string line; foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); string item1 = tuple.GetValue <string>(from); string item2 = tuple.GetValue <string>(from + 1); if (item1 != "0" && item2 == "0") { line = string.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture), item1 }); } else if (item1 == "0" && item2 == "0") { lines.Delete(key); continue; } else { line = string.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture), item1, item2 }); } lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbItemsCommaRange <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db, int from, int length, string defaultValue, Func <ReadableTuple <TKey>, List <string>, string, string> append) { try { IntLineStream lines = new IntLineStream(debug.OldPath); lines.Remove(db); string line; TkDictionary <TKey, string[]> phantom = _getPhantomTable(debug); if (phantom != null) { var itemDb = debug.AbsractDb.GetDb <TKey>(ServerDbs.Items).Table; // Check if the phantom values differ from the Items1 foreach (var tuple in phantom) { if (debug.AbsractDb.Table.ContainsKey(tuple.Key)) { continue; } var key = tuple.Key; var elements = tuple.Value; var tuple1 = itemDb.TryGetTuple(key); if (tuple1 != null) { string val1 = tuple1.GetValue <string>(@from); string val2 = elements[1]; if (val1 != val2) { lines.Delete(tuple1.GetKey <int>()); } } } } foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); List <string> items = tuple.GetRawElements().Skip(@from).Take(length).Select(p => p.ToString()).ToList(); if (items.All(p => p == defaultValue)) { lines.Delete(key); continue; } if (append != null) { line = append(tuple, items, String.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture) }.Concat(items).ToArray())); } else { line = String.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture) }.Concat(items).ToArray()); } lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }
public static void DbItemsTrade <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db) { try { IntLineStream lines = new IntLineStream(debug.OldPath); lines.Remove(db); string line; TkDictionary <TKey, string[]> phantom = _getPhantomTable(debug); if (phantom != null) { var itemDb = debug.AbsractDb.GetDb <TKey>(ServerDbs.Items).Table; // Check if the phantom values differ from the Items1 foreach (var tuple in phantom) { if (debug.AbsractDb.Table.ContainsKey(tuple.Key)) { continue; } var key = tuple.Key; var elements = tuple.Value; var tuple1 = itemDb.TryGetTuple(key); if (tuple1 != null) { int val1 = tuple1.GetIntNoThrow(ServerItemAttributes.TradeFlag); int val2 = FormatConverters.IntOrHexConverter(elements[1]); int val3 = tuple1.GetIntNoThrow(ServerItemAttributes.TradeOverride); int val4 = FormatConverters.IntOrHexConverter(elements[2]); // There is no flag set if (val1 != val2 || val3 != val4) { lines.Delete(tuple1.GetKey <int>()); } } } } foreach (ReadableTuple <TKey> tuple in db.Table.FastItems.Where(p => !p.Normal).OrderBy(p => p.GetKey <TKey>())) { int key = tuple.GetKey <int>(); string overrideValue = tuple.GetValue <string>(ServerItemAttributes.TradeOverride); string flagValue = tuple.GetValue <string>(ServerItemAttributes.TradeFlag); if (flagValue == "0") { if (overrideValue == "100" || SdeAppConfiguration.DbTradeIgnoreOverride) { lines.Delete(key); continue; } } line = String.Join(",", new string[] { key.ToString(CultureInfo.InvariantCulture), flagValue, overrideValue }.ToArray()); if (SdeAppConfiguration.AddCommentForItemTrade) { line += "\t// " + tuple.GetValue <string>(ServerItemAttributes.AegisName); } lines.Write(key, line); } lines.WriteFile(debug.FilePath); } catch (Exception err) { debug.ReportException(err); } }