Fix container bug, miniwindow pos, creature skulls outsite map bound
This commit is contained in:
parent
715f560b79
commit
beb04d8d8e
|
@ -97,7 +97,7 @@ function UIMiniWindow:setup()
|
||||||
elseif selfSettings.position then
|
elseif selfSettings.position then
|
||||||
self:setParent(parent)
|
self:setParent(parent)
|
||||||
self:setPosition(topoint(selfSettings.position))
|
self:setPosition(topoint(selfSettings.position))
|
||||||
self:bindRectToParent()
|
addEvent(function() self:bindRectToParent() end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -351,11 +351,10 @@ function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, u
|
||||||
if useThing:isContainer() then
|
if useThing:isContainer() then
|
||||||
if useThing:getParentContainer() then
|
if useThing:getParentContainer() then
|
||||||
g_game.open(useThing, useThing:getParentContainer())
|
g_game.open(useThing, useThing:getParentContainer())
|
||||||
return true
|
|
||||||
else
|
else
|
||||||
g_game.open(useThing)
|
g_game.open(useThing)
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
return true
|
||||||
elseif useThing:isMultiUse() then
|
elseif useThing:isMultiUse() then
|
||||||
startUseWith(useThing)
|
startUseWith(useThing)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -236,15 +236,18 @@ void Creature::drawInformation(const Point& point, bool useGray, const Rect& par
|
||||||
|
|
||||||
if(m_skull != Otc::SkullNone && m_skullTexture) {
|
if(m_skull != Otc::SkullNone && m_skullTexture) {
|
||||||
g_painter->setColor(Color::white);
|
g_painter->setColor(Color::white);
|
||||||
g_painter->drawTexturedRect(Rect(point.x + 12, point.y + 5, m_skullTexture->getSize()), m_skullTexture);
|
Rect skullRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 5, m_skullTexture->getSize());
|
||||||
|
g_painter->drawTexturedRect(skullRect, m_skullTexture);
|
||||||
}
|
}
|
||||||
if(m_shield != Otc::ShieldNone && m_shieldTexture && m_showShieldTexture) {
|
if(m_shield != Otc::ShieldNone && m_shieldTexture && m_showShieldTexture) {
|
||||||
g_painter->setColor(Color::white);
|
g_painter->setColor(Color::white);
|
||||||
g_painter->drawTexturedRect(Rect(point.x, point.y + 5, m_shieldTexture->getSize()), m_shieldTexture);
|
Rect shieldRect = Rect(backgroundRect.x() + 13.5, backgroundRect.y() + 5, m_shieldTexture->getSize());
|
||||||
|
g_painter->drawTexturedRect(shieldRect, m_shieldTexture);
|
||||||
}
|
}
|
||||||
if(m_emblem != Otc::EmblemNone && m_emblemTexture) {
|
if(m_emblem != Otc::EmblemNone && m_emblemTexture) {
|
||||||
g_painter->setColor(Color::white);
|
g_painter->setColor(Color::white);
|
||||||
g_painter->drawTexturedRect(Rect(point.x + 12, point.y + 16, m_emblemTexture->getSize()), m_emblemTexture);
|
Rect emblemRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 16, m_emblemTexture->getSize());
|
||||||
|
g_painter->drawTexturedRect(emblemRect, m_emblemTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -663,7 +663,9 @@ void Game::use(const ThingPtr& thing)
|
||||||
if(!pos.isValid()) // virtual item
|
if(!pos.isValid()) // virtual item
|
||||||
pos = Position(0xFFFF, 0, 0); // means that is a item in inventory
|
pos = Position(0xFFFF, 0, 0); // means that is a item in inventory
|
||||||
|
|
||||||
m_protocolGame->sendUseItem(pos, thing->getId(), thing->getStackpos(), 0);
|
// some itens, e.g. parcel, are not set as containers but they are.
|
||||||
|
// always try to use these items in free container slots.
|
||||||
|
m_protocolGame->sendUseItem(pos, thing->getId(), thing->getStackpos(), findEmptyContainerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::useInventoryItem(int itemId)
|
void Game::useInventoryItem(int itemId)
|
||||||
|
@ -710,13 +712,10 @@ void Game::open(const ItemPtr& item, const ContainerPtr& previousContainer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int id = 0;
|
int id = 0;
|
||||||
if(!previousContainer) {
|
if(!previousContainer)
|
||||||
// find a free container id
|
id = findEmptyContainerId();
|
||||||
while(m_containers[id] != nullptr)
|
else
|
||||||
id++;
|
|
||||||
} else {
|
|
||||||
id = previousContainer->getId();
|
id = previousContainer->getId();
|
||||||
}
|
|
||||||
|
|
||||||
m_protocolGame->sendUseItem(item->getPosition(), item->getId(), item->getStackpos(), id);
|
m_protocolGame->sendUseItem(item->getPosition(), item->getId(), item->getStackpos(), id);
|
||||||
}
|
}
|
||||||
|
@ -1215,3 +1214,11 @@ std::string Game::formatCreatureName(const std::string& name)
|
||||||
formatedName[0] = stdext::upchar(formatedName[0]);
|
formatedName[0] = stdext::upchar(formatedName[0]);
|
||||||
return formatedName;
|
return formatedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Game::findEmptyContainerId()
|
||||||
|
{
|
||||||
|
int id = 0;
|
||||||
|
while(m_containers[id] != nullptr)
|
||||||
|
id++;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
|
@ -268,6 +268,7 @@ public:
|
||||||
std::vector<uint8> getGMActions() { return m_gmActions; }
|
std::vector<uint8> getGMActions() { return m_gmActions; }
|
||||||
|
|
||||||
std::string formatCreatureName(const std::string &name);
|
std::string formatCreatureName(const std::string &name);
|
||||||
|
int findEmptyContainerId();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void enableBotCall() { m_denyBotCall = false; }
|
void enableBotCall() { m_denyBotCall = false; }
|
||||||
|
|
Loading…
Reference in New Issue