当前位置: 首页>>代码示例>>C#>>正文


C# Hunt.AddUsedItems方法代码示例

本文整理汇总了C#中Tibialyzer.Hunt.AddUsedItems方法的典型用法代码示例。如果您正苦于以下问题:C# Hunt.AddUsedItems方法的具体用法?C# Hunt.AddUsedItems怎么用?C# Hunt.AddUsedItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tibialyzer.Hunt的用法示例。


在下文中一共展示了Hunt.AddUsedItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddUsedItems

 public static void AddUsedItems(Hunt hunt, Dictionary<string, Dictionary<string, HashSet<int>>> usedItems)
 {
     bool newValues = hunt.AddUsedItems(usedItems);
     if (newValues) {
         GlobalDataManager.UpdateUsedItems();
     }
 }
开发者ID:Cizall,项目名称:Tibialyzer,代码行数:7,代码来源:HuntManager.cs

示例2: Initialize

        public static void Initialize()
        {
            lock (hunts) {
                //"Name#DBTableID#Track#Time#Exp#SideHunt#AggregateHunt#ClearOnStartup#Creature#Creature#..."
                if (!SettingsManager.settingExists("Hunts")) {
                    SettingsManager.setSetting("Hunts", new List<string>() { "New Hunt#True#0#0#False#True" });
                }
                hunts.Clear();
                int activeHuntIndex = 0, index = 0;
                List<int> dbTableIds = new List<int>();
                foreach (string str in SettingsManager.getSetting("Hunts")) {
                    SQLiteDataReader reader;
                    Hunt hunt = new Hunt();
                    string[] splits = str.Split('#');
                    if (splits.Length >= 7) {
                        hunt.name = splits[0];
                        if (!int.TryParse(splits[1].Trim(), out hunt.dbtableid)) continue;
                        if (dbTableIds.Contains(hunt.dbtableid)) continue;
                        dbTableIds.Add(hunt.dbtableid);

                        hunt.totalTime = 0;
                        hunt.trackAllCreatures = splits[2] == "True";
                        double.TryParse(splits[3], NumberStyles.Any, CultureInfo.InvariantCulture, out hunt.totalTime);
                        long.TryParse(splits[4], out hunt.totalExp);
                        hunt.sideHunt = splits[5] == "True";
                        hunt.aggregateHunt = splits[6] == "True";
                        hunt.clearOnStartup = splits[7] == "True";
                        hunt.temporary = false;
                        string massiveString = "";
                        for (int i = 8; i < splits.Length; i++) {
                            if (splits[i].Length > 0) {
                                massiveString += splits[i] + "\n";
                            }
                        }
                        hunt.trackedCreatures = massiveString;
                        // set this hunt to the active hunt if it is the active hunt
                        if (SettingsManager.settingExists("ActiveHunt") && SettingsManager.getSettingString("ActiveHunt") == hunt.name)
                            activeHuntIndex = index;

                        refreshLootCreatures(hunt);

                        if (hunt.clearOnStartup) {
                            resetHunt(hunt);
                        }

                        // create the hunt table if it does not exist
                        LootDatabaseManager.CreateHuntTable(hunt);
                        // load the data for the hunt from the database
                        reader = LootDatabaseManager.GetHuntMessages(hunt);
                        while (reader.Read()) {
                            string message = reader["message"].ToString();
                            Tuple<Creature, List<Tuple<Item, int>>> resultList = Parser.ParseLootMessage(message);
                            if (resultList == null) continue;

                            string t = message.Substring(0, 5);

                            hunt.AddKillToHunt(resultList, t, message);
                        }
                        reader = LootDatabaseManager.GetUsedItems(hunt);
                        List<Tuple<Item, int>> usedItems = new List<Tuple<Item, int>>();
                        while (reader.Read()) {
                            int itemid = reader.GetInt32(0);
                            int amount = reader.GetInt32(1);
                            usedItems.Add(new Tuple<Item, int>(StorageManager.getItem(itemid), amount));
                        }
                        hunt.AddUsedItems(usedItems);
                        hunts.Add(hunt);
                        index++;
                    }
                }
                if (hunts.Count == 0) {
                    Hunt h = new Hunt();
                    h.name = "New Hunt";
                    h.dbtableid = 1;
                    hunts.Add(h);
                    resetHunt(h);
                }
                activeHunt = hunts[activeHuntIndex];
                MainForm.mainForm.InitializeHuntDisplay(activeHuntIndex);
            }
        }
开发者ID:Cizall,项目名称:Tibialyzer,代码行数:81,代码来源:HuntManager.cs


注:本文中的Tibialyzer.Hunt.AddUsedItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。