This commit is contained in:
Eduardo Bart 2012-01-09 19:16:50 -02:00
parent 4de5e45d52
commit b18f85d6fd
4 changed files with 16 additions and 11 deletions

View File

@ -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)

View File

@ -24,7 +24,8 @@
Outfit::Outfit()
{
m_type = 0;
m_type = 128;
resetClothes();
}
Color Outfit::getColor(int color)

View File

@ -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];
}

View File

@ -129,6 +129,8 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassMemberFunction<Creature>("setEmblemTexture", &Creature::setEmblemTexture);
g_lua.registerClass<Item, Thing>();
g_lua.bindClassStaticFunction<Item>("create", &Item::create);
g_lua.registerClass<Effect, Thing>();
g_lua.registerClass<Missile, Thing>();
g_lua.registerClass<StaticText, Thing>();