Skip to content

Commit c13ec5a

Browse files
authored
[Repositories] Cleanup and Convert Character Creation to Repositories (#4053)
* [Repositories] Cleanup and Convert Character Creation to Repositories # Notes - Converts `Database::GetCharacterID()`, `Database::SaveCharacterCreate()`, and `Client::OPCharCreate` to repositories. - Cleanup a spot we were doing a queries in a loop. * Cleanup * Update database.cpp * Update database.cpp
1 parent d182fc3 commit c13ec5a

File tree

10 files changed

+300
-488
lines changed

10 files changed

+300
-488
lines changed

common/database.cpp

Lines changed: 166 additions & 339 deletions
Large diffs are not rendered by default.

common/database.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Database : public DBcore {
125125
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
126126
uint32 GetAccountIDByChar(uint32 char_id);
127127
uint32 GetAccountIDByName(std::string account_name, std::string loginserver, int16* status = 0, uint32* lsid = 0);
128-
uint32 GetCharacterID(const char *name);
128+
uint32 GetCharacterID(const std::string& name);
129129
uint32 GetCharacterInfo(std::string character_name, uint32 *account_id, uint32 *zone_id, uint32 *instance_id);
130130
uint32 GetGuildIDByCharID(uint32 char_id);
131131
uint32 GetGroupIDByCharID(uint32 char_id);

common/eq_constants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,4 +1127,8 @@ namespace RaidLootType {
11271127
constexpr uint32 EntireRaid = 4;
11281128
}
11291129

1130+
namespace LeadershipAbilitySlot {
1131+
constexpr uint16 HealthOfTargetsTarget = 14;
1132+
}
1133+
11301134
#endif /*COMMON_EQ_CONSTANTS_H*/

world/adventure.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc
5656
{
5757
if(!PlayerExists(character_name))
5858
{
59-
int32 character_id = database.GetCharacterID(character_name.c_str());
59+
int32 character_id = database.GetCharacterID(character_name);
6060
if(character_id && add_client_to_instance)
6161
{
6262
database.AddClientToInstance(instance_id, character_id);
@@ -72,7 +72,7 @@ void Adventure::RemovePlayer(std::string character_name)
7272
{
7373
if((*iter).compare(character_name) == 0)
7474
{
75-
int32 character_id = database.GetCharacterID(character_name.c_str());
75+
int32 character_id = database.GetCharacterID(character_name);
7676
if (character_id)
7777
{
7878
database.RemoveClientFromInstance(instance_id, character_id);
@@ -312,7 +312,7 @@ void Adventure::Finished(AdventureWinStatus ws)
312312
}
313313

314314
zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
315-
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
315+
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter)), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
316316
delete pack;
317317
}
318318
else
@@ -337,7 +337,7 @@ void Adventure::Finished(AdventureWinStatus ws)
337337
afe.points = 0;
338338
}
339339
adventure_manager.AddFinishedEvent(afe);
340-
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
340+
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter)), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
341341
}
342342
}
343343
else
@@ -363,7 +363,7 @@ void Adventure::Finished(AdventureWinStatus ws)
363363
}
364364
adventure_manager.AddFinishedEvent(afe);
365365

366-
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
366+
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter)), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
367367
}
368368
++iter;
369369
}

0 commit comments

Comments
 (0)