look on items

This commit is contained in:
Henrique Santiago
2012-01-02 22:10:39 -02:00
parent 7c28297397
commit 9fbdf3f5cb
12 changed files with 58 additions and 72 deletions

View File

@@ -156,7 +156,7 @@ void Game::turn(Otc::Direction direction)
}
}
void Game::look(const Position& position)
void Game::lookAtMap(const Position& position)
{
Position tilePos = position;
TilePtr tile = nullptr;
@@ -176,6 +176,12 @@ void Game::look(const Position& position)
m_protocolGame->sendLookAt(tilePos, thing->getId(), stackpos);
}
void Game::lookAtInventory(int thingId, int slot)
{
Position pos = Position(0xffff, slot, 0);
m_protocolGame->sendLookAt(pos, thingId, 0);
}
void Game::talkChannel(int channelType, int channelId, const std::string& message)
{
if(!m_online)

View File

@@ -48,7 +48,8 @@ public:
void walk(Otc::Direction direction);
void turn(Otc::Direction direction);
void look(const Position& position);
void lookAtMap(const Position& position);
void lookAtInventory(int thingId, int slot);
void talkChannel(int channelType, int channelId, const std::string& message);
void talkPrivate(int channelType, const std::string& receiver, const std::string& message);
void openOutfitWindow();

View File

@@ -342,7 +342,7 @@ void Map::addCreature(const CreaturePtr& creature)
CreaturePtr Map::getCreatureById(uint32 id)
{
if(g_game.getLocalPlayer() && g_game.getLocalPlayer()->getId() == id)
if(g_game.getLocalPlayer() && (uint32)g_game.getLocalPlayer()->getId() == id)
return g_game.getLocalPlayer();
return m_creatures[id];
}

View File

@@ -52,7 +52,7 @@ void Thing::internalDraw(const Point& p, int layer)
}
}
void Thing::setId(uint32 id)
void Thing::setId(int id)
{
m_id = id;
m_type = getType();

View File

@@ -43,10 +43,10 @@ public:
virtual void draw(const Point& p) = 0;
void setId(uint32 id);
void setId(int id);
virtual void setPosition(const Position& position) { m_position = position; }
uint32 getId() const { return m_id; }
int getId() const { return m_id; }
Position getPosition() const { return m_position; }
int getStackPriority();
virtual ThingType *getType();

View File

@@ -35,6 +35,7 @@ void OTClient::registerLuaFunctions()
g_lua.registerClass<ProtocolGame, Protocol>();
g_lua.registerClass<Thing>();
g_lua.bindClassMemberFunction<Thing>("getId", &Thing::getId);
g_lua.bindClassMemberFunction<Thing>("getType", &Thing::getType);
g_lua.bindClassMemberFunction<Thing>("isContainer", &Thing::isContainer);
@@ -55,6 +56,7 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassStaticFunction<Game>("isOnline", std::bind(&Game::isOnline, &g_game));
g_lua.bindClassStaticFunction<Game>("openOutfitWindow", std::bind(&Game::openOutfitWindow, &g_game));
g_lua.bindClassStaticFunction<Game>("setOutfit", std::bind(&Game::setOutfit, &g_game, _1));
g_lua.bindClassStaticFunction<Game>("lookAtInventory", std::bind(&Game::lookAtInventory, &g_game, _1, _2));
g_lua.registerClass<UIItem, UIWidget>();
g_lua.bindClassStaticFunction<UIItem>("create", &UIItem::create<UIItem>);

View File

@@ -1083,7 +1083,7 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
g_map.removeCreatureById(removeId);
if(id == m_localPlayer->getId())
if(id == (uint32)m_localPlayer->getId())
creature = m_localPlayer->asCreature();
else if(id >= Otc::PlayerStartId && id < Otc::PlayerEndId)
creature = PlayerPtr(new Player)->asCreature();

View File

@@ -92,7 +92,7 @@ bool UIMap::onMousePress(const Point& mousePos, Fw::MouseButton button)
if(button == Fw::MouseLeftButton) {
}
else if(button == Fw::MouseRightButton) {
g_game.look(tilePos);
//g_game.lookAtMap(tilePos);
}
return true;