bitoca1995
akona-world.servegame.com
- Joined
- Dec 1, 2009
- Messages
- 97
- Reaction score
- 1
I have a doubt..
my current source does not have timetodecreasefrag, I wanted to put the time for each frag to disappear for 2 hours, in case the person takes a frag, that he quit in 2 hours, would that part of the player and ionlogindata?
ionlogindata:
i changed to 2 * 3600, its correct?
and player.cpp:
my current source does not have timetodecreasefrag, I wanted to put the time for each frag to disappear for 2 hours, in case the person takes a frag, that he quit in 2 hours, would that part of the player and ionlogindata?
ionlogindata:
C++:
bool IOLoginData::getUnjustifiedDates(uint32_t guid, std::vector<time_t>& dateList, time_t _time)
{
Database* db = Database::getInstance();
DBQuery query;
query << "SELECT `pd`.`date` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id`"
<< "LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` WHERE `pk`.`player_id` = " << guid
<< " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " << (_time - (2 * 3600)) << " AND `k`.`war` = 0";
DBResult* result;
if(!(result = db->storeQuery(query.str())))
return false;
do
dateList.push_back((time_t)result->getDataInt("date"));
while(result->next());
result->free();
return true;
}
i changed to 2 * 3600, its correct?
and player.cpp:
C++:
bool Player::addUnjustifiedKill(const Player* attacked, bool countNow)
{
if(!g_config.getBool(ConfigManager::USE_FRAG_HANDLER) || hasFlag(
PlayerFlag_NotGainInFight) || g_game.getWorldType() != WORLDTYPE_OPEN
|| hasCustomFlag(PlayerCustomFlag_NotGainUnjustified) || hasCustomFlag(
PlayerCustomFlag_NotGainSkull) || attacked == this)
return false;
if(client && countNow)
{
char buffer[90];
sprintf(buffer, "Warning! The murder of %s was not justified.",
attacked->getName().c_str());
client->sendTextMessage(MSG_STATUS_WARNING, buffer);
}
time_t now = time(NULL), today = (now - 84600), week = (now - (7 * 84600));
std::vector<time_t> dateList;
IOLoginData::getInstance()->getUnjustifiedDates(guid, dateList, now);
if(countNow)
dateList.push_back(now);
uint32_t tc = 0, wc = 0, mc = dateList.size();
for(std::vector<time_t>::iterator it = dateList.begin(); it != dateList.end(); ++it)
{
if((*it) > week)
wc++;
if((*it) > today)
tc++;
}
uint32_t d = g_config.getNumber(ConfigManager::RED_DAILY_LIMIT), w = g_config.getNumber(
ConfigManager::RED_WEEKLY_LIMIT), m = g_config.getNumber(ConfigManager::RED_MONTHLY_LIMIT);
if(skull < SKULL_RED && ((d > 0 && tc >= d) || (w > 0 && wc >= w) || (m > 0 && mc >= m)))
setSkullEnd(now + g_config.getNumber(ConfigManager::RED_SKULL_LENGTH), false, SKULL_RED);
if(!g_config.getBool(ConfigManager::USE_BLACK_SKULL))
{
d += g_config.getNumber(ConfigManager::BAN_DAILY_LIMIT);
w += g_config.getNumber(ConfigManager::BAN_WEEKLY_LIMIT);
m += g_config.getNumber(ConfigManager::BAN_MONTHLY_LIMIT);
if((d <= 0 || tc < d) && (w <= 0 || wc < w) && (m <= 0 || mc < m))
return true;
if(!IOBan::getInstance()->addAccountBanishment(accountId, (now + g_config.getNumber(
ConfigManager::KILLS_BAN_LENGTH)), 20, ACTION_BANISHMENT, "Unjustified player killing.", 0, guid))
return true;
sendTextMessage(MSG_INFO_DESCR, "You have been banished.");
g_game.addMagicEffect(getPosition(), MAGIC_EFFECT_WRAPS_GREEN);
Scheduler::getInstance().addEvent(createSchedulerTask(1000, boost::bind(
&Game::kickPlayer, &g_game, getID(), false)));
}
else
{
d += g_config.getNumber(ConfigManager::BLACK_DAILY_LIMIT);
w += g_config.getNumber(ConfigManager::BLACK_WEEKLY_LIMIT);
m += g_config.getNumber(ConfigManager::BLACK_MONTHLY_LIMIT);
if(skull < SKULL_BLACK && ((d > 0 && tc >= d) || (w > 0 && wc >= w) || (m > 0 && mc >= m)))
{
setSkullEnd(now + g_config.getNumber(ConfigManager::BLACK_SKULL_LENGTH), false, SKULL_BLACK);
setAttackedCreature(NULL);
destroySummons();
}
}
return true;
}