forked from azerothcore/azerothcore-wotlk
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync things between characters on same account
- Loading branch information
Showing
28 changed files
with
2,602 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
reset.sh |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ![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. | ||
|
||
Share your characters achievements to all on your account. | ||
|
||
# Original script: | ||
http://www.ac-web.org/forums/showthread.php?223586-Account-Bound-Achievements |
13 changes: 13 additions & 0 deletions
13
modules/mod-account-achievements/conf/mod_achievements.conf.dist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[worldserver] | ||
|
||
################################################################################################### | ||
# Account Achievements module | ||
################################################################################################### | ||
|
||
# Enable the module? (1: true | 0: false) | ||
|
||
Account.Achievements.Enable = 1 | ||
|
||
# Announce the module when the player logs in? | ||
|
||
Account.Achievements.Announce = 1 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
void AddAccountAchievementsScripts(); | ||
|
||
void Addmod_account_achievementsScripts() | ||
{ | ||
AddAccountAchievementsScripts(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
<---------------------------------------------------------------------------> | ||
- Developer(s): Lille Carl, Grim/Render | ||
- Complete: %100 | ||
- ScriptName: 'AccountAchievements' | ||
- Comment: Tested and Works. | ||
- Orginial Creator: Lille Carl | ||
- Edited: Render/Grim | ||
<---------------------------------------------------------------------------> | ||
*/ | ||
|
||
#include "Config.h" | ||
#include "ScriptMgr.h" | ||
#include "Chat.h" | ||
#include "Player.h" | ||
|
||
class AccountAchievements : public PlayerScript | ||
{ | ||
static const bool limitrace = true; // This set to true will only achievements from chars on the same team, do what you want. NOT RECOMMANDED TO BE CHANGED!!! | ||
static const bool limitlevel = false; // This checks the player's level and will only add achievements to players of that level. | ||
int minlevel = 80; // It's set to players of the level 60. Requires limitlevel to be set to true. | ||
int setlevel = 1; // Dont Change | ||
|
||
public: | ||
AccountAchievements() : PlayerScript("AccountAchievements") { } | ||
|
||
void OnLogin(Player* pPlayer) | ||
{ | ||
if (sConfigMgr->GetOption<bool>("Account.Achievements.Enable", 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.Query("SELECT guid, race FROM characters WHERE account = {}", pPlayer->GetSession()->GetAccountId()); | ||
if (!result1) | ||
return; | ||
|
||
do | ||
{ | ||
Field* fields = result1->Fetch(); | ||
|
||
uint32 race = fields[1].Get<uint8>(); | ||
|
||
if ((Player::TeamIdForRace(race) == Player::TeamIdForRace(pPlayer->getRace())) || !limitrace) | ||
Guids.push_back(result1->Fetch()[0].Get<uint32>()); | ||
|
||
} while (result1->NextRow()); | ||
|
||
std::vector<uint32> Achievement; | ||
|
||
for (auto& i : Guids) | ||
{ | ||
QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = {}", i); | ||
if (!result2) | ||
continue; | ||
|
||
do | ||
{ | ||
Achievement.push_back(result2->Fetch()[0].Get<uint32>()); | ||
} while (result2->NextRow()); | ||
} | ||
|
||
for (auto& i : Achievement) | ||
{ | ||
auto sAchievement = sAchievementStore.LookupEntry(i); | ||
AddAchievements(pPlayer, sAchievement->ID); | ||
} | ||
} | ||
} | ||
|
||
void AddAchievements(Player* player, uint32 AchievementID) | ||
{ | ||
if (sConfigMgr->GetOption<bool>("Account.Achievements.Enable", true)) | ||
{ | ||
if (limitlevel) | ||
setlevel = minlevel; | ||
|
||
if (player->GetLevel() >= setlevel) | ||
player->CompletedAchievement(sAchievementStore.LookupEntry(AchievementID)); | ||
} | ||
} | ||
}; | ||
|
||
void AddAccountAchievementsScripts() | ||
{ | ||
new AccountAchievements; | ||
} |
Oops, something went wrong.