mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-05-02 10:39:20 +02:00
introduce uh trap, never break spear, and config fixes for new server
This commit is contained in:
parent
4644388a6d
commit
afc483cc35
32
config.lua
32
config.lua
@ -1,34 +1,38 @@
|
|||||||
-- Custom
|
-- Custom
|
||||||
clientVersion = 792
|
clientVersion = 792
|
||||||
knightCloseAttackDamageIncreasePercent = 20
|
knightCloseAttackDamageIncreasePercent = 10
|
||||||
paladinRangeAttackDamageIncreasePercent = 15
|
paladinRangeAttackDamageIncreasePercent = 10
|
||||||
-- Min/Max rate spawn is a multiplication of the map spawntime in spawns.xml Regular monster spawn time is 600. The formula would be randomValue = random(600*100, 600*200) which varies between 60s and 120s
|
-- Min/Max rate spawn is a multiplication of the map spawntime in spawns.xml Regular monster spawn time is 600. The formula would be randomValue = random(600*100, 600*200) which varies between 60s and 120s
|
||||||
minRateSpawn = 100
|
minRateSpawn = 100
|
||||||
maxRateSpawn = 200
|
maxRateSpawn = 200
|
||||||
corpseOwnerEnabled = false
|
corpseOwnerEnabled = false
|
||||||
|
uhTrap = true
|
||||||
|
showMonsterLoot = true
|
||||||
|
blockHeight = true
|
||||||
|
dropItems = false
|
||||||
|
|
||||||
-- Combat settings
|
-- Combat settings
|
||||||
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
|
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
|
||||||
worldType = "pvp"
|
worldType = "pvp"
|
||||||
hotkeyAimbotEnabled = true
|
hotkeyAimbotEnabled = false
|
||||||
protectionLevel = 1
|
protectionLevel = 1
|
||||||
pzLocked = 60000
|
pzLocked = 60000
|
||||||
removeChargesFromRunes = true
|
removeChargesFromRunes = true
|
||||||
stairJumpExhaustion = 0
|
stairJumpExhaustion = 0
|
||||||
experienceByKillingPlayers = false
|
experienceByKillingPlayers = true
|
||||||
expFromPlayersLevelRange = 75
|
expFromPlayersLevelRange = 50
|
||||||
distanceWeaponsDropOnGround = false
|
distanceWeaponsDropOnGround = true
|
||||||
|
|
||||||
-- Skull System
|
-- Skull System
|
||||||
banLength = 2 * 24 * 60 * 60
|
banLength = 2 * 24 * 60 * 60
|
||||||
whiteSkullTime = 15 * 60
|
whiteSkullTime = 15 * 60
|
||||||
redSkullTime = 7 * 24 * 60 * 60
|
redSkullTime = 7 * 24 * 60 * 60
|
||||||
killsDayRedSkull = 3
|
killsDayRedSkull = 4
|
||||||
killsWeekRedSkull = 6
|
killsWeekRedSkull = 12
|
||||||
killsMonthRedSkull = 99999
|
killsMonthRedSkull = 35
|
||||||
killsDayBanishment = 1
|
killsDayBanishment = 7
|
||||||
killsWeekBanishment = 12
|
killsWeekBanishment = 18
|
||||||
killsMonthBanishment = 99999
|
killsMonthBanishment = 60
|
||||||
|
|
||||||
-- Connection Config
|
-- Connection Config
|
||||||
-- NOTE: maxPlayers set to 0 means no limit
|
-- NOTE: maxPlayers set to 0 means no limit
|
||||||
@ -79,10 +83,6 @@ allowChangeOutfit = true
|
|||||||
freePremium = true
|
freePremium = true
|
||||||
kickIdlePlayerAfterMinutes = 15
|
kickIdlePlayerAfterMinutes = 15
|
||||||
maxMessageBuffer = 8
|
maxMessageBuffer = 8
|
||||||
showMonsterLoot = true
|
|
||||||
blockHeight = false
|
|
||||||
dropItems = false
|
|
||||||
|
|
||||||
|
|
||||||
-- Character Rooking
|
-- Character Rooking
|
||||||
-- Level threshold is the level requirement to teleport players back to newbie town
|
-- Level threshold is the level requirement to teleport players back to newbie town
|
||||||
|
@ -35,6 +35,18 @@ function onUse(player, item, fromPosition, target, toPosition)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (configManager.getBoolean(configKeys.UH_TRAP)) then
|
||||||
|
local tile = Tile(toPosition)
|
||||||
|
local creature = tile:getBottomCreature()
|
||||||
|
if creature and creature:isPlayer() then
|
||||||
|
target = creature
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- monsters do not use mana also I do not know if you can use life fluid on monsters
|
||||||
|
-- if you can just want to use life fluids on monster then change isPlayer to isCreature
|
||||||
|
target = target:isPlayer() and target
|
||||||
|
end
|
||||||
|
|
||||||
if target:isCreature() and target:getPlayer() ~= nil then
|
if target:isCreature() and target:getPlayer() ~= nil then
|
||||||
if item:getFluidType() == FLUID_NONE then
|
if item:getFluidType() == FLUID_NONE then
|
||||||
player:sendCancelMessage("It is empty.")
|
player:sendCancelMessage("It is empty.")
|
||||||
|
@ -14802,7 +14802,7 @@ Attributes = {Weight=3500,WeaponType=AXE,Attack=15,Defense=8}
|
|||||||
TypeID = 3277
|
TypeID = 3277
|
||||||
Name = "a spear"
|
Name = "a spear"
|
||||||
Flags = {Cumulative,Take,Distance}
|
Flags = {Cumulative,Take,Distance}
|
||||||
Attributes = {Weight=2000,Range=7,Attack=25,Defense=0,MissileEffect=1,Fragility=3}
|
Attributes = {Weight=2000,Range=7,Attack=25,Defense=0,MissileEffect=1}
|
||||||
|
|
||||||
TypeID = 3278
|
TypeID = 3278
|
||||||
Name = "a magic longsword"
|
Name = "a magic longsword"
|
||||||
|
@ -80,6 +80,7 @@ bool ConfigManager::load()
|
|||||||
boolean[TELEPORT_NEWBIES] = getGlobalBoolean(L, "teleportNewbies", true);
|
boolean[TELEPORT_NEWBIES] = getGlobalBoolean(L, "teleportNewbies", true);
|
||||||
boolean[STACK_CUMULATIVES] = getGlobalBoolean(L, "autoStackCumulatives", false);
|
boolean[STACK_CUMULATIVES] = getGlobalBoolean(L, "autoStackCumulatives", false);
|
||||||
boolean[BLOCK_HEIGHT] = getGlobalBoolean(L, "blockHeight", false);
|
boolean[BLOCK_HEIGHT] = getGlobalBoolean(L, "blockHeight", false);
|
||||||
|
boolean[UH_TRAP] = getGlobalBoolean(L, "uhTrap", false);
|
||||||
boolean[DROP_ITEMS] = getGlobalBoolean(L, "dropItems", false);
|
boolean[DROP_ITEMS] = getGlobalBoolean(L, "dropItems", false);
|
||||||
boolean[DISTANCE_WEAPONS_DROP_ON_GROUND] = getGlobalBoolean(L, "distanceWeaponsDropOnGround", true);
|
boolean[DISTANCE_WEAPONS_DROP_ON_GROUND] = getGlobalBoolean(L, "distanceWeaponsDropOnGround", true);
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ class ConfigManager
|
|||||||
TELEPORT_NEWBIES,
|
TELEPORT_NEWBIES,
|
||||||
STACK_CUMULATIVES,
|
STACK_CUMULATIVES,
|
||||||
BLOCK_HEIGHT,
|
BLOCK_HEIGHT,
|
||||||
|
UH_TRAP,
|
||||||
DROP_ITEMS,
|
DROP_ITEMS,
|
||||||
DISTANCE_WEAPONS_DROP_ON_GROUND,
|
DISTANCE_WEAPONS_DROP_ON_GROUND,
|
||||||
CORPSE_OWNER_ENABLED,
|
CORPSE_OWNER_ENABLED,
|
||||||
|
15
src/game.cpp
15
src/game.cpp
@ -223,7 +223,12 @@ Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index
|
|||||||
if (item && item->isMoveable()) {
|
if (item && item->isMoveable()) {
|
||||||
thing = item;
|
thing = item;
|
||||||
} else {
|
} else {
|
||||||
thing = tile->getTopVisibleCreature(player);
|
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||||
|
thing = tile->getBottomVisibleCreatureUH(player);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
thing = tile->getTopVisibleCreature(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -239,9 +244,11 @@ Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index
|
|||||||
}
|
}
|
||||||
|
|
||||||
case STACKPOS_USETARGET: {
|
case STACKPOS_USETARGET: {
|
||||||
thing = tile->getTopVisibleCreature(player);
|
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||||
if (!thing) {
|
thing = tile->getBottomCreatureUH();
|
||||||
thing = tile->getUseItem(index);
|
}
|
||||||
|
else {
|
||||||
|
thing = tile->getTopCreature();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1690,6 +1690,7 @@ void LuaScriptInterface::registerFunctions()
|
|||||||
registerEnumIn("configKeys", ConfigManager::NEWBIE_TOWN)
|
registerEnumIn("configKeys", ConfigManager::NEWBIE_TOWN)
|
||||||
registerEnumIn("configKeys", ConfigManager::NEWBIE_LEVEL_THRESHOLD)
|
registerEnumIn("configKeys", ConfigManager::NEWBIE_LEVEL_THRESHOLD)
|
||||||
registerEnumIn("configKeys", ConfigManager::BLOCK_HEIGHT)
|
registerEnumIn("configKeys", ConfigManager::BLOCK_HEIGHT)
|
||||||
|
registerEnumIn("configKeys", ConfigManager::UH_TRAP)
|
||||||
registerEnumIn("configKeys", ConfigManager::DROP_ITEMS)
|
registerEnumIn("configKeys", ConfigManager::DROP_ITEMS)
|
||||||
registerEnumIn("configKeys", ConfigManager::CLIENT_VERSION)
|
registerEnumIn("configKeys", ConfigManager::CLIENT_VERSION)
|
||||||
|
|
||||||
|
@ -689,6 +689,9 @@ bool Spell::playerRuneSpellCheck(Player* player, const Position& toPos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Creature* visibleCreature = tile->getTopCreature();
|
const Creature* visibleCreature = tile->getTopCreature();
|
||||||
|
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||||
|
visibleCreature = tile->getBottomCreature();
|
||||||
|
}
|
||||||
if (blockingCreature && visibleCreature) {
|
if (blockingCreature && visibleCreature) {
|
||||||
player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
|
player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
|
||||||
g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
|
g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
|
||||||
@ -1819,6 +1822,9 @@ bool RuneSpell::executeUse(Player* player, Item* item, const Position&, Thing* t
|
|||||||
Tile* toTile = g_game.map.getTile(toPosition);
|
Tile* toTile = g_game.map.getTile(toPosition);
|
||||||
if (toTile) {
|
if (toTile) {
|
||||||
const Creature* visibleCreature = toTile->getTopCreature();
|
const Creature* visibleCreature = toTile->getTopCreature();
|
||||||
|
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||||
|
visibleCreature = toTile->getBottomCreature();
|
||||||
|
}
|
||||||
if (visibleCreature) {
|
if (visibleCreature) {
|
||||||
var.number = visibleCreature->getID();
|
var.number = visibleCreature->getID();
|
||||||
}
|
}
|
||||||
|
39
src/tile.cpp
39
src/tile.cpp
@ -263,6 +263,16 @@ Creature* Tile::getTopCreature() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Creature* Tile::getBottomCreatureUH() const
|
||||||
|
{
|
||||||
|
if (const CreatureVector* creatures = getCreatures()) {
|
||||||
|
if (!creatures->empty()) {
|
||||||
|
return *creatures->rbegin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const Creature* Tile::getBottomCreature() const
|
const Creature* Tile::getBottomCreature() const
|
||||||
{
|
{
|
||||||
if (const CreatureVector* creatures = getCreatures()) {
|
if (const CreatureVector* creatures = getCreatures()) {
|
||||||
@ -301,6 +311,35 @@ Creature* Tile::getTopVisibleCreature(const Creature* creature) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Creature* Tile::getBottomVisibleCreatureUH(const Creature* creature) const
|
||||||
|
{
|
||||||
|
if (const CreatureVector* creatures = getCreatures()) {
|
||||||
|
if (creature) {
|
||||||
|
const Player* player = creature->getPlayer();
|
||||||
|
if (player && player->isAccessPlayer()) {
|
||||||
|
return getBottomCreatureUH();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it = creatures->rbegin(), end = creatures->rend(); it != end; ++it) {
|
||||||
|
if (creature->canSeeCreature(*it)) {
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (auto it = creatures->rbegin(), end = creatures->rend(); it != end; ++it) {
|
||||||
|
if (!(*it)->isInvisible()) {
|
||||||
|
const Player* player = (*it)->getPlayer();
|
||||||
|
if (!player || !player->isInGhostMode()) {
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const Creature* Tile::getBottomVisibleCreature(const Creature* creature) const
|
const Creature* Tile::getBottomVisibleCreature(const Creature* creature) const
|
||||||
{
|
{
|
||||||
if (const CreatureVector* creatures = getCreatures()) {
|
if (const CreatureVector* creatures = getCreatures()) {
|
||||||
|
@ -174,8 +174,10 @@ class Tile : public Cylinder
|
|||||||
BedItem* getBedItem() const;
|
BedItem* getBedItem() const;
|
||||||
|
|
||||||
Creature* getTopCreature() const;
|
Creature* getTopCreature() const;
|
||||||
|
Creature* getBottomCreatureUH() const;
|
||||||
const Creature* getBottomCreature() const;
|
const Creature* getBottomCreature() const;
|
||||||
Creature* getTopVisibleCreature(const Creature* creature) const;
|
Creature* getTopVisibleCreature(const Creature* creature) const;
|
||||||
|
Creature* getBottomVisibleCreatureUH(const Creature* creature) const;
|
||||||
const Creature* getBottomVisibleCreature(const Creature* creature) const;
|
const Creature* getBottomVisibleCreature(const Creature* creature) const;
|
||||||
Item* getTopTopItem() const;
|
Item* getTopTopItem() const;
|
||||||
Item* getTopDownItem() const;
|
Item* getTopDownItem() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user