bool Game::playerRequestAddVip(uint32_t playerId, const std::string& vipName)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;
uint32_t guid;
bool specialVip;
std::string name = vipName;
if(!IOLoginData::getInstance()->getGuidByNameEx(guid, specialVip, name))
{
player->sendTextMessage(MSG_STATUS_SMALL, "A player with that name does not exist.");
return false;
}
if(specialVip && !player->hasFlag(PlayerFlag_SpecialVIP))
{
player->sendTextMessage(MSG_STATUS_SMALL, "You cannot add this player.");
return false;
}
if(player->hasCondition(CONDITION_EXHAUST, 1))
{
player->sendTextMessage(MSG_STATUS_SMALL, "Please wait few seconds before adding new player to your vip list.");
return false;
}
bool online = false;
if(Player* target = getPlayerByName(name))
online = player->canSeeCreature(target);
if(Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EXHAUST, 3000, 0, false, 1))
player->addCondition(condition);
return player->addVIP(guid, name, online);
}
bool Game::playerRequestRemoveVip(uint32_t playerId, uint32_t guid)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;
if(player->hasCondition(CONDITION_EXHAUST, 1))
{
player->sendTextMessage(MSG_STATUS_SMALL, "Please wait few seconds before deleting next player from your vip list.");
return false;
}
if(Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EXHAUST, 3000, 0, false, 1))
player->addCondition(condition);
player->removeVIP(guid);
return true;
}