diff --git a/modules/addon_terminal/commands.lua b/modules/addon_terminal/commands.lua index d17238a7..1c45b76b 100644 --- a/modules/addon_terminal/commands.lua +++ b/modules/addon_terminal/commands.lua @@ -8,3 +8,10 @@ function drawDebugBoxes(enable) if enable == nil then enable = true end g_ui.setDebugBoxesDrawing(enable) end + +function displayItem(id) + local itemWidget = createWidget('Item', rootWidget) + --itemWidget:setItem(Item.create(11703)) +end + +addEvent(function() displayItem(408) end) \ No newline at end of file diff --git a/src/otclient/core/outfit.cpp b/src/otclient/core/outfit.cpp index 64fff8e5..fe4f6978 100644 --- a/src/otclient/core/outfit.cpp +++ b/src/otclient/core/outfit.cpp @@ -24,7 +24,8 @@ Outfit::Outfit() { - m_type = 0; + m_type = 128; + resetClothes(); } Color Outfit::getColor(int color) diff --git a/src/otclient/core/thingstype.cpp b/src/otclient/core/thingstype.cpp index cc48a30f..4773a8b6 100644 --- a/src/otclient/core/thingstype.cpp +++ b/src/otclient/core/thingstype.cpp @@ -40,7 +40,7 @@ bool ThingsType::load(const std::string& file) for(int i = 0; i < LastCategory; ++i) numThings[i] = Fw::getU16(fin); - numThings[Item] -= 100; + numThings[Item] -= 99; for(int i = 0; i < LastCategory; ++i) { m_things[i].resize(numThings[i]); @@ -115,16 +115,11 @@ void ThingsType::parseThingType(std::stringstream& fin, ThingType& thingType) ThingType *ThingsType::getThingType(uint16 id, Categories category) { + assert(id != 0); if(category == Item) id -= 100; - - //assert(id < m_things[category].size()); - - // assert wrokground - if(id >= m_things[category].size()) { - //logTraceErrorOnce("got an invalid type"); - return &m_emptyThingType; - } - + else if(category == Creature || category == Effect || category == Missile) + id -= 1; + assert(id < m_things[category].size()); return &m_things[category][id]; } diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index 46fdc47c..99621f35 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -129,6 +129,8 @@ void OTClient::registerLuaFunctions() g_lua.bindClassMemberFunction("setEmblemTexture", &Creature::setEmblemTexture); g_lua.registerClass(); + g_lua.bindClassStaticFunction("create", &Item::create); + g_lua.registerClass(); g_lua.registerClass(); g_lua.registerClass();