Skip to content

Commit

Permalink
fix: compilation after latest changes
Browse files Browse the repository at this point in the history
TODO: ExtraDatabase is not working anymore after latest db changes, we have to figure out a solution for it. Not needed for the current implementation though
  • Loading branch information
Yehonal committed Jun 28, 2021
1 parent 2145e63 commit 4209a62
Show file tree
Hide file tree
Showing 29 changed files with 361 additions and 295 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/modules/mod-timewalking")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/modules/mod-tournament")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/modules/mod-xp-rates")

AC_ADD_SCRIPTS("${CMAKE_CURRENT_LIST_DIR}/src/")


# Add config file
AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/mod-as-common/conf/azth_mod.conf.dist")
38 changes: 19 additions & 19 deletions modules/mod-arena-solo-3v3/src/Solo3v3_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class npc_solo3v3 : public CreatureScript
}

if (player->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_3v3_SOLO))
player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/Achievement_Arena_2v2_7:30|t Leave Solo queue", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to remove the solo queue?", 0, false);
AddGossipItemFor(player,GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/Achievement_Arena_2v2_7:30|t Leave Solo queue", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to remove the solo queue?", 0, false);

if (!player->GetArenaTeamId(ArenaTeam::GetSlotByType(ARENA_TEAM_SOLO_3v3)))
{
Expand All @@ -60,24 +60,24 @@ class npc_solo3v3 : public CreatureScript
if (sAZTH->GetAZTHPlayer(player)->isPvP())
cost = 0;

player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/Achievement_Arena_2v2_7:30|t Create new Solo arena team", GOSSIP_SENDER_MAIN, 1, "Create new solo arena team?", cost, false);
AddGossipItemFor(player,GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/Achievement_Arena_2v2_7:30|t Create new Solo arena team", GOSSIP_SENDER_MAIN, 1, "Create new solo arena team?", cost, false);
}
else
{
if (!player->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_3v3_SOLO))
{
//player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Queue up for 1vs1 Wargame\n", GOSSIP_SENDER_MAIN, 20);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/Achievement_Arena_3v3_5:30|t Queue up for 3vs3 Arena Solo\n", GOSSIP_SENDER_MAIN, 2);
player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, "|TInterface/ICONS/Achievement_Arena_2v2_7:30|t Disband Arena team", GOSSIP_SENDER_MAIN, 5, "Are you sure?", 0, false);
//AddGossipItemFor(player,GOSSIP_ICON_INTERACT_1, "Queue up for 1vs1 Wargame\n", GOSSIP_SENDER_MAIN, 20);
AddGossipItemFor(player,GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/Achievement_Arena_3v3_5:30|t Queue up for 3vs3 Arena Solo\n", GOSSIP_SENDER_MAIN, 2);
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "|TInterface/ICONS/Achievement_Arena_2v2_7:30|t Disband Arena team", GOSSIP_SENDER_MAIN, 5, "Are you sure?", 0, false);
}

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/INV_Misc_Coin_01:30|t Show statistics", GOSSIP_SENDER_MAIN, 4);
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "|TInterface/ICONS/INV_Misc_Coin_01:30|t Show statistics", GOSSIP_SENDER_MAIN, 4);
}

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/INV_Misc_Coin_03:30|t How to Use NPC?", GOSSIP_SENDER_MAIN, 8);
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "|TInterface/ICONS/INV_Misc_Coin_03:30|t How to Use NPC?", GOSSIP_SENDER_MAIN, 8);

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, infoQueue.str().c_str(), GOSSIP_SENDER_MAIN, 0);
player->SEND_GOSSIP_MENU(60015, me->GetGUID());
AddGossipItemFor(player,GOSSIP_ICON_CHAT, infoQueue.str().c_str(), GOSSIP_SENDER_MAIN, 0);
SendGossipMenuFor(player, 60015, me->GetGUID());
return true;
}

Expand Down Expand Up @@ -109,7 +109,7 @@ class npc_solo3v3 : public CreatureScript
ChatHandler(player->GetSession()).PSendSysMessage("You need level %u+ to create an arena team.", sConfigMgr->GetIntDefault("Solo.3v3.MinLevel", 80));
}

player->CLOSE_GOSSIP_MENU();
CloseGossipMenuFor(player);
return true;
}
break;
Expand All @@ -127,7 +127,7 @@ class npc_solo3v3 : public CreatureScript
if (ArenaCheckFullEquipAndTalents(player) && JoinQueueArena(player, me, true, ARENA_TYPE_3v3_SOLO) == false)
ChatHandler(player->GetSession()).SendSysMessage("Something went wrong while joining queue. Already in another queue?");

player->CLOSE_GOSSIP_MENU();
CloseGossipMenuFor(player);
return true;
}

Expand All @@ -140,7 +140,7 @@ class npc_solo3v3 : public CreatureScript
WorldPacket Data;
Data << arenaType << (uint8)0x0 << (uint32)BATTLEGROUND_AA << (uint16)0x0 << (uint8)0x0;
player->GetSession()->HandleBattleFieldPortOpcode(Data);
player->CLOSE_GOSSIP_MENU();
CloseGossipMenuFor(player);

}
return true;
Expand Down Expand Up @@ -169,18 +169,18 @@ class npc_solo3v3 : public CreatureScript
Data << (uint32)player->GetArenaTeamId(ArenaTeam::GetSlotByType(ARENA_TEAM_SOLO_3v3));
player->GetSession()->HandleArenaTeamLeaveOpcode(Data);
ChatHandler(player->GetSession()).PSendSysMessage("Arena team deleted!");
player->CLOSE_GOSSIP_MENU();
CloseGossipMenuFor(player);
return true;
}
break;

case 8: // Script Info
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Click on Create new 3v3 SoloQ Arena team", GOSSIP_SENDER_MAIN, uiAction);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Join 3v3 SoloQ Arena and ready!", GOSSIP_SENDER_MAIN, uiAction);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Enjoy!", GOSSIP_SENDER_MAIN, uiAction);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "<- Back", GOSSIP_SENDER_MAIN, 7);
player->SEND_GOSSIP_MENU(68, me->GetGUID());
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "Click on Create new 3v3 SoloQ Arena team", GOSSIP_SENDER_MAIN, uiAction);
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "Join 3v3 SoloQ Arena and ready!", GOSSIP_SENDER_MAIN, uiAction);
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "Enjoy!", GOSSIP_SENDER_MAIN, uiAction);
AddGossipItemFor(player,GOSSIP_ICON_CHAT, "<- Back", GOSSIP_SENDER_MAIN, 7);
SendGossipMenuFor(player, 68, me->GetGUID());
return true;
}
break;
Expand Down Expand Up @@ -307,7 +307,7 @@ class npc_solo3v3 : public CreatureScript
uint32 queueSlot = player->AddBattlegroundQueueId(bgQueueTypeId);

// send status packet (in queue)
WorldPacket data;
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype, player->GetTeamId()); //??
player->GetSession()->SendPacket(&data);

Expand Down
3 changes: 3 additions & 0 deletions modules/mod-as-common/src/cmake/after_game_library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ add_library(azth_mod STATIC

target_link_libraries(azth_mod
PRIVATE
mysql
database
game
modules-interface
game-interface)

Expand Down
6 changes: 6 additions & 0 deletions modules/mod-as-common/src/game/AzthFirstKills.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ enum NxEncouters
MAX_ENCOUNTERS,
};

AzthFirstKills* AzthFirstKills::instance()
{
static AzthFirstKills instance;
return &instance;
}

bool AzthFirstKills::canCompleteAchi(Player */* player */, uint32 /* achiId */)
{
return true;
Expand Down
18 changes: 10 additions & 8 deletions modules/mod-as-common/src/game/AzthFirstKills.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@
class Player;

enum FirstKills:uint32 {
ACHI_NAXXRAMAS=1402, //-- "Conqueror of Naxxramas"
ACHI_OBSIDIAN=456, //-- "Obsidian Slayer",
ACHI_MAGIC_SEEKER=1400, //-- "Magic Seeker",
ACHI_DEATH_DEMISE=3117, //-- "Death's Demise",
ACHI_CELESTIAL_DEFENDER=3259, //-- "Celestial Defender",
ACHI_GRAND_CRUSADER=4078, //-- "Grand Crusader",
ACHI_NAXXRAMAS=1402, //-- "Conqueror of Naxxramas"
ACHI_OBSIDIAN=456, //-- "Obsidian Slayer",
ACHI_MAGIC_SEEKER=1400, //-- "Magic Seeker",
ACHI_DEATH_DEMISE=3117, //-- "Death's Demise",
ACHI_CELESTIAL_DEFENDER=3259, //-- "Celestial Defender",
ACHI_GRAND_CRUSADER=4078, //-- "Grand Crusader",
ACHI_FALL_OF_LK=4576, //-- "Fall of the Lich King",
};

class AzthFirstKills {
friend class ACE_Singleton<AzthFirstKills, ACE_Null_Mutex>;
public:
static AzthFirstKills* instance();

void loadCurrentFirstkills();
bool isRealmCompleted(AchievementEntry const* achievement, bool originalValue);
void setRealmCompleted(AchievementEntry const* achievement);
Expand All @@ -32,6 +34,6 @@ class AzthFirstKills {
std::map<uint32 /*achiID*/, std::chrono::system_clock::time_point /*completionTime*/> currentFirstKills;
};

#define sAzthFirstKills ACE_Singleton<AzthFirstKills, ACE_Null_Mutex>::instance()
#define sAzthFirstKills AzthFirstKills::instance()

#endif
#endif
10 changes: 10 additions & 0 deletions modules/mod-as-common/src/game/ExtraDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
*/

#include "ExtraDatabase.h"
#include "MySQLPreparedStatement.h"
#include "DatabaseLoader.h"

class DatabaseLoader;

template class AC_DATABASE_API DatabaseWorkerPool<ExtraDatabaseConnection>;
DatabaseWorkerPool<ExtraDatabaseConnection> ExtraDatabase;

void ExtraDatabaseConnection::DoPrepareStatements()
{
Expand All @@ -28,3 +35,6 @@ void ExtraDatabaseConnection::DoPrepareStatements()
PrepareStatement(EXTRA_GET_EXTERNAL_MAIL, "SELECT id, receiver, subject, message, money, item, item_count FROM mail_external ORDER BY id ASC", CONNECTION_SYNCH);
PrepareStatement(EXTRA_DEL_EXTERNAL_MAIL, "DELETE FROM mail_external WHERE id = ?", CONNECTION_ASYNC);
}

// template AC_DATABASE_API
// DatabaseLoader& DatabaseLoader::AddDatabase<ExtraDatabaseConnection>(DatabaseWorkerPool<ExtraDatabaseConnection>&, std::string const&);
32 changes: 16 additions & 16 deletions modules/mod-as-common/src/game/ExtraDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,8 @@
#ifndef _EXTRADATABASE_H
#define _EXTRADATABASE_H

#include "DatabaseWorkerPool.h"
#include "MySQLConnection.h"

class ExtraDatabaseConnection : public MySQLConnection
{
public:
//- Constructors for sync and async connections
ExtraDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) {}
ExtraDatabaseConnection(ACE_Activation_Queue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) {}


//- Loads databasetype specific prepared statements
void DoPrepareStatements();
};

typedef DatabaseWorkerPool<ExtraDatabaseConnection> ExtraDatabaseWorkerPool;
#include "DatabaseEnv.h"

enum ExtraDatabaseStatements
{
Expand All @@ -48,6 +34,20 @@ enum ExtraDatabaseStatements
MAX_EXTRADATABASE_STATEMENTS,
};

ExtraDatabaseWorkerPool ExtraDatabase; ///< Accessor to the realm/login database
class AC_DATABASE_API ExtraDatabaseConnection : public MySQLConnection
{
public:
typedef ExtraDatabaseStatements Statements;

//- Constructors for sync and async connections
ExtraDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) {}
ExtraDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) {}


//- Loads databasetype specific prepared statements
void DoPrepareStatements();
};

AC_DATABASE_API extern DatabaseWorkerPool<ExtraDatabaseConnection> ExtraDatabase;

#endif
7 changes: 6 additions & 1 deletion modules/mod-as-common/src/plugins/AzthWorldScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
#include "AzthUtils.h"
#include "ScriptMgr.h"
#include "AzthFirstKills.h"
#include "ExtraDatabase.h"
#include "DatabaseLoader.h"

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

void OnStartup() override
{
// DatabaseLoader loader("server.worldserver");
// loader
// .AddDatabase(ExtraDatabase, "Extra");
sAzthLang->loadStrings();
sAzthUtils->loadClassSpells();
sAzthFirstKills->loadCurrentFirstkills();
Expand Down
4 changes: 2 additions & 2 deletions modules/mod-as-platform/src/AZTH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void AZTH::SendGameMail(Player* receiver, std::string subject, std::string body,
{
uint32 receiver_guid = receiver->GetGUID().GetCounter();

SQLTransaction trans = CharacterDatabase.BeginTransaction();
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft* mail = new MailDraft(subject, body);

if (money)
Expand Down Expand Up @@ -314,7 +314,7 @@ void AZTH::SendExternalMails()
// return;
// }

// SQLTransaction trans = CharacterDatabase.BeginTransaction();
// CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();n();
// SQLTransaction trans2 = ExtraDatabase.BeginTransaction();

// MailDraft* mail = nullptr;
Expand Down
38 changes: 20 additions & 18 deletions modules/mod-as-platform/src/AZTH_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "MapManager.h"
#include "ExtraDatabase.h"

enum AZTHLanguage
{
LANG_AZTH_NO_INFO_ARENA_JOINED = 7000, //[AZTH]
LANG_AZTH_NO_INFO_ARENA_EXITED = 7001, //[AZTH]
};

class AuraEffect;

// SC
Expand Down Expand Up @@ -91,32 +97,28 @@ class Battleground_SC : public BGScript
bg->SetStartDelayTime(BG_START_DELAY_15S);
}

bool CanSendMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* ginfo, bool IsJoin)
bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* ginfo) override
{
if (!ginfo->IsRated || !ginfo->ArenaType || ginfo->Players.empty())
return true;

if (!sArenaTeamMgr->GetArenaTeamById(ginfo->ArenaTeamId))
return false;

enum AZTHLanguage
{
LANG_AZTH_NO_INFO_ARENA_JOINED = 7000, //[AZTH]
LANG_AZTH_NO_INFO_ARENA_EXITED = 7001, //[AZTH]
};
sWorld->SendWorldText(LANG_AZTH_NO_INFO_ARENA_EXITED, ginfo->ArenaType, ginfo->ArenaType);
return false;
}

if (IsJoin)
{
sWorld->SendWorldText(LANG_AZTH_NO_INFO_ARENA_JOINED, ginfo->ArenaType, ginfo->ArenaType); //[AZTH]
return false;
}
else
{
sWorld->SendWorldText(LANG_AZTH_NO_INFO_ARENA_EXITED, ginfo->ArenaType, ginfo->ArenaType);
bool OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, GroupQueueInfo* ginfo, PvPDifficultyEntry const* /*bracketEntry*/, bool /*isRated*/) override
{
if (!ginfo->IsRated || !ginfo->ArenaType || ginfo->Players.empty())
return true;

if (!sArenaTeamMgr->GetArenaTeamById(ginfo->ArenaTeamId))
return false;
}

return true;
sWorld->SendWorldText(LANG_AZTH_NO_INFO_ARENA_JOINED, ginfo->ArenaType, ginfo->ArenaType); //[AZTH]
return false;
}
};

Expand Down Expand Up @@ -177,7 +179,7 @@ class Player_SC : public PlayerScript
return true;
}

void OnDeleteFromDB(SQLTransaction& trans, uint32 guid) override
void OnDeleteFromDB(CharacterDatabaseTransaction trans, uint32 guid) override
{
if (!guid)
return;
Expand Down Expand Up @@ -619,7 +621,7 @@ class Player_SC : public PlayerScript
return;

// Wowarmory feeds
SQLTransaction wowArmoryTrans = CharacterDatabase.BeginTransaction();
CharacterDatabaseTransaction wowArmoryTrans = CharacterDatabase.BeginTransaction();

AzthPlayer* azthPlayer = sAZTH->GetAZTHPlayer(player);
if (!azthPlayer)
Expand Down
2 changes: 1 addition & 1 deletion modules/mod-challenge-mode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
AC_ADD_SCRIPTS("${CMAKE_CURRENT_LIST_DIR}/src/scripts/")

# Add SC loader
AC_ADD_SCRIPT_LOADER("ChallengeMode" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
#AC_ADD_SCRIPT_LOADER("ChallengeMode" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/mod-guildhouse/src/scripts/GuildHouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ void GuildHouseObject::ControlGuildHouse()
if (pGuild->GetMemberSize() < (*itr).second.min_member)
{
GHobj.ChangeGuildHouse((*itr).first, 0);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();n();
if (!pGuild->ModifyBankMoney(trans, (*itr).second.price * 75000, true)) {
continue;
}
Expand Down
4 changes: 1 addition & 3 deletions modules/mod-guildhouse/src/scripts/Teleport.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace nsNpcTel

uint32 GetPageId(void) const { return m_PageId; }
Player * GetPlayer(void) const { return m_player; }

private:

Player *m_player;
Expand Down Expand Up @@ -146,6 +146,4 @@ namespace nsNpcTel
void LoadNpcTele();
}

extern WorldDatabaseWorkerPool WorldDatabase;

#endif
Loading

0 comments on commit 4209a62

Please sign in to comment.