Skip to content

Commit

Permalink
fix account manager method
Browse files Browse the repository at this point in the history
  • Loading branch information
MillhioreBT committed Apr 6, 2024
1 parent 62f8a2b commit 5cdbab8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,11 @@ void Player::addInFightTicks(bool pzlock /*= false*/)
addCondition(condition);
}

bool Player::isAccountManager() const
{
return g_config[ConfigKeysBoolean::ACCOUNT_MANAGER] && guid == ACCOUNT_MANAGER_PLAYER_ID;
}

void Player::removeList()
{
g_game.removePlayer(this);
Expand Down
2 changes: 1 addition & 1 deletion src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Player final : public Creature, public Cylinder

void setGUID(uint32_t guid) { this->guid = guid; }
uint32_t getGUID() const { return guid; }
bool isAccountManager() const { return guid == ACCOUNT_MANAGER_PLAYER_ID; }
bool isAccountManager() const;
bool canSeeInvisibility() const override { return hasFlag(PlayerFlag_CanSenseInvisibility) || group->access; }

void removeList() override;
Expand Down
3 changes: 1 addition & 2 deletions src/protocollogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,13 @@ void ProtocolLogin::onRecvFirstMessage(NetworkMessage& msg)
return;
}

const auto& accountManager = g_config[ConfigKeysBoolean::ACCOUNT_MANAGER];
auto accountName = msg.getString();
auto password = msg.getString();

const bool accountNameEmpty = accountName.empty();
const bool passwordEmpty = password.empty();

if (accountManager && accountNameEmpty && passwordEmpty) {
if (g_config[ConfigKeysBoolean::ACCOUNT_MANAGER] && accountNameEmpty && passwordEmpty) {
g_dispatcher.addTask([=, thisPtr = std::static_pointer_cast<ProtocolLogin>(shared_from_this())]() {
thisPtr->getCharacterList(ACCOUNT_MANAGER_ACCOUNT_NAME, ACCOUNT_MANAGER_ACCOUNT_PASSWORD);
});
Expand Down

0 comments on commit 5cdbab8

Please sign in to comment.