Core/Misc: Moved CharacterInfo out of world to separate class
Port From (https://github.com/TrinityCore/TrinityCore/commit/ad4e63bae145ae49b584ab2fc621660430cec0d3)
This commit is contained in:
@@ -193,74 +193,6 @@ namespace Game
|
||||
dynamicFlags = data.dynamicflags;
|
||||
}
|
||||
}
|
||||
public static ObjectGuid GetPlayerGUIDByName(string name)
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUID_BY_NAME);
|
||||
stmt.AddValue(0, name);
|
||||
SQLResult result = DB.Characters.Query(stmt);
|
||||
|
||||
if (!result.IsEmpty())
|
||||
return ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0));
|
||||
|
||||
return ObjectGuid.Empty;
|
||||
}
|
||||
public static bool GetPlayerNameByGUID(ObjectGuid guid, out string name)
|
||||
{
|
||||
name = "";
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
name = player.GetName();
|
||||
return true;
|
||||
}
|
||||
|
||||
CharacterInfo characterInfo = Global.WorldMgr.GetCharacterInfo(guid);
|
||||
if (characterInfo == null)
|
||||
return false;
|
||||
|
||||
name = characterInfo.Name;
|
||||
return true;
|
||||
}
|
||||
public static bool GetPlayerNameAndClassByGUID(ObjectGuid guid, out string name, out byte _class)
|
||||
{
|
||||
name = "";
|
||||
_class = 0;
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
name = player.GetName();
|
||||
_class = (byte)player.GetClass();
|
||||
return true;
|
||||
}
|
||||
|
||||
CharacterInfo characterInfo = Global.WorldMgr.GetCharacterInfo(guid);
|
||||
if (characterInfo != null)
|
||||
{
|
||||
name = characterInfo.Name;
|
||||
_class = (byte)characterInfo.ClassID;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static Team GetPlayerTeamByGUID(ObjectGuid guid)
|
||||
{
|
||||
CharacterInfo characterInfo = Global.WorldMgr.GetCharacterInfo(guid);
|
||||
if (characterInfo != null)
|
||||
return Player.TeamForRace(characterInfo.RaceID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
public static uint GetPlayerAccountIdByGUID(ObjectGuid guid)
|
||||
{
|
||||
CharacterInfo characterInfo = Global.WorldMgr.GetCharacterInfo(guid);
|
||||
if (characterInfo != null)
|
||||
return characterInfo.AccountId;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ResponseCodes CheckPlayerName(string name, LocaleConstant locale, bool create = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user