本文整理汇总了C#中Tibialyzer.Hunt类的典型用法代码示例。如果您正苦于以下问题:C# Hunt类的具体用法?C# Hunt怎么用?C# Hunt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hunt类属于Tibialyzer命名空间,在下文中一共展示了Hunt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: refreshHuntLog
public void refreshHuntLog(Hunt h)
{
if (h == null) return;
const int maxLogLines = 250;
int count = 0;
logMessageCollection.Items.Clear();
foreach (string message in h.IterateLogMessages()) {
logMessageCollection.Items.Add(message);
if (count++ > maxLogLines) break;
}
}
示例2: refreshHuntLog
public void refreshHuntLog(Hunt h)
{
if (h == null) return;
const int maxLogLines = 250;
List<string> timestamps = h.loot.logMessages.Keys.OrderByDescending(o => o).ToList();
int count = 0;
logMessageCollection.Items.Clear();
foreach (string t in timestamps) {
List<string> strings = h.loot.logMessages[t].ToList();
strings.Reverse();
foreach (string str in strings) {
logMessageCollection.Items.Add(str);
if (count++ > maxLogLines) break;
}
if (count > maxLogLines) break;
}
}
示例3: 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);
}
示例4: DeleteMessagesBefore
public static void DeleteMessagesBefore(Hunt h, int stamp, int hour, int minute)
{
ExecuteNonQuery(String.Format("DELETE FROM \"{0}\" WHERE day < {1} OR hour < {2} OR (hour == {2} AND minute < {3})", h.GetTableName(), stamp, hour, minute));
}
示例5: DeleteHuntTable
public static void DeleteHuntTable(Hunt hunt)
{
ExecuteNonQuery(String.Format("DROP TABLE IF EXISTS \"{0}\";", hunt.GetTableName()));
ExecuteNonQuery(String.Format("DROP TABLE IF EXISTS \"{0}\";", hunt.GetWasteTableName()));
}
示例6: UpdateUsedItems
public static void UpdateUsedItems(Hunt h)
{
var usedItems = h.GetUsedItems();
lock(lootLock) {
foreach (var item in usedItems) {
int itemid = item.Item1.id;
int amount = item.Item2;
int value = 0;
object result = ExecuteScalar(String.Format("SELECT itemid FROM {0} WHERE itemid={1}", h.GetWasteTableName(), itemid));
if (result != null && int.TryParse(result.ToString(), out value)) {
ExecuteNonQuery(String.Format("UPDATE {0} SET amount={1} WHERE itemid={2}", h.GetWasteTableName(), amount, itemid));
} else {
ExecuteNonQuery(String.Format("INSERT INTO {0} (itemid, amount) VALUES ({1}, {2})", h.GetWasteTableName(), itemid, amount));
}
}
}
}
示例7: HuntTableExists
public static bool HuntTableExists(Hunt h)
{
int value = 0;
object result = ExecuteScalar(String.Format("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='{0}';", h.GetTableName()));
if (result != null && int.TryParse(result.ToString(), out value)) {
return value != 0;
}
return false;
}
示例8: saveLog
void saveLog(Hunt h, string logPath)
{
StreamWriter streamWriter = new StreamWriter(logPath);
// we load the data from the database instead of from the stored dictionary so it is ordered properly
SQLiteCommand comm = new SQLiteCommand(String.Format("SELECT message FROM \"{0}\"", h.GetTableName()), lootConn);
SQLiteDataReader reader = comm.ExecuteReader();
while (reader.Read()) {
streamWriter.WriteLine(reader["message"].ToString());
}
streamWriter.Flush();
streamWriter.Close();
}
示例9: DeleteMessage
public static void DeleteMessage(Hunt hunt, string msg, SQLiteTransaction transaction)
{
SQLiteCommand command = new SQLiteCommand(String.Format("DELETE FROM \"{0}\" WHERE message=\"{1}\"", hunt.GetTableName(), msg.Replace("\"", "\\\"")), lootConn, transaction);
command.ExecuteNonQuery();
}
示例10: DeleteHuntTable
public static void DeleteHuntTable(Hunt hunt)
{
SQLiteCommand comm = new SQLiteCommand(String.Format("DROP TABLE IF EXISTS \"{0}\";", hunt.GetTableName()), lootConn);
comm.ExecuteNonQuery();
}
示例11: CreateHuntTable
public static void CreateHuntTable(Hunt hunt)
{
SQLiteCommand command = new SQLiteCommand(String.Format("CREATE TABLE IF NOT EXISTS \"{0}\"(day INTEGER, hour INTEGER, minute INTEGER, message STRING);", hunt.GetTableName()), lootConn);
command.ExecuteNonQuery();
}
示例12: ShowWasteForm
public static void ShowWasteForm(Hunt hunt, string command)
{
if (hunt == null) return;
WasteForm f = new WasteForm();
f.hunt = hunt;
ShowNotification(f, command);
}
示例13: ShowLootDrops
public static void ShowLootDrops(Hunt h, string comm, string screenshot_path)
{
LootDropForm ldf = new LootDropForm(comm);
ldf.hunt = h;
ShowNotification(ldf, comm, screenshot_path);
}
示例14: SwitchHunt
public static void SwitchHunt(string parameter)
{
lock (hunts) {
foreach (Hunt h in hunts) {
if (h.name.Contains(parameter, StringComparison.OrdinalIgnoreCase)) {
activeHunt = h;
break;
}
}
}
}
示例15: SetHuntTime
public static void SetHuntTime(Hunt h, int clearMinutes)
{
var expInformation = GlobalDataManager.GetTotalExperience(TimestampManager.getLatestTimes(clearMinutes));
h.totalExp = expInformation.Item1;
h.totalTime = expInformation.Item2 * 60;
}