Skip to content

Commit

Permalink
Merge branch 'main' into house-auction
Browse files Browse the repository at this point in the history
  • Loading branch information
jprzimba committed Jan 8, 2025
2 parents 2c52a15 + 41524cc commit 6de6ebd
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 5 deletions.
3 changes: 3 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ toggleMaintainMode = false
-- @field [parent=#global] #string maintainModeMessage an empty string by default, set a custom message if needed.
maintainModeMessage = ""

-- toggleTestMode get player infinite health mana and soul.
toggleTestMode = false

-- Rook system
-- NOTE: Town ids: Dawnport = 2, Rookgaard = 3
toggleRookSystem = false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local Morguthiswall = Action()

function Morguthiswall.onUse(player, item, fromPosition, target, toPosition)
local wallPosition = Position(33211, 32698, 13)
local wallId = 1306

local tile = Tile(wallPosition)
if not tile then
return false
end

local wall = tile:getItemById(wallId)
if wall then
wall:remove()
else
local creatures = tile:getCreatures()
if creatures then
for _, creature in ipairs(creatures) do
local newPosition = Position(wallPosition.x, wallPosition.y + 1, wallPosition.z)
creature:teleportTo(newPosition)
end
end

local items = tile:getItems()
if items then
for _, tileItem in ipairs(items) do
local newPosition = Position(wallPosition.x, wallPosition.y + 1, wallPosition.z)
tileItem:moveTo(newPosition)
end
end

Game.createItem(wallId, 1, wallPosition)
end

return true
end

Morguthiswall:aid(10808)
Morguthiswall:register()
6 changes: 2 additions & 4 deletions data/scripts/spells/attack/strong_ethereal_spear.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)

function onGetFormulaValues(player, skill, attack, factor)
local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
local min = (player:getLevel() / 5) + distanceSkill + 7
local max = (player:getLevel() / 5) + (distanceSkill * 1.5) + 13
return -min, -max
local levelTotal = player:getLevel() / 5
return -(((2 * skill + attack / 2500) * 2.30) + levelTotal + 7), -(((2 * skill + attack / 1875) * 3.30) + levelTotal + 13)
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
Expand Down
3 changes: 2 additions & 1 deletion markdowns/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Cyclopedia House Auction system. ([murilo09](https://github.com/murilo09))
- Updated npcs and spells from 13.40 updates. ([murilo09](https://github.com/murilo09))
- Added a Rook system with configurations in `config.lua`. ([Tryller](https://github.com/jprzimba))
- Added a Test Mode with configurations in `config.lua`. ([Tryller](https://github.com/jprzimba))

## Added files

Expand Down Expand Up @@ -68,7 +69,7 @@
- Prevent players from entering the pool while in ghost mode. ([Tryller](https://github.com/jprzimba))
- Prevent players from logging out while in the pool.
- Prevent the use of `/n`, `/m`, and `/s` commands while in the pool. ([Tryller](https://github.com/jprzimba))

- Fixed Morguthis wall action. ([kaleohanopahala](https://github.com/kaleohanopahala))

## Version 4.1

Expand Down
1 change: 1 addition & 0 deletions src/config/config_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ enum ConfigKey_t : uint16_t {
CYCLOPEDIA_HOUSE_AUCTION,
DAYS_TO_CLOSE_BID,
LOG_PLAYERS_STATEMENTS,
TOGGLE_TEST_MODE,
ROOK_SYSTEM,
ROOK_TOWN,
LEVEL_TO_ROOK,
Expand Down
1 change: 1 addition & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ bool ConfigManager::load() {
loadBoolConfig(L, SPELL_NAME_INSTEAD_WORDS, "spellNameInsteadOfWords", false);
loadBoolConfig(L, CYCLOPEDIA_HOUSE_AUCTION, "toggleCyclopediaHouseAuction", true);
loadBoolConfig(L, LOG_PLAYERS_STATEMENTS, "logPlayersStatements", false);
loadBoolConfig(L, TOGGLE_TEST_MODE, "toggleTestMode", false);
loadBoolConfig(L, ROOK_SYSTEM, "toggleRookSystem", false);
loadBoolConfig(L, TOGGLE_ADD_ROOK_ITEMS, "toggleAddRookItems", false);

Expand Down
12 changes: 12 additions & 0 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6126,11 +6126,19 @@ bool Player::lastHitIsPlayer(const std::shared_ptr<Creature> &lastHitCreature) {
}

void Player::changeHealth(int32_t healthChange, bool sendHealthChange /* = true*/) {
if (g_configManager().getBoolean(TOGGLE_TEST_MODE)) {
return;
}

Creature::changeHealth(healthChange, sendHealthChange);
sendStats();
}

void Player::changeMana(int32_t manaChange) {
if (g_configManager().getBoolean(TOGGLE_TEST_MODE)) {
return;
}

if (!hasFlag(PlayerFlags_t::HasInfiniteMana)) {
Creature::changeMana(manaChange);
}
Expand All @@ -6139,6 +6147,10 @@ void Player::changeMana(int32_t manaChange) {
}

void Player::changeSoul(int32_t soulChange) {
if (g_configManager().getBoolean(TOGGLE_TEST_MODE)) {
return;
}

if (soulChange > 0) {
soul += std::min<int32_t>(soulChange * g_configManager().getFloat(RATE_SOUL_REGEN), vocation->getSoulMax() - soul);
} else {
Expand Down

0 comments on commit 6de6ebd

Please sign in to comment.