Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for "GetLevel" #2

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c101d37
Merge pull request #1 from conan513/master
FrancescoBorzi Dec 5, 2017
9ade612
fix(build): remove useless variables
Helias Apr 18, 2020
ca92cf5
Merge pull request #4 from azerothcore/fix-build
Helias Apr 18, 2020
6bf472b
docs(readme): add AzerothCore logo and build status badge (#6)
locus313 Nov 17, 2020
812b66e
fix(build) misc fixes to resolve build errors (#7)
locus313 Nov 17, 2020
cb45ca4
feat(CI): move from Travis to GitHub Actions (#5)
Helias Nov 17, 2020
f83adad
fix for last PR ACE remove
Mitradis Mar 2, 2021
2754b15
Delete after_ws_install.cmake
Mitradis Mar 2, 2021
78c35e2
Update mod_achievements.cpp
Mitradis Mar 2, 2021
5bf330e
Merge pull request #8 from Mitradis/patch-1
Helias Mar 3, 2021
ba108da
updated loader
stoudtlr Oct 19, 2021
5687c26
Merge pull request #9 from stoudtlr/master
Helias Oct 23, 2021
4721d32
fix: build, update clang version
Helias Oct 23, 2021
1abdb76
Merge pull request #10 from azerothcore/clang-version
Helias Oct 23, 2021
9ac769a
Fix GetOptionBool depricated warning.
whipowill May 18, 2022
21d3397
Change method PQuery to Query.
whipowill May 18, 2022
ca1d726
Second attempt to fix PQuery issue.
whipowill May 18, 2022
516e8d4
Back to first attempt to fix PQuery issue.
whipowill May 18, 2022
12c9026
Fix GetUInt8 to Get<uint8>.
whipowill May 18, 2022
89e7ee1
Fix GetUInt32 to Get<uint32>.
whipowill May 18, 2022
62d5110
chore: update github action
Helias May 19, 2022
eed962f
Fix query.
whipowill May 19, 2022
fc61753
Merge pull request #13 from whipowill/whipfix
Helias May 19, 2022
97ecce5
Update mod_achievements.cpp
cptcl Jul 25, 2024
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
12 changes: 12 additions & 0 deletions .github/workflows/core-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: core-build
on:
push:
branches:
- 'master'
pull_request:

jobs:
build:
uses: azerothcore/reusable-workflows/.github/workflows/core_build_modules.yml@main
with:
module_repo: ${{ github.event.repository.name }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reset.sh
7 changes: 0 additions & 7 deletions CMakeLists.txt

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
## mod-account-achievements
- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-account-achievements/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-account-achievements)

# Account Achievements module for AzerothCore.

Expand Down
6 changes: 6 additions & 0 deletions src/achievements_loader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void AddAccountAchievementsScripts();

void Addmod_account_achievementsScripts()
{
AddAccountAchievementsScripts();
}
15 changes: 0 additions & 15 deletions src/cmake/after_ws_install.cmake

This file was deleted.

1 change: 0 additions & 1 deletion src/loader_achievements.h

This file was deleted.

51 changes: 15 additions & 36 deletions src/mod_achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
*/

#include "Config.h"

#include "ScriptMgr.h"
#include "Chat.h"
#include "Player.h"

class AccountAchievements : public PlayerScript
{
Expand All @@ -24,41 +26,40 @@ class AccountAchievements : public PlayerScript

void OnLogin(Player* pPlayer)
{
if (sConfigMgr->GetBoolDefault("Account.Achievements.Enable", true))
if (sConfigMgr->GetOption<bool>("Account.Achievements.Enable", true))
{
if (sConfigMgr->GetBoolDefault("Account.Achievements.Announce", true))
if (sConfigMgr->GetOption<bool>("Account.Achievements.Announce", true))
{
ChatHandler(pPlayer->GetSession()).SendSysMessage("This server is running the |cff4CFF00AccountAchievements |rmodule.");
}

std::vector<uint32> Guids;
QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId());
QueryResult result1 = CharacterDatabase.Query("SELECT guid, race FROM characters WHERE account = {}", pPlayer->GetSession()->GetAccountId());
if (!result1)
return;

do
{
Field* fields = result1->Fetch();

uint32 guid = fields[0].GetUInt32();
uint32 race = fields[1].GetUInt8();
uint32 race = fields[1].Get<uint8>();

if ((Player::TeamIdForRace(race) == Player::TeamIdForRace(pPlayer->getRace())) || !limitrace)
Guids.push_back(result1->Fetch()[0].GetUInt32());
Guids.push_back(result1->Fetch()[0].Get<uint32>());

} while (result1->NextRow());

std::vector<uint32> Achievement;

for (auto& i : Guids)
{
QueryResult result2 = CharacterDatabase.PQuery("SELECT achievement FROM character_achievement WHERE guid = %u", i);
QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = {}", i);
if (!result2)
continue;

do
{
Achievement.push_back(result2->Fetch()[0].GetUInt32());
Achievement.push_back(result2->Fetch()[0].Get<uint32>());
} while (result2->NextRow());
}

Expand All @@ -69,43 +70,21 @@ class AccountAchievements : public PlayerScript
}
}
}

void AddAchievements(Player* player, uint32 AchievementID)
{
if (sConfigMgr->GetBoolDefault("Account.Achievements.Enable", true))
if (sConfigMgr->GetOption<bool>("Account.Achievements.Enable", true))
{
if (limitlevel)
setlevel = minlevel;

if (player->getLevel() >= setlevel)
if (player->GetLevel() >= setlevel)
player->CompletedAchievement(sAchievementStore.LookupEntry(AchievementID));
}
}
};

class AccountAchievementsWorld : public WorldScript
{
public:
AccountAchievementsWorld() : WorldScript("AccountAchievementsWorld") { }

void OnBeforeConfigLoad(bool reload) override
{
if (!reload) {
std::string conf_path = _CONF_DIR;
std::string cfg_file = conf_path + "/mod_achievements.conf";
#ifdef WIN32
cfg_file = "mod_achievements.conf";
#endif
std::string cfg_def_file = cfg_file + ".dist";
sConfigMgr->LoadMore(cfg_def_file.c_str());

sConfigMgr->LoadMore(cfg_file.c_str());
}
}
};

void AddAccountAchievementsScripts()
{
new AccountAchievementsWorld;
new AccountAchievements;
}
}