示例#1
0
 public AltoholicImporter(SavedVariablesDictionary SVCharacters,
                          SavedVariablesDictionary SVSkills,
                          SavedVariablesDictionary SVTalents,
                          SavedVariablesDictionary SVInventory,
                          SavedVariablesDictionary SVStats)
 {
     SavedVariables = new AltoholicSavedVariables(SVCharacters,
                                                  SVSkills,
                                                  SVTalents,
                                                  SVInventory,
                                                  SVStats);
 }
示例#2
0
 public  AltoholicSavedVariables(SavedVariablesDictionary SVCharacters,
                                 SavedVariablesDictionary SVSkills,
                                 SavedVariablesDictionary SVTalents,
                                 SavedVariablesDictionary SVInventory,
                                 SavedVariablesDictionary SVStats)
 {
     
     Characters = SVCharacters;
     Skills = SVSkills;
     Talents = SVTalents;
     Inventory = SVInventory;
     Stats = SVStats;
 }
示例#3
0
        static int getTalentPointsFromTree(SavedVariablesDictionary talent_tree, string spec, TalentDataAttribute talent)
        {
            int points = 0;

            if (talent_tree.ContainsKey(spec))
            {
                SavedVariablesDictionary spec_tree = talent_tree[spec] as SavedVariablesDictionary;

                if (spec_tree.ContainsKey(talent.Name))
                {
                    SavedVariablesDictionary talent_info = spec_tree[talent.Name] as SavedVariablesDictionary;

                    string rank_info = talent_info["Rank"] as string;

                    int split_pos = rank_info.IndexOf(':');
                    string points_str = rank_info.Remove(split_pos);

                    points = (int)Int32.Parse(points_str);
                }
                else
                {
                    Debug.WriteLine("Talent Not Found: " + talent);
                }
            }
            else
            {
                // we're most likely dealing with non-English data, try to determine by position in tree
                foreach (SavedVariablesDictionary tree in talent_tree.Values)
                {
                    if ((long)tree["Order"] == talent.Tree + 1)
                    {
                        string loc = talent.Row + ":" + talent.Column;
                        foreach (object t in tree.Values)
                        {
                            SavedVariablesDictionary td = t as SavedVariablesDictionary;
                            if (td != null)
                            {
                                if ((string)td["Location"] == loc)
                                {
                                    string rank_info = td["Rank"] as string;

                                    int split_pos = rank_info.IndexOf(':');
                                    string points_str = rank_info.Remove(split_pos);

                                    points = (int)Int32.Parse(points_str);
                                    return points;
                                }
                            }
                        }
                    }
                }
                Debug.WriteLine("Talent Tree Not Found: " + spec);
            }

            return points;
        }
示例#4
0
        void setTalentsFromTree(SavedVariablesDictionary characterInfo)
        {
            if (!characterInfo.ContainsKey("Talents"))
            {
                return;
            }

            SavedVariablesDictionary talent_tree = characterInfo["Talents"] as SavedVariablesDictionary;

            TalentsBase Talents = Character.CurrentTalents;

            if (Talents != null)
            {
                List<string> treeNames = new List<string>((string[])Talents.GetType().GetField("TreeNames").GetValue(Talents));

                //TalentTree currentTree;
                foreach (PropertyInfo pi in Talents.GetType().GetProperties())
                {
                    TalentDataAttribute[] talentDatas = pi.GetCustomAttributes(typeof(TalentDataAttribute), true) as TalentDataAttribute[];
                    if (talentDatas.Length > 0)
                    {
                        TalentDataAttribute talentData = talentDatas[0];

                        int points = getTalentPointsFromTree(talent_tree, treeNames[talentData.Tree], talentData);
                        Character.CurrentTalents.Data[talentData.Index] = points;
                    }
                }
            }
        }
示例#5
0
        static bool addEquippedItemForOptimization(List<string> asOptimizableItems,
            SavedVariablesDictionary characterInfo, string sSlot)
        {
            string sItem = getGearStringBySlot(characterInfo, sSlot, true);

            if (sItem != null)
            {
                char[] acSplitCharacters = { '.' };
                string[] asItemElements = sItem.Split(acSplitCharacters);
                if (sItem.Substring(asItemElements[0].Length) == ".*.*.*.*")
                {
                    sItem = asItemElements[0];
                }
                asOptimizableItems.Add(sItem);
                return true;
            }

            return false;
        }
示例#6
0
        static void addPossessionsForOptimization(List<string> asOptimizableItems,
            SavedVariablesDictionary characterInfo)
        {
            string[] asSources = { "Inventory", "Bank" };

            foreach (string sSource in asSources)
            {
                if (characterInfo.ContainsKey(sSource))
                {
                    SavedVariablesDictionary bags = characterInfo[sSource] as SavedVariablesDictionary;

                    foreach (object oBag in bags.Values)
                    {
                        SavedVariablesDictionary bag = oBag as SavedVariablesDictionary;
                        SavedVariablesDictionary contents = bag["Contents"] as SavedVariablesDictionary;

                        foreach (object oItem in contents.Values)
                        {
                            SavedVariablesDictionary item = oItem as SavedVariablesDictionary;

                            if (isEquippable(item))
                            {
                                string enchant = getEnchant(item).ToString();
                                if (enchant == "0")
                                {
                                    enchant = "*";
                                }
                                string item2 = getGearString(item, true) + "." + enchant;
                                char[] acSplitCharacters = { '.' };
                                string[] asItemElements = item2.Split(acSplitCharacters);
                                if (item2.Substring(asItemElements[0].Length) == ".*.*.*.*")
                                {
                                    item2 = asItemElements[0];
                                }
                                asOptimizableItems.Add(item2);
                            }
                        }
                    }
                }
            }
        }
示例#7
0
        static string getGearString(SavedVariablesDictionary item, bool replaceAsterisks)
        {
            string sItemString = item["Item"] as string;
            char[] acSplitCharacters = { ':' };
            string[] asItemElements = sItemString.Split(acSplitCharacters);

            if (item.ContainsKey("Gem"))
            {
                SavedVariablesDictionary gems = item["Gem"] as SavedVariablesDictionary;

                string sItemSlotString = "";
                for (long lGemSlot = 1; lGemSlot <= 3; lGemSlot++)
                {
                    sItemSlotString += ".";

                    if (gems.ContainsKey(lGemSlot))
                    {
                        string sGemItemString = (gems[lGemSlot] as SavedVariablesDictionary)["Item"] as string;
                        sItemSlotString += sGemItemString.Split(acSplitCharacters)[0];
                    }
                    else
                    {
                        sItemSlotString += "0";
                    }
                }

                if (replaceAsterisks && sItemSlotString == ".0.0.0")
                {
                    return asItemElements[0] + ".*.*.*";
                }
                else
                {
                    return asItemElements[0] + sItemSlotString;
                }
            }
            else
            {
                if (replaceAsterisks)
                {
                    return asItemElements[0] + ".*.*.*";
                }
                else
                {
                    return asItemElements[0] + ".0.0.0";
                }
            }
        }
示例#8
0
        static string getGearStringBySlot(SavedVariablesDictionary characterInfo, string sSlot, bool replaceAsterisks)
        {
            SavedVariablesDictionary equipment = (SavedVariablesDictionary)characterInfo["Equipment"];

            if (equipment.ContainsKey(sSlot))
            {
                SavedVariablesDictionary item = equipment[sSlot] as SavedVariablesDictionary;
                string enchant = getEnchant(item).ToString();
                if (enchant == "0" && replaceAsterisks)
                {
                    enchant = "*";
                }
                return getGearString(item, replaceAsterisks) + "." + enchant;
            }
            else
            {
                return null;
            }
        }
示例#9
0
        static int getEnchantBySlot(SavedVariablesDictionary characterInfo, string sSlot)
        {
            SavedVariablesDictionary equipment = (SavedVariablesDictionary)characterInfo["Equipment"];

            if (equipment.ContainsKey(sSlot))
            {
                SavedVariablesDictionary item = equipment[sSlot] as SavedVariablesDictionary;
                return getEnchant(item);
            }
            else
            {
                return 0;
            }
        }
示例#10
0
        /*
         * This function is used to help populate the optimizer list.
         * Rather than add every item in every bag slot, this filter is used
         * to try to limit the items only to equippable ones.
         * Note however that the current implentation is a bit of a hack
         * that involves searching item Tooltips.
         * Returns true if the item is equippable.
         */
        /*static bool isEquippable(int itemID)
        {
            if (itemID > 0 && ItemCache.ContainsItemId(itemID))
            {
                ItemCache.Items[itemID].Slot
                string sTooltip = itemInfo["Tooltip"] as string;
            }

            return false;
        }*/

        static int getEnchant(SavedVariablesDictionary item)
        {
            string sItemString = item["Item"] as string;
            char[] acSplitCharacters = { ':' };
            return Int32.Parse(sItemString.Split(acSplitCharacters)[1]);
        }
        /*
        public Character(string name, string realm, CharacterRegion region, CharacterRace race,
         * string head, string neck, string shoulders, string back, string chest, string shirt, string tabard,
                string wrist, string hands, string waist, string legs, string feet, string finger1, string finger2, string trinket1, string trinket2,
         * string mainHand, string offHand, string ranged, string projectile, string projectileBag,
            int enchantHead, int enchantShoulders, int enchantBack, int enchantChest, int enchantWrist, 
         * int enchantHands, int enchantLegs, int enchantFeet, int enchantFinger1, int enchantFinger2, int enchantMainHand, int enchantOffHand, int enchantRanged)
         * */

        public CharacterProfilerCharacter(string sName, string sRealm, SavedVariablesDictionary characterInfo)
        {
            m_characterInfo = characterInfo;
            m_sName = sName;
            m_sRealm = sRealm;
            m_iLevel = (int)(characterInfo["Level"] as long?);

            m_sRace = (string)characterInfo["Race"];
            m_sClass = (string)characterInfo["Class"];
        }
        void setTalentsFromTree(SavedVariablesDictionary characterInfo)
        {
            if (!characterInfo.ContainsKey("Talents"))
            {
#if RAWR3 || RAWR4 || SILVERLIGHT
                //new ErrorWindow() { Message = "Not yet implemented." }.Show();
#else
                MessageBox.Show("Talent data was not found, and must be manually added.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
#endif
                return;
            }

            SavedVariablesDictionary talent_tree = characterInfo["Talents"] as SavedVariablesDictionary;

            TalentsBase Talents = m_character.CurrentTalents;

            if (Talents != null)
            {
                List<string> treeNames = new List<string>((string[])Talents.GetType().GetField("TreeNames").GetValue(Talents));

                //TalentTree currentTree;
                foreach (PropertyInfo pi in Talents.GetType().GetProperties())
                {
                    TalentDataAttribute[] talentDatas = pi.GetCustomAttributes(typeof(TalentDataAttribute), true) as TalentDataAttribute[];
                    if (talentDatas.Length > 0)
                    {
                        TalentDataAttribute talentData = talentDatas[0];

                        int points = getTalentPointsFromTree(talent_tree, treeNames[talentData.Tree], talentData);
                        m_character.CurrentTalents.Data[talentData.Index] = points;
                    }
                }
            }
        }
        /*
         * This function is used to help populate the optimizer list.
         * Rather than add every item in every bag slot, this filter is used
         * to try to limit the items only to equippable ones.
         * Note however that the current implentation is a bit of a hack
         * that involves searching item Tooltips.
         * Returns true if the item is equippable.
         */
        static bool isEquippable(SavedVariablesDictionary itemInfo)
        {
            if (itemInfo != null && itemInfo.ContainsKey("Tooltip"))
            {
                string sTooltip = itemInfo["Tooltip"] as string;

                foreach (string sNeedle in s_asEquippableTooltipKeywords)
                {
                    if (sTooltip.IndexOf(sNeedle) != -1)
                    {
                        return true;
                    }
                }
            }

            return false;
        }