예제 #1
0
        private string GetName()
        {
            string name      = null;
            uint   stringPtr = 0;

            switch (_toolType)
            {
            case ToolType.SpellFocus:
                WoWDb.DbTable t = StyxWoW.Db[ClientDb.SpellFocusObject];
                WoWDb.Row     r = t.GetRow(_index);
                stringPtr = r.GetField <uint>(1);
                break;

            case ToolType.AreaTable:
                t         = StyxWoW.Db[ClientDb.AreaTable];
                r         = t.GetRow(_index);
                stringPtr = r.GetField <uint>(11);
                break;

            case ToolType.Item:
                name = Util.GetItemCacheName(_index);
                break;

            case ToolType.Totem:
                t         = StyxWoW.Db[ClientDb.TotemCategory];
                r         = t.GetRow(_index);
                stringPtr = r.GetField <uint>(1);
                break;
            }
            if (stringPtr != 0)
            {
                name = ObjectManager.Wow.Read <string>(stringPtr);
            }
            return(name);
        }
예제 #2
0
        string GetName()
        {
            string _name     = null;
            uint   stringPtr = 0;

            switch (toolType)
            {
            case ToolType.SpellFocus:
                WoWDb.DbTable t = StyxWoW.Db[Styx.Patchables.ClientDb.SpellFocusObject];
                WoWDb.Row     r = t.GetRow(index);
                stringPtr = r.GetField <uint>(1);
                break;

            case ToolType.AreaTable:
                t         = StyxWoW.Db[Styx.Patchables.ClientDb.AreaTable];
                r         = t.GetRow(index);
                stringPtr = r.GetField <uint>(11);
                break;

            case ToolType.Item:
                _name = TradeSkillFrame.GetItemCacheName(index);
                break;

            case ToolType.Totem:
                t         = StyxWoW.Db[Styx.Patchables.ClientDb.TotemCategory];
                r         = t.GetRow(index);
                stringPtr = r.GetField <uint>(1);
                break;
            }
            if (stringPtr != 0)
            {
                _name = ObjectManager.Wow.Read <string>(stringPtr);
            }
            return(_name);
        }
예제 #3
0
        private string GetName()
        {
            string name = null;

            switch (_toolType)
            {
            case ToolType.SpellFocus:
                WoWDb.DbTable t = StyxWoW.Db[ClientDb.SpellFocusObject];
                WoWDb.Row     r = t.GetRow(_index);
                name = r.GetStringField(1);
                break;

            case ToolType.AreaTable:
                t    = StyxWoW.Db[ClientDb.AreaTable];
                r    = t.GetRow(_index);
                name = r.GetStringField(13);
                break;

            case ToolType.Item:
                name = Util.GetItemCacheName(_index);
                break;

            case ToolType.Totem:
                t    = StyxWoW.Db[ClientDb.TotemCategory];
                r    = t.GetRow(_index);
                name = r.GetStringField(1);
                break;
            }
            return(name);
        }
예제 #4
0
        internal void InitIngredients()    // instantizing ingredients in here and doing a null check to prevent recursion from Trade.Ingredients()
        {
            if (ingredients != null)
            {
                return;
            }
            uint recipeID = ID;

            ingredients = new List <Ingredient>();
            WoWDb.DbTable SpelldbTable;
            WoWDb.Row     SpelldbRow;
            SpelldbTable = StyxWoW.Db[ClientDb.Spell];
            if (SpelldbTable != null && recipeID <= SpelldbTable.MaxIndex && recipeID >= SpelldbTable.MinIndex)
            {
                SpelldbRow = SpelldbTable.GetRow((uint)recipeID);
                if (SpelldbRow != null)
                {
                    uint          reagentIndex   = SpelldbRow.GetField <uint>((uint)SpellDB.SpellReagentsIndex);// Changed to 43 in WoW 4.2
                    WoWDb.DbTable reagentDbTable = StyxWoW.Db[ClientDb.SpellReagents];
                    if (reagentDbTable != null && reagentIndex <= reagentDbTable.MaxIndex &&
                        reagentIndex >= reagentDbTable.MinIndex)
                    {
                        WoWDb.Row reagentDbRow = reagentDbTable.GetRow(reagentIndex);
                        for (uint index = 1; index <= 8; index++)
                        {
                            uint id = reagentDbRow.GetField <uint>(index);
                            if (id != 0)
                            {
                                ingredients.Add(new Ingredient(id, reagentDbRow.GetField <uint>(index + 8), parent.Ingredients));
                            }
                        }
                    }
                }
            }
        }
예제 #5
0
        // grab name from dbc
        private string GetName()
        {
            string getName = null;

            WoWDb.DbTable t = StyxWoW.Db[ClientDb.Spell];
            WoWDb.Row     r = t.GetRow(SpellId);
            getName = r.GetStringField((uint)SpellDB.NamePtr);
            return(getName);
        }
예제 #6
0
        // grab name from dbc
        string GetName()
        {
            string name = null;

            WoWDb.DbTable t         = StyxWoW.Db[Styx.Patchables.ClientDb.Spell];
            WoWDb.Row     r         = t.GetRow((uint)ID);
            uint          stringPtr = r.GetField <uint>((uint)SpellDB.NamePtr);

            if (stringPtr != 0)
            {
                name = ObjectManager.Wow.Read <string>(stringPtr);
            }
            return(name);
        }
예제 #7
0
        // grab name from dbc
        private string GetName()
        {
            string getName = null;

            WoWDb.DbTable t         = StyxWoW.Db[ClientDb.Spell];
            WoWDb.Row     r         = t.GetRow(SpellId);
            var           stringPtr = r.GetField <uint>((uint)SpellDB.NamePtr);

            if (stringPtr != 0)
            {
                getName = ObjectManager.Wow.Read <string>(stringPtr);
            }
            return(getName);
        }
예제 #8
0
        WoWPoint mapToWorldCoords(float x, float y, uint mapId)
        {
            WoWPoint worldPoint = new WoWPoint();

            WoWDb.DbTable worldMapArea       = StyxWoW.Db[ClientDb.WorldMapArea];
            WoWDb.Row     worldMapAreaFields = worldMapArea.GetRow(mapId);
            float         ay = worldMapAreaFields.GetField <float>(4);
            float         by = worldMapAreaFields.GetField <float>(5);
            float         ax = worldMapAreaFields.GetField <float>(6);
            float         bx = worldMapAreaFields.GetField <float>(7);

            worldPoint.X = ax + (y * (bx - ax));
            worldPoint.Y = ay + (x * (by - ay));
            try
            {
                worldPoint.Z = Navigator.FindHeights(worldPoint.X, worldPoint.Y).Max();
            }
            catch { return(TryGetHieght(worldPoint)); }
            return(worldPoint);
        }
        static WoWPoint mapToWorldCoords(worldMapCoord wmc)
        {
            WoWPoint worldPoint = new WoWPoint();

            WoWDb.DbTable worldMapArea       = StyxWoW.Db[ClientDb.WorldMapArea];
            WoWDb.Row     worldMapAreaFields = worldMapArea.GetRow(wmc.MapID);
            float         ay = worldMapAreaFields.GetField <float>(4);
            float         by = worldMapAreaFields.GetField <float>(5);
            float         ax = worldMapAreaFields.GetField <float>(6);
            float         bx = worldMapAreaFields.GetField <float>(7);

            //Logging.Write("You are at {0}, {1} relative", (myLoc.Y - a.Y) / (b.Y - a.Y), (myLoc.X - a.X) / (b.X - a.X));
            worldPoint.X = ax + (wmc.Y * (bx - ax));
            worldPoint.Y = ay + (wmc.X * (by - ay));
            try
            {
                worldPoint.Z = Navigator.FindHeights(worldPoint.X, worldPoint.Y).Max();
            }
            catch { return(WoWPoint.Empty); }
            return(worldPoint);
        }
예제 #10
0
        uint FindMapId(string localMapName)
        {
            WoWDb.DbTable t   = StyxWoW.Db[ClientDb.WorldMapArea];
            int           max = t.MaxIndex;

            for (int i = t.MinIndex; i <= max;)
            {
                WoWDb.Row r       = t.GetRow((uint)i);
                string    mapName = ObjectManager.Wow.Read <string>(r.GetField <uint>(3));
                if (mapName == localMapName)
                {
                    return((uint)i);
                }
                if (i < max)
                {
                    i = r.GetField <int>(12);
                }
                else
                {
                    break;
                }
            }
            return(0);
        }
예제 #11
0
        // grab name from dbc
        internal void InitTools()   // instantizing tools in here and doing a null check to prevent recursion from Trade.Tools()
        {
            if (tools != null)
            {
                return;
            }
            tools = new List <Tool>();
            WoWDb.DbTable t             = StyxWoW.Db[Styx.Patchables.ClientDb.Spell];
            WoWDb.Row     spellDbRow    = t.GetRow((uint)ID);
            uint          spellReqIndex = spellDbRow.GetField <uint>((uint)SpellDB.SpellCastingReqIndex); // changed from 33 to 34 in WOW 4.2

            if (spellReqIndex != 0)
            {
                t = StyxWoW.Db[Styx.Patchables.ClientDb.SpellCastingRequirements];
                WoWDb.Row spellReqDbRow   = t.GetRow(spellReqIndex);
                uint      spellFocusIndex = spellReqDbRow.GetField <uint>(6);
                // anvils, forge etc
                if (spellFocusIndex != 0)
                {
                    tools.Add(GetTool(spellFocusIndex, Tool.ToolType.SpellFocus));
                }
                uint areaGroupIndex = spellReqDbRow.GetField <uint>(4);
                if (areaGroupIndex != 0)
                {
                    t = StyxWoW.Db[Styx.Patchables.ClientDb.AreaGroup];
                    WoWDb.Row areaGroupDbRow = t.GetRow(areaGroupIndex);
                    uint      areaTableIndex = areaGroupDbRow.GetField <uint>(1);
                    // not sure which kind of tools this covers
                    if (areaTableIndex != 0)
                    {
                        tools.Add(GetTool(areaTableIndex, Tool.ToolType.AreaTable));
                    }
                }
            }
            uint spellTotemsIndex = spellDbRow.GetField <uint>((uint)SpellDB.SpellTotemsIndex); // changed from 45 to 46 in WOW 4.2

            if (spellTotemsIndex != 0)
            {
                t = StyxWoW.Db[Styx.Patchables.ClientDb.SpellTotems];
                WoWDb.Row spellTotemsDbRow = t.GetRow(spellTotemsIndex);
                uint      cacheIndex = 0, totemCategoryIndex = 0;
                for (uint i = 1; i <= 4 && cacheIndex == 0; i++)
                {
                    if (cacheIndex == 0 && i >= 3)
                    {
                        cacheIndex = spellTotemsDbRow.GetField <uint>(i);
                    }
                    if (totemCategoryIndex == 0 && i <= 2)
                    {
                        totemCategoryIndex = spellTotemsDbRow.GetField <uint>(i);
                    }
                }
                // not sure which kind of tools this covers
                if (cacheIndex != 0)
                {
                    tools.Add(GetTool(cacheIndex, Tool.ToolType.Item));
                }
                // Blacksmith hammer, mining pick
                if (totemCategoryIndex != 0)
                {
                    t = StyxWoW.Db[Styx.Patchables.ClientDb.TotemCategory];
                    spellTotemsDbRow = t.GetRow(totemCategoryIndex);
                    tools.Add(GetTool(totemCategoryIndex, Tool.ToolType.Totem));
                }
            }
        }
예제 #12
0
 uint GetContinentId(uint mapID)
 {
     WoWDb.DbTable t = StyxWoW.Db[ClientDb.WorldMapArea];
     WoWDb.Row     r = t.GetRow(mapID);
     return(r.GetField <uint>(1));
 }
예제 #13
0
        private List <SkillLineAbilityEntry> GetSkillLineAbilityEntries()
        {
            var abilityList   = new List <SkillLineAbilityEntry>();
            var targetSkillId = (int)SkillLine;

            WoWDb.DbTable table    = StyxWoW.Db[ClientDb.SkillLineAbility];
            var           minIndex = (uint)table.MinIndex;
            var           topIndex = (uint)table.NumRows;
            uint          bomIndex = 0;
            uint          half;

            var firstRowPtr =
                ObjectManager.Wow.Read <uint>(((uint)ClientDb.SkillLineAbility + ObjectManager.Wow.ImageBase) + 0x14);
            uint id;

            // optimized search
            do
            {
                half = (topIndex + bomIndex) / 2;
                id   = ObjectManager.Wow.Read <uint>((firstRowPtr + half * SkillLineAbilityEntrySize) + 4); // skill
                if (id > targetSkillId)
                {
                    topIndex = (topIndex + half) / 2;
                }
                else if (id < targetSkillId)
                {
                    bomIndex = ((half + bomIndex) / 2) + 1;
                }
                else
                {
                    break;
                }
            } while (bomIndex < topIndex);

            var  index     = ObjectManager.Wow.Read <uint>((firstRowPtr + (half - 1) * SkillLineAbilityEntrySize));
            uint prevIndex = index;

            while (index > minIndex)
            {
                id    = ObjectManager.Wow.Read <uint>((firstRowPtr + (half - 1) * SkillLineAbilityEntrySize) + 4);
                index = ObjectManager.Wow.Read <uint>((firstRowPtr + (half - 1) * SkillLineAbilityEntrySize));
                if (id != targetSkillId)
                {
                    break;
                }
                half--;
                prevIndex = index;
            }

            for (uint i = prevIndex; i <= table.MaxIndex;)
            {
                WoWDb.Row row   = table.GetRow(i);
                var       entry = row.GetStruct <SkillLineAbilityEntry>();
                if ((int)entry.SkillLine != targetSkillId)
                {
                    break;
                }
                abilityList.Add(entry);
                if (i != table.MaxIndex) // get next index
                {
                    i = row.GetField <uint>((SkillLineAbilityFieldNum));
                }
            }
            return(abilityList);
        }
예제 #14
0
        private List <SkillLineAbilityEntry> GetSkillLineAbilityEntries()
        {
            var abilityList   = new List <SkillLineAbilityEntry>();
            var targetSkillId = (int)SkillLine;

            WoWDb.DbTable table    = StyxWoW.Db[ClientDb.SkillLineAbility];
            var           minIndex = (uint)table.MinIndex;
            var           topIndex = (uint)table.NumRows;
            uint          bomIndex = 0;
            uint          half;
            var           firstRowPtr = StyxWoW.Memory.Read <uint>((IntPtr)((uint)ClientDb.SkillLineAbility - 0x400000) + 0x14, true);
            // var firstRowPtr = StyxWoW.Memory.Read<uint>((IntPtr)((uint)ClientDb.SkillLineAbility) + 0x14, true);
            uint id;

            // optimized search
            do
            {
                half = (topIndex + bomIndex) / 2;
                id   = StyxWoW.Memory.Read <uint>((IntPtr)(firstRowPtr + half * SkillLineAbilityEntrySize) + 4);              // skill id
                if (id > targetSkillId)
                {
                    topIndex = (topIndex + half) / 2;
                }
                else if (id < targetSkillId)
                {
                    bomIndex = ((half + bomIndex) / 2) + 1;
                }
                else
                {
                    break;
                }
            } while (bomIndex < topIndex);

            var  index     = StyxWoW.Memory.Read <uint>((IntPtr)(firstRowPtr + (half - 1) * SkillLineAbilityEntrySize));
            uint prevIndex = index;

            while (index > minIndex)
            {
                id    = StyxWoW.Memory.Read <uint>((IntPtr)(firstRowPtr + (half - 1) * SkillLineAbilityEntrySize) + 4);
                index = StyxWoW.Memory.Read <uint>((IntPtr)(firstRowPtr + (half - 1) * SkillLineAbilityEntrySize));
                if (id != targetSkillId)
                {
                    break;
                }
                half--;
                prevIndex = index;
            }

            for (uint i = prevIndex; i <= table.MaxIndex;)
            {
                WoWDb.Row row   = table.GetRow(i);
                var       entry = row.GetStruct <SkillLineAbilityEntry>();
                if ((int)entry.SkillLine != targetSkillId)
                {
                    break;
                }
                var spell = WoWSpell.FromId((int)entry.SpellId);
                if (spell != null && spell.IsValid)
                {
                    abilityList.Add(entry);
                }

                if (i != table.MaxIndex)                 // get next index
                {
                    i = row.GetField <uint>((SkillLineAbilityFieldNum));
                }
            }

            return(abilityList);
        }