Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Player::canWalkthrough(const Creature* creature) const
- {
- if(creature == this || hasFlag(PlayerFlag_CanPassThroughAllCreatures) || creature->isWalkable() ||
- std::find(forceWalkthrough.begin(), forceWalkthrough.end(), creature->getID()) != forceWalkthrough.end()
- || (creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
- return true;
- const Player* player = creature->getPlayer();
- if(!player)
- return false;
- if(((g_game.getWorldType() == WORLDTYPE_OPTIONAL && !player->isEnemy(this, true) &&
- !player->isProtected()) || player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) || player->isProtected()) && player->getTile()->ground
- && Item::items[player->getTile()->ground->getID()].walkStack && (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
- || player->getAccess() <= getAccess()))
- return true;
- return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
- || (isGhost() && getGhostAccess() > player->getGhostAccess());
- }
- void Player::setWalkthrough(const Creature* creature, bool walkthrough)
- {
- std::vector<uint32_t>::iterator it = std::find(forceWalkthrough.begin(),
- forceWalkthrough.end(), creature->getID());
- bool update = false;
- if(walkthrough && it == forceWalkthrough.end())
- {
- forceWalkthrough.push_back(creature->getID());
- update = true;
- }
- else if(!walkthrough && it != forceWalkthrough.end())
- {
- forceWalkthrough.erase(it);
- update = true;
- }
- if(update)
- sendCreatureWalkthrough(creature, !walkthrough ? canWalkthrough(creature) : walkthrough);
- }
Advertisement
Add Comment
Please, Sign In to add comment