Jump to content

Digest January-March

We talk about what was done and updated in the past month. We help keep abreast of events.

March February January

Servers monitoring and the Addons Editor

We present you two legends. All dreams come true.

Servers monitoring The Addons Editor

A statistics bot for Telegram

Convenient analytics right on your phone.

Read more

Game tooltips

Tooltips provide a way for 3rd party fansites and extensions to display detailed information on mouseover.

Read more

The Addons Updater

Let us to introduce the addons updating software and to share the details

Read more Download

Getting items one can craft


North

Recommended Posts

I want to get the data for the items I can craft. It would be great if anybody can help me. This is what I tried (besides many other calls). I think avatar.GetArmorCraftInfo is the function to use but I don't know how to get that skillId.

local skills = avatar.GetSkills ()
for i = 0, GetTableSize (skills) - 1 do
 local skillInfo = avatar.GetSkillInfo (skills [i])
 if skillInfo then
  LogInfo (skillInfo.name)
  local armorCraft = avatar.GetArmorCraftInfo (skillInfo.id)
  if armorCraft and armorCraft.active then
   local recipesList = armorCraft.recipes
   researchObj('', recipesList);
  end
 end
end

Any help will be greatly appreciated

Link to comment
Share on other sites

I don't know what you want to say. It is a function I use to see what information I get.

function researchObj(tab,obj)
   tab = tab .. "    "
   --- limit the recursion
   if string.len (tab) > 50 then
    LogInfo ("Recursion is limited!")
    return
   end
   local metaTable = getmetatable (obj)
   if metaTable then
    ---- Show the function of the object
    for k,v in pairs( metaTable ) do
	    LogInfo ( tab, k,":=",v)
    end
   end
   if type(obj) == "table" then
    ---- Show the fields (variables) of the table
    if GetTableSize( obj ) == 0
	    then LogInfo ( tab, "{}")
	    return
	    end
    for k,v in pairs(obj) do
	    LogInfo ( tab, k,":=",v,  "{", type (v), "}")
	    if type (v) == "table" and k ~= "__index"  and k ~= "_G" then
		    --- "__index" - It is exactly the same table is a nested loop that leads to
		    researchObj(tab,v)
	    end
    end
   else
    LogInfo ( tab, "_:=",obj, "{", type (obj), "}")
   end
end

Link to comment
Share on other sites

seeScriptLIB.lua in AddonsTools addon

okey

for i, skillId in avatar.GetSkills () do
 local skillInfo = avatar.GetSkillInfo (skillId)
 if skillInfo then
  exObj2("skillInfo", skillInfo)
  local armorCraft = avatar.GetArmorCraftInfo (skillInfo.id)
  exObj2("recipes", armorCraft.recipes);
 end
end

Link to comment
Share on other sites

Thank you icreator. exObj2 is really useful.

My problem is that I get the following error:

Game::LuaAvatarGetArmorCraftInfo: skill Mechanics/Skills/BlacksmithV2/Blacksmith.(DiceCraftSkillResource).xdb is not armor craft, details: int __cdecl Game::LuaAvatarGetArmorCraftInfo(struct lua_State *)

I am not able to get a list of the recipes I can craft. I've managed to get such a list for alchemy. I would like to do the same for Blacksmithing for example.

local alchemy = avatar.GetAlchemyInfo ()
exObj2('alchemy', alchemy);
for i, recipe in alchemy.recipes do
 local recipeInfo = avatar.GetRecipeInfo (recipe)
 exObj2('recipe', recipeInfo);
end

Link to comment
Share on other sites

craft.DiceCraftGetRecipes()

local recipes = craft.DiceCraftGetRecipes()

if recipes and recipes[0] then

LogInfo( avatar.GetRecipeInfo(recipes[0]) )

end

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use