Filter profession-specific mounts #118


  • Accepted
  • Patch
Open
Assigned to _ForgeUser2747109
  • Daeymien created this issue Nov 26, 2012

    Since options are stored per-character, may as well make use of LibMounts' GetProfessionRestriction() function to filter out profession-specific mounts that the character can't use when building the available mounts list. They'd generally just be disabled by the player anyway and this allows SmartMount to "automagically" avoid trying to summon a mount that's unusable by that character.

    Code snippet below (@ line 265):

    		-- count the mounts I have	
    		local mounts = self:CountMounts(true, false, true)
    		for i, _ in pairs(mounts) do
    				for _, v in pairs(mounts[i]) do
    					local _, itemName, itemSpellID, itemTexture, _ = GetCompanionInfo("MOUNT", v.slot)
    					if type(itemName) ~= 'string' then
    						self:dump('mounts['..i..']', v)
    						self:dump('itemName', itemName)
    						self:dump('itemTexture', itemTexture)
    					else
    					local CanUseByProf = LibStub("LibMounts-1.0"):GetProfessionRestriction(itemSpellID)
    						if CanUseByProf then
    						-- update cache
    							self:GetPref('ListOfMountsCache')[v.action] = (-i)..':'..itemName
    						--self:SetTablePref('ListOfMountsCache', v.action, i..':'..itemName)
    						-- set list
    							self.ListOfMounts[v.action] = {
    								type = 'MOUNT',
    								action = v.action,
    								name = itemName,
    								slot = v.slot,
    								can = true,
    	-- Mount Indexes!! 1 = very slow, 2 = travel/ghost wolf, 3 = ground, 4 = aq, 5 = vashj, 6 = fly, 7 = fly+ground 
    								mount = i,
    								land = (i <= 4) or (i == 7),
    								fly = (i == 6) or (i == 7),
    								swim = false,
    								incombat = false,
    								inwater = true,
    								inair = false,
    								onground = true,
    								inhouse = false,
    								icon = itemTexture,
    							}
    						end -- if
    					end -- if
    				end -- for
    		end -- for
    


    The GetProfessionRestriction() call will always return True for non-profession mounts, so those are covered. As mentioned above, this addition will skip adding mounts that cannot be used due to profession restriction to the table of available mounts thus eliminating the need to manually add them to the exclusions list on characters that do not posses the skill.

  • Daeymien added the tags New Patch Nov 26, 2012
  • Daeymien edited description Jun 3, 2013
  • Daeymien posted a comment Jun 3, 2013

    EDIT: Updating with actual code since this ticket hasn't seen any activity since 2012

  • Daeymien edited description Jun 3, 2013
  • Daeymien edited description Jun 3, 2013
  • Daeymien posted a comment Jun 3, 2013

    EDIT 2: Added entire code block (shouldn't try to remember where stuff goes at 3am with no sleep)

  • Daeymien edited description Jun 3, 2013
  • _ForgeUser2747109 posted a comment Jun 3, 2013

    @Daeymien: Go

    Daeymien

    I recently became involved in the project and while I understand you would like this feature added, I am currently working on sorting out the functions so I can begin moving away from LibRock as it has been deprecated.

    My intentions are to rely on Ace3, and as soon as I finish removing and rewriting the code to rely on Ace and have a working project I will post a notice on the front page.

    I have been using SmartMount for years and I personally am grateful that akazik has allowed me to work on this. Smartmount has been good, better than some of the others but once LibRock is no more I feel it will be so much better.

    So please be patient with me as I make the changes and when I have something working, I will get the users involved for testing and suggestions.

    WyzrdX

  • _ForgeUser2747109 unassigned issue from Forge_User_65927410 Jun 3, 2013
  • _ForgeUser2747109 self-assigned this issue Jun 3, 2013
  • _ForgeUser2747109 removed a tag New Jun 3, 2013
  • _ForgeUser2747109 added a tag Accepted Jun 3, 2013

To post a comment, please login or register a new account.