Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/World/World.h
This commit is contained in:
郑佩茹
2023-02-09 12:40:25 -07:00
1253 changed files with 114535 additions and 40950 deletions

View File

@@ -120,7 +120,7 @@ public:
else
{
sCharacterCache->AddCharacterCacheEntry(cPlayer->GetGUID(), cPlayer->GetSession()->GetAccountId(), cPlayer->GetName(),
cPlayer->getGender(), cPlayer->getRace(), cPlayer->getClass(), cPlayer->getLevel());
cPlayer->getGender(), cPlayer->getRace(), cPlayer->getClass(), cPlayer->GetLevel());
}
sCharacterCache->UpdateCharacterAccountId(cPlayer->GetGUID(), cPlayer->GetSession()->GetAccountId());

View File

@@ -56,6 +56,17 @@ public:
return commandTable;
}
static bool CheckSpellCastResult(ChatHandler* handler, SpellCastResult result)
{
if (result != SPELL_CAST_OK)
{
handler->PSendSysMessage(LANG_CMD_CAST_ERROR_CODE, EnumUtils::ToTitle(SpellCastResult(result)), result);
return false;
}
return true;
}
static bool CheckSpellExistsAndIsValid(ChatHandler* handler, SpellInfo const* spell)
{
if (!spell)
@@ -103,7 +114,11 @@ public:
if (!triggerFlags)
return false;
handler->GetSession()->GetPlayer()->CastSpell(target, spell->Id, *triggerFlags);
if (!CheckSpellCastResult(handler, handler->GetSession()->GetPlayer()->CastSpell(target, spell->Id, *triggerFlags)))
{
handler->SetSentErrorMessage(true);
return false;
}
return true;
}
@@ -125,7 +140,11 @@ public:
if (!triggerFlags)
return false;
caster->CastSpell(handler->GetSession()->GetPlayer(), spell->Id, *triggerFlags);
if (!CheckSpellCastResult(handler, caster->CastSpell(handler->GetSession()->GetPlayer(), spell->Id, *triggerFlags)))
{
handler->SetSentErrorMessage(true);
return false;
}
return true;
}
@@ -141,7 +160,12 @@ public:
float x, y, z;
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
handler->GetSession()->GetPlayer()->CastSpell(x, y, z, spell->Id, *triggerFlags);
if (!CheckSpellCastResult(handler, handler->GetSession()->GetPlayer()->CastSpell(x, y, z, spell->Id, *triggerFlags)))
{
handler->SetSentErrorMessage(true);
return false;
}
return true;
}
@@ -163,7 +187,11 @@ public:
if (!triggerFlags)
return false;
target->CastSpell(target, spell->Id, *triggerFlags);
if (!CheckSpellCastResult(handler, target->CastSpell(target, spell->Id, *triggerFlags)))
{
handler->SetSentErrorMessage(true);
return false;
}
return true;
}
@@ -192,7 +220,11 @@ public:
if (!triggerFlags)
return false;
caster->CastSpell(caster->GetVictim(), spell->Id, *triggerFlags);
if (!CheckSpellCastResult(handler, caster->CastSpell(caster->GetVictim(), spell->Id, *triggerFlags)))
{
handler->SetSentErrorMessage(true);
return false;
}
return true;
}
@@ -214,7 +246,11 @@ public:
if (!triggerFlags)
return false;
caster->CastSpell(x, y, z, spell->Id, *triggerFlags);
if (!CheckSpellCastResult(handler, caster->CastSpell(x, y, z, spell->Id, *triggerFlags)))
{
handler->SetSentErrorMessage(true);
return false;
}
return true;
}

View File

@@ -437,7 +437,7 @@ public:
if (!player)
return false;
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->getLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
if (newlevel < 1)
return false; // invalid level
@@ -762,7 +762,7 @@ public:
if (!player)
return false;
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->getLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
int16 newlevel = static_cast<int16>(oldlevel) + level;
if (newlevel < 1)

View File

@@ -119,7 +119,7 @@ public:
static bool HandleGoGameObjectSpawnIdCommand(ChatHandler* handler, uint32 spawnId)
{
GameObjectData const* spawnpoint = sObjectMgr->GetGOData(spawnId);
GameObjectData const* spawnpoint = sObjectMgr->GetGameObjectData(spawnId);
if (!spawnpoint)
{
handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);

View File

@@ -148,7 +148,7 @@ public:
}
/// @todo is it really necessary to add both the real and DB table guid here ?
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow));
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGameObjectData(guidLow));
handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, uint32(objectId), objectInfo->name.c_str(), guidLow, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
return true;
@@ -402,9 +402,9 @@ public:
object->Relocate(pos);
// update which cell has this gameobject registered for loading
sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGOData());
sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGameObjectData());
object->SaveToDB();
sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGOData());
sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGameObjectData());
// Generate a completely new spawn with new guid
// 3.3.5a client caches recently deleted objects and brings them back to life
@@ -509,7 +509,7 @@ public:
if (isGuid || data.holds_alternative<Hyperlink<gameobject>>())
{
spawnId = *data;
GameObjectData const* spawnData = sObjectMgr->GetGOData(spawnId);
GameObjectData const* spawnData = sObjectMgr->GetGameObjectData(spawnId);
if (!spawnData)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, spawnId);

View File

@@ -1966,7 +1966,7 @@ public:
accId = playerTarget->GetSession()->GetAccountId();
money = playerTarget->GetMoney();
totalPlayerTime = playerTarget->GetTotalPlayedTime();
level = playerTarget->getLevel();
level = playerTarget->GetLevel();
latency = playerTarget->GetSession()->GetLatency();
raceid = playerTarget->getRace();
classid = playerTarget->getClass();

View File

@@ -613,7 +613,7 @@ public:
std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);
handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetSpawnId(), target->GetGUID().GetCounter(), entry, id1, id2, id3, displayid, nativeid, faction, npcflags);
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->GetLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUnitFlags(), target->GetUnitFlags2(), target->GetDynamicFlags(), target->GetFaction());

View File

@@ -59,7 +59,7 @@ public:
}
else if (type == "autobroadcast")
{
if (player->getLevel() < sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE))
if (player->GetLevel() < sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE))
{
handler->SetSentErrorMessage(true);
handler->PSendSysMessage(LANG_CMD_AUTOBROADCAST_LVL_ERROR, sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE));

View File

@@ -337,7 +337,7 @@ public:
}
// If the quest requires money
int32 ReqOrRewMoney = quest->GetRewOrReqMoney(player->getLevel());
int32 ReqOrRewMoney = quest->GetRewOrReqMoney(player->GetLevel());
if (ReqOrRewMoney < 0)
{
player->ModifyMoney(-ReqOrRewMoney);

View File

@@ -132,7 +132,7 @@ public:
if (!HandleResetStatsOrLevelHelper(target))
return false;
uint8 oldLevel = target->getLevel();
uint8 oldLevel = target->GetLevel();
// set starting level
uint32 startLevel = target->getClass() != CLASS_DEATH_KNIGHT