Tibialyzer.Hunt.DeleteCreature C# (CSharp) Method

DeleteCreature() public method

public DeleteCreature ( Tibialyzer.Creature cr ) : void
cr Tibialyzer.Creature
return void
        public void DeleteCreature(Creature cr)
        {
            lock (huntLock) {
                if (this.loot.killCount.ContainsKey(cr)) {
                    this.loot.killCount.Remove(cr);
                }
                if (this.loot.creatureLoot.ContainsKey(cr)) {
                    this.loot.creatureLoot.Remove(cr);
                }
                using (var transaction = LootDatabaseManager.BeginTransaction()) {
                    foreach (KeyValuePair<string, List<string>> kvp in this.loot.logMessages) {
                        foreach (string msg in kvp.Value) {
                            if (Parser.ParseCreatureFromLootMessage(msg) == cr) {
                                LootDatabaseManager.DeleteMessage(this, msg, transaction);
                            }
                        }
                    }
                    transaction.Commit();
                }
            }
        }

Usage Example

Example #1
0
 public static void deleteCreatureFromLog(Creature cr)
 {
     activeHunt.DeleteCreature(cr);
     LootDatabaseManager.UpdateLoot();
 }