Skip to content

Commit

Permalink
Merge branch 'main' into spells
Browse files Browse the repository at this point in the history
  • Loading branch information
kaleohanopahala authored Jan 26, 2025
2 parents 18b8459 + 21c33b0 commit 4bf1fdb
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 12 deletions.
1 change: 1 addition & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ deathLosePercent = -1
Setting this to false may pose risks; if a house is abandoned and contains a large number of items on the floor, those items will be transferred to the player's depot instantly.
• This could potentially freeze the server due to the heavy operation. It's advised to keep this setting enabled (true) to minimize risks.
]]
-- NOTE: When toggleCyclopediaHouseAuction = true, the !buyhouse commmand does not work.
-- Periods: daily/weekly/monthly/yearly/never
-- Base: sqm,rent,sqm+rent
toggleCyclopediaHouseAuction = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function actions_goldenIdol.onUse(player, item, fromPosition, target, toPosition

if currentCount + 1 == totalAltars then
player:setStorageValue(finalStorage, 1)
if p:getStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Tomb) == 1 and p:getStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Cellar) == 1 and p:getStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Temple) == 1 then
p:setStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Questline, 2)
if player:getStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Tomb) == 1 and player:getStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Cellar) == 1 and player:getStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Temple) == 1 then
player:setStorageValue(Storage.Quest.U12_00.TheDreamCourts.HauntedHouse.Questline, 2)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have placed all the idols on the altars and unlocked the temple!")
end
Expand Down
9 changes: 8 additions & 1 deletion data-otservbr-global/world/otservbr-house.xml
Original file line number Diff line number Diff line change
Expand Up @@ -984,4 +984,11 @@
<house name="Pilchard Bin 9" houseid="3684" entryx="32281" entryy="31152" entryz="6" rent="50000" townid="16" size="10" clientid="55124" beds="1" />
<house name="Pilchard Bin 10" houseid="3685" entryx="32281" entryy="31148" entryz="6" rent="50000" townid="16" size="10" clientid="55125" beds="1" />
<house name="Mammoth House" houseid="3686" entryx="32234" entryy="31227" entryz="7" rent="300000" townid="16" size="176" clientid="55014" beds="6" />
</houses>
<house name="Cherry Cake Tower" houseid="3687" entryx="33450" entryy="32103" entryz="7" rent="800000" townid="29" size="153" clientid="53503" beds="7" />
<house name="Blueberry Bay" houseid="3688" entryx="33414" entryy="32114" entryz="7" rent="600000" townid="29" size="130" clientid="53501" beds="4" />
<house name="Vanilla Beach" houseid="3689" entryx="33402" entryy="32166" entryz="7" rent="600000" townid="29" size="129" clientid="53502" beds="4" />
<house name="Centre 1" houseid="3690" entryx="33751" entryy="32856" entryz="7" rent="600000" townid="30" size="126" clientid="49001" beds="4" />
<house name="Centre 2" houseid="3691" entryx="33740" entryy="32856" entryz="7" rent="600000" townid="30" size="139" clientid="49002" beds="4" />
<house name="Cliffside" houseid="3693" entryx="33763" entryy="32803" entryz="4" rent="600000" townid="31" size="203" clientid="53001" beds="6" />
<house name="House of the Rising Moon" houseid="3694" entryx="33812" entryy="32805" entryz="6" rent="1000000" guildhall="true" townid="31" size="340" clientid="53002" beds="12" />
</houses>
146 changes: 146 additions & 0 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76854,6 +76854,76 @@ Granted by TibiaGoals.com"/>
<attribute key="containersize" value="10"/>
<attribute key="decayTo" value="0"/>
</item>
<item id="44895" article="a" name="ramp"/>
<item id="44896" article="a" name="ramp">
<attribute key="floorchange" value="north"/>
</item>
<item id="44897" article="a" name="ramp"/>
<item id="44898" article="a" name="ramp">
<attribute key="floorchange" value="west"/>
</item>
<item id="44899" article="a" name="ramp"/>
<item id="44900" article="a" name="ramp">
<attribute key="floorchange" value="east"/>
</item>
<item id="44901" article="a" name="ramp"/>
<item id="44902" article="a" name="ramp">
<attribute key="floorchange" value="south"/>
</item>
<item id="44913" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="44914" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="44915" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="44916" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="44917" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="44918" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="44941" article="a" name="ramp"/>
<item id="44942" article="a" name="ramp">
<attribute key="floorchange" value="north"/>
</item>
<item id="44943" article="a" name="ramp">
<attribute key="floorchange" value="west"/>
</item>
<item id="44944" article="a" name="ramp"/>
<item id="44945" article="a" name="ramp"/>
<item id="44946" article="a" name="ramp">
<attribute key="floorchange" value="east"/>
</item>
<item id="44947" article="a" name="ramp"/>
<item id="44948" article="a" name="ramp">
<attribute key="floorchange" value="south"/>
</item>
<item id="45153" article="a" name="ramp"/>
<item id="45154" article="a" name="ramp">
<attribute key="floorchange" value="north"/>
</item>
<item id="45155" article="a" name="ramp"/>
<item id="45156" article="a" name="ramp">
<attribute key="floorchange" value="west"/>
</item>
<item id="45157" article="a" name="ramp"/>
<item id="45158" article="a" name="ramp">
<attribute key="floorchange" value="east"/>
</item>
<item id="45159" article="a" name="ramp"/>
<item id="45160" article="a" name="ramp">
<attribute key="floorchange" value="south"/>
</item>
<item id="46627" article="a" name="crusher">
<attribute key="loottype" value="tools"/>
<attribute key="showCharges" value="1"/>
Expand Down Expand Up @@ -79549,6 +79619,82 @@ Granted by TibiaGoals.com"/>
<attribute key="description" value="Offers a soul to the Soulpit. Combine with an exalted core to turn it into a lesser soul core."/>
<attribute key="weight" value="100"/>
</item>
<item id="48493" article="a" name="ladder">
<attribute key="type" value="ladder"/>
</item>
<item id="48494" article="a" name="ladder">
<attribute key="type" value="ladder"/>
</item>
<item id="48495" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48496" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48497" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48498" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48499" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48500" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48501" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48502" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48520" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48521" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48522" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48523" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48524" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48525" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48526" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48527" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48528" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48529" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockProjectile" value="1"/>
</item>
<item id="48530" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48531" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
<item id="48929" article="an" name="black sheep soul core">
<attribute key="primarytype" value="soul cores"/>
<attribute key="description" value="Offers a soul to the Soulpit. Combine with an exalted core to turn it into a lesser soul core."/>
Expand Down
14 changes: 14 additions & 0 deletions data/libs/tables/doors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,20 @@ CustomDoorTable = {
{ closedDoor = 15892, openDoor = 15893 },
{ closedDoor = 22502, openDoor = 22503 },
{ closedDoor = 22504, openDoor = 22505 },
{ closedDoor = 39660, openDoor = 39666 },
{ closedDoor = 39661, openDoor = 39667 },
{ closedDoor = 44913, openDoor = 44917 },
{ closedDoor = 44914, openDoor = 44917 },
{ closedDoor = 44915, openDoor = 44918 },
{ closedDoor = 44916, openDoor = 44918 },
{ closedDoor = 48495, openDoor = 48497 },
{ closedDoor = 48496, openDoor = 48498 },
{ closedDoor = 48499, openDoor = 48501 },
{ closedDoor = 48500, openDoor = 48502 },
{ closedDoor = 48520, openDoor = 48524 },
{ closedDoor = 48522, openDoor = 48526 },
{ closedDoor = 48528, openDoor = 48530 },
{ closedDoor = 48529, openDoor = 48531 },
}

-- These are the doors for missions, they need access from some mission (storage) to be able to enter. Put the storage value in the action id of the door and it will open only to the player who has the storage value.
Expand Down
11 changes: 9 additions & 2 deletions data/scripts/eventcallbacks/player/on_look.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ local function getPositionDescription(position)
end
end

local function handleItemDescription(inspectedThing, lookDistance)
local function handleItemDescription(inspectedThing, lookDistance, player)
local descriptionText = inspectedThing:getDescription(lookDistance)

if not player:getGroup():getAccess() then
if inspectedThing:getId() == ITEM_MAGICWALL or inspectedThing:getId() == ITEM_MAGICWALL_SAFE then
return "You see a magic wall."
elseif inspectedThing:getId() == ITEM_WILDGROWTH or inspectedThing:getId() == ITEM_WILDGROWTH_SAFE then
return "You see rush wood."
end
end
if isSpecialItem(inspectedThing.itemid) then
local itemCharges = inspectedThing:getCharges()
if itemCharges > 0 then
Expand Down Expand Up @@ -114,7 +121,7 @@ function callback.playerOnLook(player, inspectedThing, inspectedPosition, lookDi
local descriptionText

if inspectedThing:isItem() then
descriptionText = handleItemDescription(inspectedThing, lookDistance)
descriptionText = handleItemDescription(inspectedThing, lookDistance, player)
elseif inspectedThing:isCreature() then
descriptionText = handleCreatureDescription(inspectedThing, lookDistance)
end
Expand Down
27 changes: 26 additions & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2924,6 +2924,26 @@ bool Player::canDoAction() const {
return nextAction <= OTSYS_TIME();
}

void Player::setNextNecklaceAction(int64_t time) {
if (time > nextNecklaceAction) {
nextNecklaceAction = time;
}
}

void Player::setNextRingAction(int64_t time) {
if (time > nextRingAction) {
nextRingAction = time;
}
}

bool Player::canEquipNecklace() const {
return OTSYS_TIME() >= nextNecklaceAction;
}

bool Player::canEquipRing() const {
return OTSYS_TIME() >= nextRingAction;
}

void Player::setNextPotionAction(int64_t time) {
if (time > nextPotionAction) {
nextPotionAction = time;
Expand Down Expand Up @@ -6930,7 +6950,12 @@ uint8_t Player::getLastMount() const {
if (value > 0) {
return value;
}
return static_cast<uint8_t>(kv()->get("last-mount")->get<int>());
const auto lastMount = kv()->get("last-mount");
if (!lastMount.has_value()) {
return 0;
}

return static_cast<uint8_t>(lastMount->get<int>());
}

uint8_t Player::getCurrentMount() const {
Expand Down
8 changes: 8 additions & 0 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,12 @@ class Player final : public Creature, public Cylinder, public Bankable {
void setNextPotionAction(int64_t time);
bool canDoPotionAction() const;

void setNextNecklaceAction(int64_t time);
bool canEquipNecklace() const;

void setNextRingAction(int64_t time);
bool canEquipRing() const;

void setLoginProtection(int64_t time);
bool isLoginProtected() const;
void resetLoginProtection();
Expand Down Expand Up @@ -1426,6 +1432,8 @@ class Player final : public Creature, public Cylinder, public Bankable {
int64_t lastPong;
int64_t nextAction = 0;
int64_t nextPotionAction = 0;
int64_t nextNecklaceAction = 0;
int64_t nextRingAction = 0;
int64_t lastQuickLootNotification = 0;
int64_t lastWalking = 0;
int64_t loginProtectionTime = 0;
Expand Down
26 changes: 20 additions & 6 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,18 @@ void Game::playerEquipItem(uint32_t playerId, uint16_t itemId, bool hasTier /* =
return;
}

if (!player->canDoAction()) {
const ItemType &it = Item::items[itemId];
Slots_t slot = getSlotType(it);

if (slot == CONST_SLOT_NECKLACE) {
if (!player->canEquipNecklace()) {
return;
}
} else if (slot == CONST_SLOT_RING) {
if (!player->canEquipRing()) {
return;
}
} else if (!player->canDoAction()) {
uint32_t delay = player->getNextActionTime() - OTSYS_TIME();
if (delay > 0) {
const auto &task = createPlayerTask(
Expand Down Expand Up @@ -3421,9 +3432,6 @@ void Game::playerEquipItem(uint32_t playerId, uint16_t itemId, bool hasTier /* =
return;
}

const ItemType &it = Item::items[itemId];
Slots_t slot = getSlotType(it);

const auto &slotItem = player->getInventoryItem(slot);
const auto &equipItem = searchForItem(backpack, it.id, hasTier, tier);
ReturnValue ret = RETURNVALUE_NOERROR;
Expand Down Expand Up @@ -3494,9 +3502,15 @@ void Game::playerEquipItem(uint32_t playerId, uint16_t itemId, bool hasTier /* =

if (ret != RETURNVALUE_NOERROR) {
player->sendCancelMessage(ret);
return;
}
if (slot == CONST_SLOT_NECKLACE) {
player->setNextNecklaceAction(OTSYS_TIME() + g_configManager().getNumber(ACTIONS_DELAY_INTERVAL));
} else if (slot == CONST_SLOT_RING) {
player->setNextRingAction(OTSYS_TIME() + g_configManager().getNumber(ACTIONS_DELAY_INTERVAL));
} else {
player->setNextAction(OTSYS_TIME() + g_configManager().getNumber(ACTIONS_DELAY_INTERVAL));
}

player->setNextAction(OTSYS_TIME() + g_configManager().getNumber(ACTIONS_DELAY_INTERVAL));
}

void Game::playerMove(uint32_t playerId, Direction direction) {
Expand Down

0 comments on commit 4bf1fdb

Please sign in to comment.