本文整理汇总了C#中Tibialyzer.Hunt.GetTrackedCreatures方法的典型用法代码示例。如果您正苦于以下问题:C# Hunt.GetTrackedCreatures方法的具体用法?C# Hunt.GetTrackedCreatures怎么用?C# Hunt.GetTrackedCreatures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tibialyzer.Hunt
的用法示例。
在下文中一共展示了Hunt.GetTrackedCreatures方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateLootInformation
public static Tuple<Dictionary<Creature, int>, List<Tuple<Item, int>>> GenerateLootInformation(Hunt hunt, string rawName, Creature lootCreature)
{
Dictionary<Creature, int> creatureKills;
List<Tuple<Item, int>> itemDrops = new List<Tuple<Item, int>>();
bool raw = rawName == "raw";
bool all = raw || rawName == "all";
List<Creature> displayedCreatures = null;
if (!hunt.trackAllCreatures && hunt.trackedCreatures.Length > 0) {
displayedCreatures = hunt.GetTrackedCreatures();
} else if (SettingsManager.getSettingBool("IgnoreLowExperience")) {
displayedCreatures = new List<Creature>();
foreach (Creature cr in hunt.IterateCreatures()) {
if (cr.experience >= SettingsManager.getSettingInt("IgnoreLowExperienceValue")) {
displayedCreatures.Add(cr);
}
}
}
if (lootCreature != null) {
//the command is [email protected]<creature>, so we only display the kills and loot from the specified creature
creatureKills = hunt.GetCreatureKills(lootCreature);
} else if (displayedCreatures == null) {
creatureKills = hunt.GetCreatureKills(); //display all creatures //loot.killCount;
} else {
// only display tracked creatures
creatureKills = hunt.GetCreatureKills(displayedCreatures); // new Dictionary<Creature, int>();
}
// now handle item drops, gather a count for every item
Dictionary<Item, int> itemCounts = new Dictionary<Item, int>();
foreach (KeyValuePair<Creature, Dictionary<Item, int>> kvp in hunt.IterateLoot()) {
if (lootCreature != null && kvp.Key != lootCreature) continue; // if lootCreature is specified, only consider loot from the specified creature
if (displayedCreatures != null && !displayedCreatures.Contains(kvp.Key)) continue;
foreach (KeyValuePair<Item, int> kvp2 in kvp.Value) {
Item item = kvp2.Key;
int value = kvp2.Value;
if (!itemCounts.ContainsKey(item)) itemCounts.Add(item, value);
else itemCounts[item] += value;
}
}
// now we do item conversion
long extraGold = 0;
foreach (KeyValuePair<Item, int> kvp in itemCounts) {
Item item = kvp.Key;
int count = kvp.Value;
// discard items that are set to be discarded (as long as all/raw mode is not enabled)
if (item.discard && !all) continue;
// convert items to gold (as long as raw mode is not enabled), always gather up all the gold coins found
if ((!raw && item.convert_to_gold) || item.displayname == "gold coin" || item.displayname == "platinum coin" || item.displayname == "crystal coin") {
extraGold += item.GetMaxValue() * count;
} else {
itemDrops.Add(new Tuple<Item, int>(item, count));
}
}
// handle coin drops, we always convert the gold to the highest possible denomination (so if gold = 10K, we display a crystal coin)
long currentGold = extraGold;
if (currentGold > 10000) {
itemDrops.Add(new Tuple<Item, int>(StorageManager.getItem("crystal coin"), (int)(currentGold / 10000)));
currentGold = currentGold % 10000;
}
if (currentGold > 100) {
itemDrops.Add(new Tuple<Item, int>(StorageManager.getItem("platinum coin"), (int)(currentGold / 100)));
currentGold = currentGold % 100;
}
if (currentGold > 0) {
itemDrops.Add(new Tuple<Item, int>(StorageManager.getItem("gold coin"), (int)(currentGold)));
}
// now order by value so most valuable items are placed first
// we use a special value for the gold coins so the gold is placed together in the order crystal > platinum > gold
// gold coins = <gold total> - 2, platinum coins = <gold total> - 1, crystal coins = <gold total>
itemDrops = itemDrops.OrderByDescending(o => o.Item1.displayname == "gold coin" ? extraGold - 2 : (o.Item1.displayname == "platinum coin" ? extraGold - 1 : (o.Item1.displayname == "crystal coin" ? extraGold : o.Item1.GetMaxValue() * o.Item2))).ToList();
return new Tuple<Dictionary<Creature, int>, List<Tuple<Item, int>>>(creatureKills, itemDrops);
}