Hello,
I have problem - when I use any item on house door then I see message: "you are not invited".
RET_PLAYERISNOTINVITED is responsible for this message and it occurs there:
actions.cpp
game.cpp
game.cpp
housetile.cpp
housetile.cpp
map.cpp
Does anyone have any idea what should be changed? Code in actions.cpp?
BG
I have problem - when I use any item on house door then I see message: "you are not invited".
RET_PLAYERISNOTINVITED is responsible for this message and it occurs there:
actions.cpp
Code:
ReturnValue Actions::canUse(const Player* player, const Position& pos)
{
(...)
Tile* tile = g_game.getTile(pos);
if(tile)
{
HouseTile* houseTile = tile->getHouseTile();
if(houseTile && houseTile->getHouse() && !houseTile->getHouse()->isInvited(player))
return RET_PLAYERISNOTINVITED;
}
return RET_NOERROR;
}
game.cpp
Code:
bool Game::playerRequestTrade(uint32_t playerId, const Position& pos, int16_t stackpos,
uint32_t tradePlayerId, uint16_t spriteId)
{
(...)
HouseTile* houseTile = dynamic_cast<HouseTile*>(tradeItem->getParent());
if(houseTile && houseTile->getHouse() && !houseTile->getHouse()->isInvited(player))
{
player->sendCancelMessage(RET_PLAYERISNOTINVITED);
return false;
}
}
game.cpp
Code:
Position Game::getClosestFreeTile(Creature* creature, Position pos, bool extended/* = false*/, bool ignoreHouse/* = true*/)
(...)
std::random_shuffle(relList.begin() + 1, relList.end());
if(Player* player = creature->getPlayer())
{
for(PairVector::iterator it = relList.begin(); it != relList.end(); ++it)
{
Tile* tile = map->getTile(Position((pos.x + it->first), (pos.y + it->second), pos.z));
if(!tile || !tile->ground)
continue;
ReturnValue ret = tile->__queryAdd(0, player, 1, FLAG_IGNOREBLOCKITEM);
if(ret == RET_NOTENOUGHROOM || (ret == RET_NOTPOSSIBLE && !player->hasCustomFlag(
PlayerCustomFlag_CanMoveAnywhere)) || (ret == RET_PLAYERISNOTINVITED && !ignoreHouse))
continue;
return tile->getPosition();
}
}
housetile.cpp
Code:
ReturnValue HouseTile::__queryAdd(int32_t index, const Thing* thing, uint32_t count, uint32_t flags, Creature* actor/* = NULL*/) const
{
if(const Creature* creature = thing->getCreature())
{
if(const Player* player = creature->getPlayer())
{
if(!house->isInvited(player) && !player->hasCustomFlag(PlayerCustomFlag_CanMoveAnywhere))
return RET_PLAYERISNOTINVITED;
}
else
return RET_NOTPOSSIBLE;
}
else if(thing->getItem())
{
const uint32_t itemLimit = g_config.getNumber(ConfigManager::HOUSE_TILE_LIMIT);
if(itemLimit && getItemCount() > itemLimit)
return RET_TILEISFULL;
if(actor && g_config.getBool(ConfigManager::HOUSE_PROTECTION))
{
if(const Player* player = actor->getPlayer())
{
if(!house->isInvited(player) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere))
return RET_PLAYERISNOTINVITED;
}
}
}
return Tile::__queryAdd(index, thing, count, flags, actor);
}
housetile.cpp
Code:
ReturnValue HouseTile::__queryRemove(const Thing* thing, uint32_t count, uint32_t flags, Creature* actor/* = NULL*/) const
{
if(thing->getItem() && actor && g_config.getBool(ConfigManager::HOUSE_PROTECTION))
{
if(const Player* player = actor->getPlayer())
{
if(!house->isInvited(player) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere))
return RET_PLAYERISNOTINVITED;
}
}
return Tile::__queryRemove(thing, count, flags, actor);
}
map.cpp
Code:
bool Map::placeCreature(const Position& centerPos, Creature* creature, bool extendedPos /*= false*/, bool forced /*= false*/)
{
bool foundTile = false, placeInPz = false;
Tile* tile = getTile(centerPos);
if(tile && !extendedPos)
{
placeInPz = tile->hasFlag(TILESTATE_PROTECTIONZONE);
uint32_t flags = FLAG_IGNOREBLOCKITEM;
if(creature->isAccountManager())
flags |= FLAG_IGNOREBLOCKCREATURE;
ReturnValue ret = tile->__queryAdd(0, creature, 1, flags);
if(forced || ret == RET_NOERROR || ret == RET_PLAYERISNOTINVITED)
foundTile = true;
}
(...)
Does anyone have any idea what should be changed? Code in actions.cpp?
BG