destroyer667
Member
- Joined
- Nov 21, 2007
- Messages
- 290
- Reaction score
- 6
im trying to figure out how to add when a gm looks at an item he can see the i'd and position of it etc. im not sure if this is the only file i need to copy it from but most likely i need to put it in another file to.
i found the code in game.cpp
TFS 7.6(crying damson)
Avesta 7.6 that doesn't have it
i found the code in game.cpp
TFS 7.6(crying damson)
Lua:
bool Game::playerLookAt(uint32_t playerId, const Position& pos, uint16_t spriteId, uint8_t stackPos)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;
Thing* thing = internalGetThing(player, pos, stackPos, spriteId, STACKPOS_LOOK);
if(!thing)
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
return false;
}
Position thingPos = thing->getPosition();
if(!player->canSee(thingPos))
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
return false;
}
Position playerPos = player->getPosition();
int32_t lookDistance = 0;
if(thing == player)
lookDistance = -1;
else
{
lookDistance = std::max(std::abs(playerPos.x - thingPos.x), std::abs(playerPos.y - thingPos.y));
if(playerPos.z != thingPos.z)
lookDistance = lookDistance + 9 + 6;
}
std::stringstream ss;
ss << "You see " << thing->getDescription(lookDistance);
if(hasCustomFlag(PlayerCustomFlag_CanSeeItemDetails))
{
Item* item = thing->getItem();
if(item)
{
ss << std::endl << "ItemID: [" << item->getID() << "].";
if(item->getActionId() > 0)
ss << std::endl << "ActionID: [" << item->getActionId() << "].";
if(item->getUniqueId() > 0)
ss << std::endl << "UniqueID: [" << item->getUniqueId() << "].";
}
}
if(hasCustomFlag(PlayerCustomFlag_CanSeeCreatureDetails))
{
if(Creature* creature = thing->getCreature())
{
ss << std::endl << "Health: [" << creature->getHealth() << " / " << creature->getMaxHealth() << "].";
ss << std::endl << "Mana: [" << creature->getMana() << " / " << creature->getMaxMana() << "].";
}
}
if(hasCustomFlag(PlayerCustomFlag_CanSeePosition))
ss << std::endl << "Position: [X: " << thingPos.x << "] [Y: " << thingPos.y << "] [Z: " << thingPos.z << "].";
player->sendTextMessage(MSG_INFO_DESCR, ss.str());
return true;
}
Avesta 7.6 that doesn't have it
Lua:
bool Game::playerLookAt(uint32_t playerId, const Position& pos, uint16_t spriteId, uint8_t stackPos)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;
Thing* thing = internalGetThing(player, pos, stackPos, spriteId, STACKPOS_LOOK);
if(!thing){
player->sendCancelMessage(RET_NOTPOSSIBLE);
return false;
}
Position thingPos = thing->getPosition();
if(!player->canSee(thingPos)){
player->sendCancelMessage(RET_NOTPOSSIBLE);
return false;
}
Position playerPos = player->getPosition();
int32_t lookDistance = 0;
if(thing == player)
lookDistance = -1;
else{
lookDistance = std::max(std::abs(playerPos.x - thingPos.x), std::abs(playerPos.y - thingPos.y));
if(playerPos.z != thingPos.z)
lookDistance = lookDistance + 9 + 6;
}
std::stringstream ss;
ss << "You see " << thing->getDescription(lookDistance);
player->sendTextMessage(MSG_INFO_DESCR, ss.str());
player->resetIdleTime();
return true;
}
Last edited: