mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-05-02 02:29:21 +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
|
||||
clientVersion = 792
|
||||
knightCloseAttackDamageIncreasePercent = 20
|
||||
paladinRangeAttackDamageIncreasePercent = 15
|
||||
knightCloseAttackDamageIncreasePercent = 10
|
||||
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
|
||||
minRateSpawn = 100
|
||||
maxRateSpawn = 200
|
||||
corpseOwnerEnabled = false
|
||||
uhTrap = true
|
||||
showMonsterLoot = true
|
||||
blockHeight = true
|
||||
dropItems = false
|
||||
|
||||
-- Combat settings
|
||||
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
|
||||
worldType = "pvp"
|
||||
hotkeyAimbotEnabled = true
|
||||
hotkeyAimbotEnabled = false
|
||||
protectionLevel = 1
|
||||
pzLocked = 60000
|
||||
removeChargesFromRunes = true
|
||||
stairJumpExhaustion = 0
|
||||
experienceByKillingPlayers = false
|
||||
expFromPlayersLevelRange = 75
|
||||
distanceWeaponsDropOnGround = false
|
||||
experienceByKillingPlayers = true
|
||||
expFromPlayersLevelRange = 50
|
||||
distanceWeaponsDropOnGround = true
|
||||
|
||||
-- Skull System
|
||||
banLength = 2 * 24 * 60 * 60
|
||||
whiteSkullTime = 15 * 60
|
||||
redSkullTime = 7 * 24 * 60 * 60
|
||||
killsDayRedSkull = 3
|
||||
killsWeekRedSkull = 6
|
||||
killsMonthRedSkull = 99999
|
||||
killsDayBanishment = 1
|
||||
killsWeekBanishment = 12
|
||||
killsMonthBanishment = 99999
|
||||
killsDayRedSkull = 4
|
||||
killsWeekRedSkull = 12
|
||||
killsMonthRedSkull = 35
|
||||
killsDayBanishment = 7
|
||||
killsWeekBanishment = 18
|
||||
killsMonthBanishment = 60
|
||||
|
||||
-- Connection Config
|
||||
-- NOTE: maxPlayers set to 0 means no limit
|
||||
@ -79,10 +83,6 @@ allowChangeOutfit = true
|
||||
freePremium = true
|
||||
kickIdlePlayerAfterMinutes = 15
|
||||
maxMessageBuffer = 8
|
||||
showMonsterLoot = true
|
||||
blockHeight = false
|
||||
dropItems = false
|
||||
|
||||
|
||||
-- Character Rooking
|
||||
-- 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
|
||||
|
||||
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 item:getFluidType() == FLUID_NONE then
|
||||
player:sendCancelMessage("It is empty.")
|
||||
|
@ -14802,7 +14802,7 @@ Attributes = {Weight=3500,WeaponType=AXE,Attack=15,Defense=8}
|
||||
TypeID = 3277
|
||||
Name = "a spear"
|
||||
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
|
||||
Name = "a magic longsword"
|
||||
|
@ -80,6 +80,7 @@ bool ConfigManager::load()
|
||||
boolean[TELEPORT_NEWBIES] = getGlobalBoolean(L, "teleportNewbies", true);
|
||||
boolean[STACK_CUMULATIVES] = getGlobalBoolean(L, "autoStackCumulatives", false);
|
||||
boolean[BLOCK_HEIGHT] = getGlobalBoolean(L, "blockHeight", false);
|
||||
boolean[UH_TRAP] = getGlobalBoolean(L, "uhTrap", false);
|
||||
boolean[DROP_ITEMS] = getGlobalBoolean(L, "dropItems", false);
|
||||
boolean[DISTANCE_WEAPONS_DROP_ON_GROUND] = getGlobalBoolean(L, "distanceWeaponsDropOnGround", true);
|
||||
|
||||
|
@ -47,6 +47,7 @@ class ConfigManager
|
||||
TELEPORT_NEWBIES,
|
||||
STACK_CUMULATIVES,
|
||||
BLOCK_HEIGHT,
|
||||
UH_TRAP,
|
||||
DROP_ITEMS,
|
||||
DISTANCE_WEAPONS_DROP_ON_GROUND,
|
||||
CORPSE_OWNER_ENABLED,
|
||||
|
13
src/game.cpp
13
src/game.cpp
@ -223,8 +223,13 @@ Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index
|
||||
if (item && item->isMoveable()) {
|
||||
thing = item;
|
||||
} else {
|
||||
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||
thing = tile->getBottomVisibleCreatureUH(player);
|
||||
}
|
||||
else {
|
||||
thing = tile->getTopVisibleCreature(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -239,9 +244,11 @@ Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index
|
||||
}
|
||||
|
||||
case STACKPOS_USETARGET: {
|
||||
thing = tile->getTopVisibleCreature(player);
|
||||
if (!thing) {
|
||||
thing = tile->getUseItem(index);
|
||||
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||
thing = tile->getBottomCreatureUH();
|
||||
}
|
||||
else {
|
||||
thing = tile->getTopCreature();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1690,6 +1690,7 @@ void LuaScriptInterface::registerFunctions()
|
||||
registerEnumIn("configKeys", ConfigManager::NEWBIE_TOWN)
|
||||
registerEnumIn("configKeys", ConfigManager::NEWBIE_LEVEL_THRESHOLD)
|
||||
registerEnumIn("configKeys", ConfigManager::BLOCK_HEIGHT)
|
||||
registerEnumIn("configKeys", ConfigManager::UH_TRAP)
|
||||
registerEnumIn("configKeys", ConfigManager::DROP_ITEMS)
|
||||
registerEnumIn("configKeys", ConfigManager::CLIENT_VERSION)
|
||||
|
||||
|
@ -689,6 +689,9 @@ bool Spell::playerRuneSpellCheck(Player* player, const Position& toPos)
|
||||
}
|
||||
|
||||
const Creature* visibleCreature = tile->getTopCreature();
|
||||
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||
visibleCreature = tile->getBottomCreature();
|
||||
}
|
||||
if (blockingCreature && visibleCreature) {
|
||||
player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
|
||||
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);
|
||||
if (toTile) {
|
||||
const Creature* visibleCreature = toTile->getTopCreature();
|
||||
if (g_config.getBoolean(ConfigManager::UH_TRAP)) {
|
||||
visibleCreature = toTile->getBottomCreature();
|
||||
}
|
||||
if (visibleCreature) {
|
||||
var.number = visibleCreature->getID();
|
||||
}
|
||||
|
39
src/tile.cpp
39
src/tile.cpp
@ -263,6 +263,16 @@ Creature* Tile::getTopCreature() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Creature* Tile::getBottomCreatureUH() const
|
||||
{
|
||||
if (const CreatureVector* creatures = getCreatures()) {
|
||||
if (!creatures->empty()) {
|
||||
return *creatures->rbegin();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Creature* Tile::getBottomCreature() const
|
||||
{
|
||||
if (const CreatureVector* creatures = getCreatures()) {
|
||||
@ -301,6 +311,35 @@ Creature* Tile::getTopVisibleCreature(const Creature* creature) const
|
||||
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
|
||||
{
|
||||
if (const CreatureVector* creatures = getCreatures()) {
|
||||
|
@ -174,8 +174,10 @@ class Tile : public Cylinder
|
||||
BedItem* getBedItem() const;
|
||||
|
||||
Creature* getTopCreature() const;
|
||||
Creature* getBottomCreatureUH() const;
|
||||
const Creature* getBottomCreature() const;
|
||||
Creature* getTopVisibleCreature(const Creature* creature) const;
|
||||
Creature* getBottomVisibleCreatureUH(const Creature* creature) const;
|
||||
const Creature* getBottomVisibleCreature(const Creature* creature) const;
|
||||
Item* getTopTopItem() const;
|
||||
Item* getTopDownItem() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user