Skip to content

Commit

Permalink
fix: style and bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed May 11, 2022
1 parent 5b12535 commit 4c4ceab
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Code/client/Games/ExtraDataList.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ExtraDataList
void SetHealth(float aHealth) noexcept;
void SetEnchantmentData(EnchantmentItem* apItem, uint16_t aCharge, bool aRemoveOnUnequip) noexcept;

bool HasQuestObjectAlias() noexcept;
[[nodiscard]] bool HasQuestObjectAlias() noexcept;

#if TP_FALLOUT4
void* unk0;
Expand Down
8 changes: 4 additions & 4 deletions Code/client/Games/References.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,20 +729,20 @@ void Actor::SpeakSound(const char* pFile)
ThisCall(RealSpeakSoundFunction, this, pFile, handle, 0, 0x32, 0, 0, 0, 0, 0, 0, 0, 1, 1);
}

TP_THIS_FUNCTION(TSetCurrentPickREFR, void, Console, BSPointerHandle<TESObjectREFR>* ahREFR);
TP_THIS_FUNCTION(TSetCurrentPickREFR, void, Console, BSPointerHandle<TESObjectREFR>* apRefr);
static TSetCurrentPickREFR* RealSetCurrentPickREFR = nullptr;

void TP_MAKE_THISCALL(HookSetCurrentPickREFR, Console, BSPointerHandle<TESObjectREFR>* ahREFR)
void TP_MAKE_THISCALL(HookSetCurrentPickREFR, Console, BSPointerHandle<TESObjectREFR>* apRefr)
{
uint32_t formId = 0;

TESObjectREFR* pObject = TESObjectREFR::GetByHandle(ahREFR->handle.iBits);
TESObjectREFR* pObject = TESObjectREFR::GetByHandle(apRefr->handle.iBits);
if (pObject)
formId = pObject->formID;

World::Get().GetDebugService().SetDebugId(formId);

return ThisCall(RealSetCurrentPickREFR, apThis, ahREFR);
return ThisCall(RealSetCurrentPickREFR, apThis, apRefr);
}

TiltedPhoques::Initializer s_referencesHooks([]()
Expand Down
2 changes: 1 addition & 1 deletion Code/client/Games/Skyrim/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ void TP_MAKE_THISCALL(HookUpdateDetectionState, ActorKnowledge, void* apState)
{
if (pOwnerActor->GetExtension()->IsRemotePlayer() && pTargetActor->GetExtension()->IsLocalPlayer())
{
spdlog::info("Cancelling detection from remote player to local player, owner: {:X}, target: {:X}", pOwner->formID, pTarget->formID);
spdlog::debug("Cancelling detection from remote player to local player, owner: {:X}, target: {:X}", pOwner->formID, pTarget->formID);
return;
}
}
Expand Down
10 changes: 5 additions & 5 deletions Code/client/Games/Skyrim/Events/EventDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ struct TESPlayerBowShotEvent

struct TESTopicInfoEvent
{
TESObjectREFR* hSpeakerRef;
void* pCallback;
uint32_t uiTopicInfoFormID;
int32_t eType;
uint16_t usStage;
TESObjectREFR* hSpeakerRef;
void* pCallback;
uint32_t uiTopicInfoFormID;
int32_t eType;
uint16_t usStage;
};

struct TESTrackedStatsEvent
Expand Down
2 changes: 1 addition & 1 deletion Code/client/Games/Skyrim/PlayerCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void TP_MAKE_THISCALL(HookAddSkillExperience, PlayerCharacter, int32_t aSkill, f

if (combatSkills.contains(aSkill))
{
spdlog::info("Set new last used combat skill to {}.", aSkill);
spdlog::debug("Set new last used combat skill to {}.", aSkill);
apThis->GetExtension()->LastUsedCombatSkill = aSkill;

World::Get().GetRunner().Trigger(AddExperienceEvent(deltaExperience));
Expand Down
3 changes: 3 additions & 0 deletions Code/client/Services/Generic/PlayerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ void PlayerService::OnCellChangeEvent(const CellChangeEvent& acEvent) const noex

void PlayerService::OnPlayerDialogueEvent(const PlayerDialogueEvent& acEvent) const noexcept
{
if (!m_transport.IsConnected())
return;

const auto& partyService = m_world.GetPartyService();
if (!partyService.IsInParty() || !partyService.IsLeader())
return;
Expand Down
3 changes: 3 additions & 0 deletions Code/server/GameServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Console::Setting bAllowMO2{"ModPolicy:bAllowMO2", "Allow clients running Mod Org
Console::Command<bool> TogglePremium("TogglePremium", "Toggle the premium mode",
[](Console::ArgStack& aStack) { bPremiumTickrate = aStack.Pop<bool>(); });

Console::Command<bool> TogglePvp("TogglePvp", "Toggle pvp",
[](Console::ArgStack& aStack) { bEnablePvp = aStack.Pop<bool>(); });

Console::Command<> ShowVersion("version", "Show the version the server was compiled with",
[](Console::ArgStack&) { spdlog::get("ConOut")->info("Server " BUILD_COMMIT); });
Console::Command<> CrashServer("crash", "Crashes the server, don't use!", [](Console::ArgStack&) {
Expand Down
12 changes: 8 additions & 4 deletions Code/server/Services/ActorValueService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ void ActorValueService::OnActorValueChanges(const PacketEvent<RequestActorValueC
notify.Id = acMessage.Packet.Id;
notify.Values = acMessage.Packet.Values;

GameServer::Get()->SendToPlayers(notify, acMessage.pPlayer);
const entt::entity cEntity = static_cast<entt::entity>(message.Id);
GameServer::Get()->SendToPlayersInRange(notify, cEntity, acMessage.pPlayer);
}

void ActorValueService::OnActorMaxValueChanges(const PacketEvent<RequestActorMaxValueChanges>& acMessage) const noexcept
Expand All @@ -65,7 +66,8 @@ void ActorValueService::OnActorMaxValueChanges(const PacketEvent<RequestActorMax
notify.Id = message.Id;
notify.Values = message.Values;

GameServer::Get()->SendToPlayers(notify, acMessage.pPlayer);
const entt::entity cEntity = static_cast<entt::entity>(message.Id);
GameServer::Get()->SendToPlayersInRange(notify, cEntity, acMessage.pPlayer);
}

void ActorValueService::OnHealthChangeBroadcast(const PacketEvent<RequestHealthChangeBroadcast>& acMessage) const noexcept
Expand All @@ -78,7 +80,8 @@ void ActorValueService::OnHealthChangeBroadcast(const PacketEvent<RequestHealthC
notify.Id = message.Id;
notify.DeltaHealth = message.DeltaHealth;

GameServer::Get()->SendToPlayers(notify, acMessage.pPlayer);
const entt::entity cEntity = static_cast<entt::entity>(message.Id);
GameServer::Get()->SendToPlayersInRange(notify, cEntity, acMessage.pPlayer);
}

void ActorValueService::OnDeathStateChange(const PacketEvent<RequestDeathStateChange>& acMessage) const noexcept
Expand All @@ -100,6 +103,7 @@ void ActorValueService::OnDeathStateChange(const PacketEvent<RequestDeathStateCh
notify.Id = message.Id;
notify.IsDead = message.IsDead;

GameServer::Get()->SendToPlayers(notify, acMessage.pPlayer);
const entt::entity cEntity = static_cast<entt::entity>(message.Id);
GameServer::Get()->SendToPlayersInRange(notify, cEntity, acMessage.pPlayer);
}

0 comments on commit 4c4ceab

Please sign in to comment.