public static DeleteMessage ( |
||
hunt | ||
msg | string | |
transaction | System.Data.SQLite.SQLiteTransaction | |
Résultat | void |
public static void deleteCreatureFromLog(Creature cr) { lock (hunts) { if (activeHunt.loot.killCount.ContainsKey(cr)) { activeHunt.loot.killCount.Remove(cr); } if (activeHunt.loot.creatureLoot.ContainsKey(cr)) { activeHunt.loot.creatureLoot.Remove(cr); } using (var transaction = LootDatabaseManager.BeginTransaction()) { foreach (KeyValuePair <string, List <string> > kvp in activeHunt.loot.logMessages) { foreach (string msg in kvp.Value) { if (Parser.ParseCreatureFromLootMessage(msg) == cr) { LootDatabaseManager.DeleteMessage(activeHunt, msg, transaction); } } } transaction.Commit(); } } LootDatabaseManager.UpdateLoot(); }
public static void deleteLogMessage(Hunt h, string logMessage) { bool found = h.DeleteLogMessage(logMessage); if (!found) { return; } LootDatabaseManager.DeleteMessage(h, logMessage, null); LootDatabaseManager.UpdateLoot(); }
public static void deleteLogMessage(Hunt h, string logMessage) { string timeStamp = logMessage.Substring(0, 5); bool found = false; lock (hunts) { if (h.loot.logMessages.ContainsKey(timeStamp)) { if (h.loot.logMessages[timeStamp].Contains(logMessage)) { h.loot.logMessages[timeStamp].Remove(logMessage); var logMessageItems = Parser.ParseLootMessage(logMessage); Creature cr = logMessageItems.Item1; if (h.loot.killCount.ContainsKey(cr)) { h.loot.killCount[cr]--; if (h.loot.killCount[cr] == 0) { h.loot.killCount.Remove(cr); } } foreach (Tuple <Item, int> tpl in logMessageItems.Item2) { if (h.loot.creatureLoot[cr].ContainsKey(tpl.Item1)) { h.loot.creatureLoot[cr][tpl.Item1] -= tpl.Item2; if (h.loot.creatureLoot[cr][tpl.Item1] <= 0) { h.loot.creatureLoot[cr].Remove(tpl.Item1); } } } found = true; } } } if (!found) { return; } LootDatabaseManager.DeleteMessage(h, logMessage, null); LootDatabaseManager.UpdateLoot(); }