Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/Guilds/Guild.cpp
This commit is contained in:
郑佩茹
2022-11-18 10:21:36 -07:00
312 changed files with 104564 additions and 1583 deletions

View File

@@ -72,6 +72,7 @@ public:
{ "customize", HandleCharacterCustomizeCommand, SEC_GAMEMASTER, Console::Yes },
{ "changefaction", HandleCharacterChangeFactionCommand, SEC_GAMEMASTER, Console::Yes },
{ "changerace", HandleCharacterChangeRaceCommand, SEC_GAMEMASTER, Console::Yes },
{ "changeaccount", HandleCharacterChangeAccountCommand, SEC_ADMINISTRATOR, Console::Yes },
{ "check", characterCheckCommandTable },
{ "erase", HandleCharacterEraseCommand, SEC_CONSOLE, Console::Yes },
{ "deleted", characterDeletedCommandTable },
@@ -381,6 +382,8 @@ public:
{
target->SetName(newName);
ObjectAccessor::UpdatePlayerNameMapReference(player->GetName(), target);
if (WorldSession* session = target->GetSession())
session->KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
}
@@ -1059,6 +1062,55 @@ public:
handler->PSendSysMessage("--------------------------------------");
return true;
}
static bool HandleCharacterChangeAccountCommand(ChatHandler* handler, std::string accountName, Optional<PlayerIdentifier> player)
{
if (!player)
{
player = PlayerIdentifier::FromTargetOrSelf(handler);
}
if (!player)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
return false;
}
if (uint32 accountId = AccountMgr::GetId(accountName))
{
if (AccountMgr::GetCharactersCount(accountId) >= 10)
{
handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName, accountId);
handler->SetSentErrorMessage(true);
return true;
}
if (CharacterCacheEntry const* cache = sCharacterCache->GetCharacterCacheByName(player->GetName()))
{
std::string accName;
AccountMgr::GetName(cache->AccountId, accName);
handler->PSendSysMessage(LANG_CMD_CHAR_CHANGE_ACC_SUCCESS, player->GetName(), player->GetGUID().GetCounter(), accName, cache->AccountId, accountName, accountId);
}
if (player->IsConnected())
{
player->GetConnectedPlayer()->GetSession()->KickPlayer("CMD char changeaccount");
}
CharacterDatabase.Query("UPDATE characters SET account = {} WHERE guid = {}", accountId, player->GetGUID().GetCounter());
sCharacterCache->UpdateCharacterAccountId(player->GetGUID(), accountId);
}
else
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
handler->SetSentErrorMessage(true);
return true;
}
return true;
}
};
void AddSC_character_commandscript()

View File

@@ -33,7 +33,7 @@ public:
{
static ChatCommandTable groupCommandTable =
{
{ "list", HandleGroupListCommand, SEC_GAMEMASTER, Console::No },
{ "list", HandleGroupListCommand, SEC_GAMEMASTER, Console::Yes },
{ "join", HandleGroupJoinCommand, SEC_GAMEMASTER, Console::No },
{ "remove", HandleGroupRemoveCommand, SEC_GAMEMASTER, Console::No },
{ "disband", HandleGroupDisbandCommand, SEC_GAMEMASTER, Console::No },
@@ -219,7 +219,7 @@ public:
return true;
}
handler->PSendSysMessage(LANG_GROUP_TYPE, (groupTarget->isRaidGroup() ? "raid" : "party"));
handler->PSendSysMessage(LANG_GROUP_TYPE, (groupTarget->isRaidGroup() ? "Raid" : "Party"), groupTarget->GetMembersCount());
for (auto const& slot : groupTarget->GetMemberSlots())
{

View File

@@ -195,9 +195,12 @@ public:
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
continue;
player->LearnTalent(talentInfo->TalentID, rankId);
player->LearnTalent(talentInfo->TalentID, rankId, true);
}
player->SetFreeTalentPoints(0);
player->SendTalentsInfoData(false);
handler->SendSysMessage(LANG_COMMAND_LEARN_CLASS_TALENTS);
return true;
}

View File

@@ -1399,7 +1399,7 @@ public:
if (location->empty() || *location == "inn")
{
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->m_homebindO);
return true;
}

View File

@@ -61,7 +61,7 @@ public:
return commandTable;
}
static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> para)
static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> param)
{
if (!MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{
@@ -81,13 +81,19 @@ public:
}
bool useStraightPath = false;
if (StringStartsWith("true", *para))
useStraightPath = true;
bool useRaycast = false;
if (StringStartsWith("line", *para) || StringStartsWith("ray", *para) || StringStartsWith("raycast", *para))
if (param)
{
useRaycast = true;
auto paramValue = param.value();
if (paramValue.starts_with("true"))
{
useStraightPath = true;
}
if (paramValue.starts_with("line") || paramValue.starts_with("ray") || paramValue.starts_with("raycast"))
{
useRaycast = true;
}
}
// unit locations

View File

@@ -252,7 +252,7 @@ public:
else if (targetGuid)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->SetData(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
stmt->SetData(0, uint16(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS));
stmt->SetData(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);

View File

@@ -182,7 +182,7 @@ public:
if (where.index() == 1) // References target's homebind
{
if (Player* target = player->GetConnectedPlayer())
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->m_homebindO);
else
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);