well.. I was bored so I made it, but on 1.2. Maybe someone will use it. Most of the changes are commented, explaining why they were introduced.
combat.cpp
find and remove/comment commented lines
Code:
//if (attacker->getSkull() == SKULL_BLACK && attacker->getSkullClient(target) == SKULL_NONE) {
// return true;
//} comm0 edit: Remove Black skull cant atk player without skull
Code:
if ((damage.primary.value < 0 || damage.secondary.value < 0) && caster) {
Player* targetPlayer = target->getPlayer();
if (targetPlayer && caster->getPlayer()){ // && targetPlayer->getSkull() != SKULL_BLACK) { comm0 edit: remove black skull takes full dmg
damage.primary.value /= 2;
damage.secondary.value /= 2;
}
}
configmanager.cpp
find those
Code:
[...]
integer[STAIRHOP_DELAY] = getGlobalNumber(L, "stairJumpExhaustion", 2000);
integer[EXP_FROM_PLAYERS_LEVEL_RANGE] = getGlobalNumber(L, "expFromPlayersLevelRange", 75);
integer[MAX_PACKETS_PER_SECOND] = getGlobalNumber(L, "maxPacketsPerSecond", 25);
[...] rest of the code
and add below
Code:
//comm0 edit: config variables:
integer[KILLS_BLACK] = getGlobalNumber(L, "killsBlack", 5);
integer[KILLS_RED] = getGlobalNumber(L, "killsRed", 4);
integer[KILLS_YELLOW] = getGlobalNumber(L, "killsYellow", 3);
integer[KILLS_GREEN] = getGlobalNumber(L, "killsGreen", 2);
configmanager.h
find
enum integer_config_t
and replace its content with:
Code:
enum integer_config_t {
SQL_PORT,
MAX_PLAYERS,
PZ_LOCKED,
DEFAULT_DESPAWNRANGE,
DEFAULT_DESPAWNRADIUS,
RATE_EXPERIENCE,
RATE_SKILL,
RATE_LOOT,
RATE_MAGIC,
RATE_SPAWN,
HOUSE_PRICE,
KILLS_TO_RED,
KILLS_TO_BLACK,
MAX_MESSAGEBUFFER,
ACTIONS_DELAY_INTERVAL,
EX_ACTIONS_DELAY_INTERVAL,
KICK_AFTER_MINUTES,
PROTECTION_LEVEL,
DEATH_LOSE_PERCENT,
STATUSQUERY_TIMEOUT,
FRAG_TIME,
WHITE_SKULL_TIME,
GAME_PORT,
LOGIN_PORT,
STATUS_PORT,
STAIRHOP_DELAY,
EXP_FROM_PLAYERS_LEVEL_RANGE,
MAX_PACKETS_PER_SECOND,
//comm0 edit:
KILLS_BLACK,
KILLS_RED,
KILLS_YELLOW,
KILLS_GREEN,
LAST_INTEGER_CONFIG /* this must be the last one */
};
game.cpp
find those and then comment/remove commented lines:
Code:
//if (attackerPlayer && targetPlayer && attackerPlayer->getSkull() == SKULL_BLACK && attackerPlayer->getSkullClient(targetPlayer) == SKULL_NONE) {
// return false;
//} comm0 edit: black skull can atk
Code:
//if (attackerPlayer && targetPlayer && attackerPlayer->getSkull() == SKULL_BLACK && attackerPlayer->getSkullClient(targetPlayer) == SKULL_NONE) {
// return false;
//} comm0 edit: black skull can atk
Code:
if (manaChange > 0) {
if (attacker) {
const Player* attackerPlayer = attacker->getPlayer();
//if (attackerPlayer && attackerPlayer->getSkull() == SKULL_BLACK && target->getPlayer() && attackerPlayer->getSkullClient(target) == SKULL_NONE) {
// return false;
//} comm0 edit: black skull can atk
}
Code:
Player* targetPlayer = target->getPlayer();
//if (attackerPlayer && targetPlayer && attackerPlayer->getSkull() == SKULL_BLACK && attackerPlayer->getSkullClient(targetPlayer) == SKULL_NONE) {
// return false;
//} comm0 edit: black skull can atk
iologindata.cpp
find this part in loadplayer function
Code:
if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
const time_t skullSeconds = result->getNumber<time_t>("skulltime") - time(nullptr);
if (skullSeconds > 0) {
//ensure that we round up the number of ticks
player->skullTicks = (skullSeconds + 2) * 1000;
uint16_t skull = result->getNumber<uint16_t>("skull");
if (skull == SKULL_RED) {
player->skull = SKULL_RED;
} else if (skull == SKULL_BLACK) {
player->skull = SKULL_BLACK;
}
}
}
and replace with this
Code:
if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
const time_t skullSeconds = result->getNumber<time_t>("skulltime") - time(nullptr);
if (skullSeconds > 0) {
//ensure that we round up the number of ticks
player->skullTicks = (skullSeconds + 2) * 1000;
uint16_t skull = result->getNumber<uint16_t>("skull");
if (skull == SKULL_RED) {
player->skull = SKULL_RED;
} else if (skull == SKULL_BLACK) {
player->skull = SKULL_BLACK;
}
//comm0 edit: save/load all skulls in database
else if (skull == SKULL_WHITE) {
player->skull = SKULL_WHITE;
}
else if (skull == SKULL_GREEN) {
player->skull = SKULL_GREEN;
}
else if (skull == SKULL_YELLOW) {
player->skull = SKULL_YELLOW;
}
}
}
then in savePlayer method
find:
Code:
if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
int32_t skullTime = 0;
if (player->skullTicks > 0) {
skullTime = time(nullptr) + player->skullTicks / 1000;
}
query << "`skulltime` = " << skullTime << ',';
Skulls_t skull = SKULL_NONE;
if (player->skull == SKULL_RED) {
skull = SKULL_RED;
} else if (player->skull == SKULL_BLACK) {
skull = SKULL_BLACK;
}
query << "`skull` = " << static_cast<uint32_t>(skull) << ',';
}
replace with
Code:
if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
int32_t skullTime = 0;
if (player->skullTicks > 0) {
skullTime = time(nullptr) + player->skullTicks / 1000;
}
query << "`skulltime` = " << skullTime << ',';
Skulls_t skull = SKULL_NONE;
if (player->skull == SKULL_RED) {
skull = SKULL_RED;
} else if (player->skull == SKULL_BLACK) {
skull = SKULL_BLACK;
}
//comm0 edit: save/load all skulls in database
else if (player->skull == SKULL_WHITE) {
skull = SKULL_WHITE;
}
else if (player->skull == SKULL_GREEN) {
skull = SKULL_GREEN;
}
else if (player->skull == SKULL_YELLOW) {
skull = SKULL_YELLOW;
}
query << "`skull` = " << static_cast<uint32_t>(skull) << ',';
}
now, we remove the skulls in party.
in party.cpp
remove/comment those lines
Code:
//currentLeader->sendCreatureSkull(currentLeader); //comm0 edit: remove party skull
Code:
//member->sendCreatureSkull(currentLeader); comm0 edit: remove party skull
//currentLeader->sendCreatureSkull(member); comm0 edit: remove party skull
Code:
for (Player* member : memberList) {
//member->sendCreatureSkull(player); comm0 edit: remove party skull
player->sendPlayerPartyIcons(member);
}
//leader->sendCreatureSkull(player); comm0 edit: remove party skull
//player->sendCreatureSkull(player); comm0 edit: remove party skull
player->sendPlayerPartyIcons(leader);
Code:
for (Player* member : memberList) {
//member->sendCreatureSkull(&player); comm0 edit: remove party skull
player.sendPlayerPartyIcons(member);
}
//player.sendCreatureSkull(&player); comm0 edit: remove party skull
//leader->sendCreatureSkull(&player); comm0 edit: remove party skull
player.sendPlayerPartyIcons(leader);
Code:
if (memberList.empty() && inviteList.empty()) {
ss << " Open the party channel to communicate with your members.";
g_game.updatePlayerShield(leader);
//leader->sendCreatureSkull(leader); comm0 edit: remove party skull
}
Then in
player.cpp
Code:
//if (getSkull() == SKULL_BLACK) {
// health = 40;
// mana = 0;
//comm0 edit: full hp/mana after ded even with black skull
//}else {
health = healthMax;
mana = manaMax;
//}
Code:
void Player::onEndCondition(ConditionType_t type)
{
Creature::onEndCondition(type);
if (type == CONDITION_INFIGHT) {
onIdleStatus();
pzLocked = false;
clearAttacked();
//if (getSkull() != SKULL_RED && getSkull() != SKULL_BLACK) {
// setSkull(SKULL_NONE);
//} comm0 edit: dont clear the skull after battle ends
}
sendIcons();
}
Code:
if (getSkull() == SKULL_NONE && getSkullClient(targetPlayer) == SKULL_YELLOW) {
//addAttacked(targetPlayer);
//targetPlayer->sendCreatureSkull(this); comm0 edit: remove attack yellow skull event
} else if (!targetPlayer->hasAttacked(this)) {
if (!pzLocked) {
pzLocked = true;
sendIcons();
}
Code:
Skulls_t Player::getSkullClient(const Creature* creature) const
{
if (!creature || g_game.getWorldType() != WORLD_TYPE_PVP) {
return SKULL_NONE;
}
const Player* player = creature->getPlayer();
if (player && player->getSkull() == SKULL_NONE) {
if (isInWar(player)) {
return SKULL_GREEN;
}
if (!player->getGuildWarList().empty() && guild == player->getGuild()) {
return SKULL_GREEN;
}
/*if (player->hasAttacked(this)) {
return SKULL_YELLOW;
}
comm0 edit: remove yellow/green skull events
if (isPartner(player)) {
return SKULL_GREEN;
}*/
}
return Creature::getSkullClient(creature);
}
now replace whole void Player::addUnjustifiedDead(const Player* attacked) method with that:
Code:
void Player::addUnjustifiedDead(const Player* attacked)
{
if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
return;
}
sendTextMessage(MESSAGE_EVENT_ADVANCE, "Warning! The murder of " + attacked->getName() + " was not justified.");
skullTicks += g_config.getNumber(ConfigManager::FRAG_TIME);
//comm0 edit: edited set skull function
int killsYellow = static_cast<int64_t>(g_config.getNumber(ConfigManager::KILLS_YELLOW));
int killsGreen = static_cast<int64_t>(g_config.getNumber(ConfigManager::KILLS_GREEN));
int killsRed = static_cast<int64_t>(g_config.getNumber(ConfigManager::KILLS_RED));
int killsBlack = static_cast<int64_t>(g_config.getNumber(ConfigManager::KILLS_BLACK));
if (getSkull() != SKULL_BLACK)
{
if (skullTicks > ((killsBlack - 1) * static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))))
{
setSkull(SKULL_BLACK);
}
else if (getSkull() != SKULL_RED && skullTicks > (killsRed-1) * static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME)))
{
setSkull(SKULL_RED);
}
else if (getSkull() != SKULL_GREEN && skullTicks > (killsGreen - 1) * static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME)))
{
setSkull(SKULL_GREEN);
}
else if (getSkull() != SKULL_YELLOW && skullTicks > (killsYellow - 1) * static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME)))
{
setSkull(SKULL_YELLOW);
}
}
}
and void Player::checkSkullTicks(int32_t ticks) method with that:
Code:
void Player::checkSkullTicks(int32_t ticks)
{
int32_t newTicks = skullTicks - ticks;
if (newTicks < 0) {
skullTicks = 0;
} else {
skullTicks = newTicks;
}
//comm0 edit
if ((skull == SKULL_RED || skull == SKULL_BLACK || skull == SKULL_GREEN || skull == SKULL_YELLOW ) && skullTicks < 1000 && !hasCondition(CONDITION_INFIGHT)) {
setSkull(SKULL_NONE);
}
}
also comment/remove that line
Code:
void Player::sendPlayerPartyIcons(Player* player)
{
sendCreatureShield(player);
//sendCreatureSkull(player); comm0 edit: no party skulls
}
Then in config.lua we can add:
Code:
killsYellow = 3
killsGreen = 4
killsRed = 5
killsBlack = 6
In this case, after 3 kills, player receives yellow skull, then after 4th kill receives green etc.
Skull duration = frag_time x frags
Works only on pvp world.
I haven't test it on war mode, better dont use war with this.