mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Fix container bug, miniwindow pos, creature skulls outsite map bound
This commit is contained in:
@@ -236,15 +236,18 @@ void Creature::drawInformation(const Point& point, bool useGray, const Rect& par
|
||||
|
||||
if(m_skull != Otc::SkullNone && m_skullTexture) {
|
||||
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) {
|
||||
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) {
|
||||
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
|
||||
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)
|
||||
@@ -710,13 +712,10 @@ void Game::open(const ItemPtr& item, const ContainerPtr& previousContainer)
|
||||
return;
|
||||
|
||||
int id = 0;
|
||||
if(!previousContainer) {
|
||||
// find a free container id
|
||||
while(m_containers[id] != nullptr)
|
||||
id++;
|
||||
} else {
|
||||
if(!previousContainer)
|
||||
id = findEmptyContainerId();
|
||||
else
|
||||
id = previousContainer->getId();
|
||||
}
|
||||
|
||||
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]);
|
||||
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::string formatCreatureName(const std::string &name);
|
||||
int findEmptyContainerId();
|
||||
|
||||
protected:
|
||||
void enableBotCall() { m_denyBotCall = false; }
|
||||
|
Reference in New Issue
Block a user