Skip to content
This repository was archived by the owner on May 1, 2023. It is now read-only.
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ CMakeLists.txt.user
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.cppcheck
2 changes: 1 addition & 1 deletion sql/custom/auth/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.sql
LOCAL*.sql
2 changes: 2 additions & 0 deletions sql/custom/auth/RBACmorp2players.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `auth`.`rbac_linked_permissions` (`id`, `linkedId`) VALUES (199, 543);
INSERT INTO `auth`.`rbac_linked_permissions` (`id`, `linkedId`) VALUES (199, 542);
2 changes: 1 addition & 1 deletion sql/custom/characters/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.sql
LOCAL*.sql
9 changes: 9 additions & 0 deletions sql/custom/characters/characters_displayid.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE `character_displayid` (
`guid` INT UNSIGNED NOT NULL,
`displayid` INT UNSIGNED NULL,
PRIMARY KEY (`guid`)
)
COMMENT='Character display ID (morph)'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
2 changes: 1 addition & 1 deletion sql/custom/world/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.sql
LOCAL*.sql
4 changes: 4 additions & 0 deletions src/server/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ file(GLOB_RECURSE sources_Warden Warden/*.cpp Warden/*.h)
file(GLOB_RECURSE sources_Weather Weather/*.cpp Weather/*.h)
file(GLOB_RECURSE sources_World World/*.cpp World/*.h)

##########

##########

# Create game-libary

if (USE_COREPCH)
Expand Down
23 changes: 18 additions & 5 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
#include "WorldSession.h"
#include "GameObjectAI.h"

//########################## TrinityRP
#include "RPPlayer.h"
//########################## TrinityRP

#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)

#define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_INFO_1_1 + ((x)*3))
Expand Down Expand Up @@ -17214,15 +17218,15 @@ bool Player::IsLoading() const

bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
{
//// 0 1 2 3 4 5 6 7 8 9 10 11
/// 0 1 2 3 4 5 6 7 8 9 10 11
//QueryResult* result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
// 12 13 14 15 16 17 18 19 20 21 22 23 24
/// 12 13 14 15 16 17 18 19 20 21 22 23 24
//"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
// 25 26 27 28 29 30 31 32 33 34 35 36 37 38
/// 25 26 27 28 29 30 31 32 33 34 35 36 37 38
//"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
// 39 40 41 42 43 44 45 46 47 48 49
/// 39 40 41 42 43 44 45 46 47 48 49
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
/// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
//"health, power1, power2, power3, power4, power5, power6, power7, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM);
if (!result)
Expand Down Expand Up @@ -17898,6 +17902,11 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)

_LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS));

//########################## TrinityRP
// DisplayID (morph) load
_LoadDisplayId(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DISPLAYID));
//########################## TrinityRP

return true;
}

Expand Down Expand Up @@ -19527,6 +19536,10 @@ void Player::SaveToDB(bool create /*=false*/)
GetSession()->SaveTutorialsData(trans); // changed only while character in game
_SaveGlyphs(trans);
_SaveInstanceTimeRestrictions(trans);
//########################## TrinityRP
// DisplayID (morph) save
_SaveDisplayId (trans);
//########################## TrinityRP

// check if stats should only be saved on logout
// save stats can be out of transaction
Expand Down
12 changes: 12 additions & 0 deletions src/server/game/Entities/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,10 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES = 30,
PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS = 31,
PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS = 32,
//########################## TrinityRP
// DisplayID (morph) load
PLAYER_LOGIN_QUERY_LOAD_DISPLAYID = 33,
//########################## TrinityRP
MAX_PLAYER_LOGIN_QUERY
};

Expand Down Expand Up @@ -2416,6 +2420,10 @@ class Player : public Unit, public GridObject<Player>
void _LoadGlyphs(PreparedQueryResult result);
void _LoadTalents(PreparedQueryResult result);
void _LoadInstanceTimeRestrictions(PreparedQueryResult result);
//########################## TrinityRP
// DisplayID (morph) load
void _LoadDisplayId(PreparedQueryResult result);
//########################## TrinityRP

/*********************************************************/
/*** SAVE SYSTEM ***/
Expand All @@ -2438,6 +2446,10 @@ class Player : public Unit, public GridObject<Player>
void _SaveTalents(SQLTransaction& trans);
void _SaveStats(SQLTransaction& trans);
void _SaveInstanceTimeRestrictions(SQLTransaction& trans);
//########################## TrinityRP
// DisplayID (morph) save
void _SaveDisplayId(SQLTransaction& trans);
//########################## TrinityRP

/*********************************************************/
/*** ENVIRONMENTAL SYSTEM ***/
Expand Down
29 changes: 29 additions & 0 deletions src/server/game/Entities/Player/RPPlayer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//########################## TrinityRP
#include "Player.h"

// DisplayID (morph)
void Player::_SaveDisplayId(SQLTransaction& trans)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DISPLAYID);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt32 (1 , GetDisplayId ());
stmt->setUInt32(2, GetDisplayId ());
trans->Append(stmt);
}

void Player::_LoadDisplayId(PreparedQueryResult result)
{
m_monthlyquests.clear();

if (result)
{
Field* fields = result->Fetch();
uint32 displayid = fields[0].GetUInt32();
SetDisplayId (displayid);
TC_LOG_DEBUG("entities.player.loading", "Display ID {%u} for player (GUID: %u)", displayid, GetGUIDLow());
}

m_MonthlyQuestChanged = false;
}

//########################## TrinityRP
8 changes: 8 additions & 0 deletions src/server/game/Entities/Player/RPPlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//########################## TrinityRP
#ifndef RPPLAYER
#define RPPLAYER



#endif // RPPLAYER
//########################## TrinityRP
7 changes: 7 additions & 0 deletions src/server/game/Handlers/CharacterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ bool LoginQueryHolder::Initialize()
stmt->setUInt32(0, m_accountId);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, stmt);

//########################## TrinityRP
// DisplayID (morph) load
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_DISPLAYID);
stmt->setUInt32(0, lowGuid);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DISPLAYID, stmt);
//########################## TrinityRP

return res;
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/scripts/Commands/cs_modify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ class modify_commandscript : public CommandScript
uint16 display_id = (uint16)atoi((char*)args);

Unit* target = handler->getSelectedUnit();
if (!target)
if (!target || !(handler->GetSession ()->GetPlayer ()->IsGameMaster ())) //########################## TrinityRP // DisplayID (morph)
target = handler->GetSession()->GetPlayer();

// check online security
Expand Down Expand Up @@ -1383,7 +1383,7 @@ class modify_commandscript : public CommandScript
static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/)
{
Unit* target = handler->getSelectedUnit();
if (!target)
if (!target || !(handler->GetSession ()->GetPlayer ()->IsGameMaster ())) //########################## TrinityRP // DisplayID (morph)
target = handler->GetSession()->GetPlayer();

// check online security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,4 +610,10 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE, "UPDATE quest_tracker SET completed_by_gm = 1 WHERE id = ? AND character_guid = ? ORDER BY quest_accept_time DESC LIMIT 1", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME, "UPDATE quest_tracker SET quest_complete_time = NOW() WHERE id = ? AND character_guid = ? ORDER BY quest_accept_time DESC LIMIT 1", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_QUEST_TRACK_ABANDON_TIME, "UPDATE quest_tracker SET quest_abandon_time = NOW() WHERE id = ? AND character_guid = ? ORDER BY quest_accept_time DESC LIMIT 1", CONNECTION_ASYNC);

//########################## TrinityRP
// DisplayID (morph) "UPDATE character_displayid SET displayid = ? WHERE guid = ?"
PrepareStatement(CHAR_UPD_DISPLAYID, "INSERT INTO character_displayid (guid, displayid) VALUES (?, ?) ON DUPLICATE KEY UPDATE displayid = ?;", CONNECTION_ASYNC); //save
PrepareStatement(CHAR_SEL_DISPLAYID, "SELECT displayid FROM character_displayid WHERE guid = ?", CONNECTION_ASYNC); //load
//########################## TrinityRP
}
7 changes: 7 additions & 0 deletions src/server/shared/Database/Implementation/CharacterDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,13 @@ enum CharacterDatabaseStatements
CHAR_UPD_QUEST_TRACK_COMPLETE_TIME,
CHAR_UPD_QUEST_TRACK_ABANDON_TIME,

//########################## TrinityRP
// DisplayID (morph)
CHAR_UPD_DISPLAYID, //save
CHAR_SEL_DISPLAYID, //load
//########################## TrinityRP


MAX_CHARACTERDATABASE_STATEMENTS
};

Expand Down