Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Sync with upstream 2 [8.60] #34

Merged
merged 8 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You are welcome to submit a pull request though.

If you are looking for other protocols, switch the branch at the top.

This downgrade is up to May 11, 2021, commit: https://github.com/otland/forgottenserver/commit/809090df12cf78ed23211e7347d28489d028f96f
This downgrade is up to June 4th, 2021, commit: https://github.com/otland/forgottenserver/commit/ace6ff683488d60722904731131ed7cfb20abd82

## How to compile
[Wiki](https://github.com/otland/forgottenserver/wiki/Compiling)
Expand Down
4 changes: 2 additions & 2 deletions data/lib/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ function Player.addSkill(self, skillId, value, round)
return self:addSkillTries(skillId, self:getVocation():getRequiredSkillTries(skillId, self:getSkillLevel(skillId) + value) - self:getSkillTries(skillId))
end

function Player.getWeaponType()
function Player.getWeaponType(self)
local weapon = self:getSlotItem(CONST_SLOT_LEFT)
if weapon then
return ItemType(weapon:getId()):getWeaponType()
return weapon:getType():getWeaponType()
end
return WEAPON_NONE
end
2 changes: 1 addition & 1 deletion data/scripts/actions/others/doors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function door.onUse(player, item, fromPosition, target, toPosition, isHotkey)
target:transform(transformTo)
return true
elseif table.contains(lockedDoors, itemId) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is locked.")
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
return true
elseif table.contains(openDoors, itemId) or table.contains(openExtraDoors, itemId) or table.contains(openHouseDoors, itemId) then
local creaturePositionTable = {}
Expand Down
4 changes: 2 additions & 2 deletions data/scripts/lib/register_monster_type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ registerMonsterType.attacks = function(mtype, mask)
if attack.condition.type then
spell:setConditionType(attack.condition.type)
end
local startDamnage = 0
local startDamage = 0
if attack.condition.startDamage then
startDamage = attack.condition.startDamage
end
Expand Down Expand Up @@ -382,7 +382,7 @@ registerMonsterType.defenses = function(mtype, mask)
if defense.condition.type then
spell:setConditionType(defense.condition.type)
end
local startDamnage = 0
local startDamage = 0
if defense.condition.startDamage then
startDamage = defense.condition.startDamage
end
Expand Down
2 changes: 1 addition & 1 deletion data/spells/scripts/support/find_person.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function onCastSpell(creature, variant)
end

local level = positionDifference.z > 0 and LEVEL_HIGHER or positionDifference.z < 0 and LEVEL_LOWER or LEVEL_SAME
local distance = maxPositionDifference < 5 and DISTANCE_BESIDE or maxPositionDifference < 101 and DISTANCE_CLOSE or maxPositionDifference < 275 and DISTANCE_FAR or DISTANCE_VERYFAR
local distance = maxPositionDifference < 5 and DISTANCE_BESIDE or maxPositionDifference < 101 and DISTANCE_CLOSE or maxPositionDifference < 250 and DISTANCE_FAR or DISTANCE_VERYFAR
local message = messages[distance][level] or messages[distance]
if distance ~= DISTANCE_BESIDE then
message = message .. " " .. directions[direction]
Expand Down
7 changes: 0 additions & 7 deletions src/iologindata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ Account IOLoginData::loadAccount(uint32_t accno)
return account;
}

bool IOLoginData::saveAccount(const Account& acc)
{
std::ostringstream query;
query << "UPDATE `accounts` SET `premium_ends_at` = " << acc.premiumEndsAt << " WHERE `id` = " << acc.id;
return Database::getInstance().executeQuery(query.str());
}

std::string decodeSecret(const std::string& secret)
{
// simple base32 decoding
Expand Down
1 change: 0 additions & 1 deletion src/iologindata.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class IOLoginData
{
public:
static Account loadAccount(uint32_t accno);
static bool saveAccount(const Account& acc);

static bool loginserverAuthentication(const std::string& name, const std::string& password, Account& account);
static uint32_t gameworldAuthentication(const std::string& accountName, const std::string& password, std::string& characterName);
Expand Down
10 changes: 10 additions & 0 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,3 +2001,13 @@ void Monster::getPathSearchParams(const Creature* creature, FindPathParams& fpp)
fpp.fullPathSearch = !canUseAttack(getPosition(), creature);
}
}

bool Monster::canPushItems() const
{
Monster* master = this->master ? this->master->getMonster() : nullptr;
if (master) {
return master->mType->info.canPushItems;
}

return mType->info.canPushItems;
}
4 changes: 1 addition & 3 deletions src/monster.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ class Monster final : public Creature
return mType->info.isAttackable;
}

bool canPushItems() const {
return mType->info.canPushItems;
}
bool canPushItems() const;
bool canPushCreatures() const {
return mType->info.canPushCreatures;
}
Expand Down
10 changes: 0 additions & 10 deletions src/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,6 @@ InstantSpell* Spells::getInstantSpell(const std::string& words)
return nullptr;
}

InstantSpell* Spells::getInstantSpellById(uint32_t spellId)
{
for (auto& it : instants) {
if (it.second.getId() == spellId) {
return &it.second;
}
}
return nullptr;
}

InstantSpell* Spells::getInstantSpellByName(const std::string& name)
{
for (auto& it : instants) {
Expand Down
2 changes: 0 additions & 2 deletions src/spells.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class Spells final : public BaseEvents
InstantSpell* getInstantSpell(const std::string& words);
InstantSpell* getInstantSpellByName(const std::string& name);

InstantSpell* getInstantSpellById(uint32_t spellId);

TalkActionResult_t playerSaySpell(Player* player, std::string& words);

static Position getCasterPosition(Creature* creature, Direction dir);
Expand Down
4 changes: 2 additions & 2 deletions src/teleport.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class Teleport final : public Item, public Cylinder
const Position& getDestPos() const {
return destPos;
}
void setDestPos(Position pos) {
destPos = std::move(pos);
void setDestPos(const Position& pos) {
destPos = pos;
}

bool checkInfinityLoop(Tile* destTile);
Expand Down