Merge branch 'main' into PetFixes

This commit is contained in:
jadebenn
2023-12-27 22:36:39 -06:00
67 changed files with 279 additions and 268 deletions

View File

@@ -242,7 +242,7 @@ void Loot::GiveActivityLoot(Entity* player, Entity* source, uint32_t activityID,
GiveLoot(player, selectedReward->LootMatrixIndex, eLootSourceType::ACTIVITY);
uint32_t coins = (int)(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
uint32_t coins = static_cast<uint32_t>(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
auto* character = player->GetCharacter();
@@ -280,7 +280,7 @@ void Loot::DropLoot(Entity* player, Entity* killedObject, std::unordered_map<LOT
}
}
uint32_t coins = (int)(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
uint32_t coins = static_cast<uint32_t>(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
GameMessages::SendDropClientLoot(player, source, LOT_NULL, coins, spawnPosition);
}

View File

@@ -19,7 +19,7 @@ std::map<uint32_t, Precondition*> Preconditions::cache = {};
Precondition::Precondition(const uint32_t condition) {
auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT type, targetLOT, targetCount FROM Preconditions WHERE id = ?;");
query.bind(1, (int)condition);
query.bind(1, static_cast<int>(condition));
auto result = query.execQuery();

View File

@@ -1358,9 +1358,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
if (dest) {
dest->SetHealth((int)dest->GetMaxHealth());
dest->SetArmor((int)dest->GetMaxArmor());
dest->SetImagination((int)dest->GetMaxImagination());
dest->SetHealth(static_cast<int32_t>(dest->GetMaxHealth()));
dest->SetArmor(static_cast<int32_t>(dest->GetMaxArmor()));
dest->SetImagination(static_cast<int32_t>(dest->GetMaxImagination()));
}
Game::entityManager->SerializeEntity(entity);
@@ -1484,7 +1484,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
int32_t type;
if (args.size() >= 2 && GeneralUtils::TryParse(args[1], type)) {
lootType = (eLootSourceType)type;
lootType = static_cast<eLootSourceType>(type);
}
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), uscore, lootType);
@@ -1524,7 +1524,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (!characterComponent) return;
auto levelComponent = entity->GetComponent<LevelProgressionComponent>();
auto query = CDClientDatabase::CreatePreppedStmt("SELECT requiredUScore from LevelProgressionLookup WHERE id = ?;");
query.bind(1, (int)requestedLevel);
query.bind(1, static_cast<int>(requestedLevel));
auto result = query.execQuery();
if (result.eof()) return;
@@ -1908,13 +1908,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
ChatPackets::SendSystemMessage(
sysAddr,
u"Peak RSS: " + GeneralUtils::to_u16string((float)((double)Metrics::GetPeakRSS() / 1.024e6)) +
u"Peak RSS: " + GeneralUtils::to_u16string(static_cast<float>(static_cast<double>(Metrics::GetPeakRSS()) / 1.024e6)) +
u"MB"
);
ChatPackets::SendSystemMessage(
sysAddr,
u"Current RSS: " + GeneralUtils::to_u16string((float)((double)Metrics::GetCurrentRSS() / 1.024e6)) +
u"Current RSS: " + GeneralUtils::to_u16string(static_cast<float>(static_cast<double>(Metrics::GetCurrentRSS()) / 1.024e6)) +
u"MB"
);
@@ -1959,7 +1959,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
totalRuns += 1;
bool doBreak = false;
for (const auto& kv : lootRoll) {
if ((uint32_t)kv.first == targetLot) {
if (static_cast<uint32_t>(kv.first) == targetLot) {
doBreak = true;
}
}
@@ -1974,7 +1974,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
+ u" times. It ran "
+ GeneralUtils::to_u16string(totalRuns)
+ u" times. Averaging out at "
+ GeneralUtils::to_u16string((float)totalRuns / loops);
+ GeneralUtils::to_u16string(static_cast<float>(totalRuns) / loops);
ChatPackets::SendSystemMessage(sysAddr, message);
}