- Joined
- Jan 15, 2014
- Messages
- 1,317
- Solutions
- 35
- Reaction score
- 434
Hello,
I changed a part of the source to allow players to kill players below the protection level as long as they were standing on a PVP_ZONE tile:
Original:
Changed:
It seems to be working fine but I'm new to making source changes. Is what I did safe? Or is their a better way to do/write it?
I changed a part of the source to allow players to kill players below the protection level as long as they were standing on a PVP_ZONE tile:
Original:
Code:
bool Combat::isProtected(const Player* attacker, const Player* target)
{
uint32_t protectionLevel = g_config.getNumber(ConfigManager::PROTECTION_LEVEL);
if (target->getLevel() < protectionLevel || attacker->getLevel() < protectionLevel) {
return true;
}
if (attacker->getVocationId() == VOCATION_NONE || target->getVocationId() == VOCATION_NONE) {
return true;
}
if (attacker->getSkull() == SKULL_BLACK && attacker->getSkullClient(target) == SKULL_NONE) {
return true;
}
return false;
}
Changed:
Code:
bool Combat::isProtected(const Player* attacker, const Player* target)
{
uint32_t protectionLevel = g_config.getNumber(ConfigManager::PROTECTION_LEVEL);
if ((target->getZone() != ZONE_PVP || attacker->getZone() != ZONE_PVP) && (target->getLevel() < protectionLevel || attacker->getLevel() < protectionLevel)) {
return true;
}
if (attacker->getVocationId() == VOCATION_NONE || target->getVocationId() == VOCATION_NONE) {
return true;
}
if (attacker->getSkull() == SKULL_BLACK && attacker->getSkullClient(target) == SKULL_NONE) {
return true;
}
return false;
}
It seems to be working fine but I'm new to making source changes. Is what I did safe? Or is their a better way to do/write it?