-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
skymp5-server/cpp/server_guest_lib/gamemode_events/UpdateAppearanceAttemptEvent.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "UpdateAppearanceAttemptEvent.h" | ||
|
||
#include "MpActor.h" | ||
#include <spdlog/spdlog.h> | ||
|
||
UpdateAppearanceAttemptEvent::UpdateAppearanceAttemptEvent( | ||
MpActor* actor_, const Appearance& appearance_, bool isAllowed_) | ||
: actor(actor_) | ||
, appearance(appearance_) | ||
, isAllowed(isAllowed_) | ||
{ | ||
} | ||
|
||
const char* UpdateAppearanceAttemptEvent::GetName() const | ||
{ | ||
return "onUpdateAppearanceAttempt"; | ||
} | ||
|
||
std::string UpdateAppearanceAttemptEvent::GetArgumentsJsonArray() const | ||
{ | ||
std::string result; | ||
result += "["; | ||
result += std::to_string(actor->GetFormId()); | ||
result += ","; | ||
result += appearance.ToJson().dump(); | ||
result += ","; | ||
result += isAllowed ? "true" : "false"; | ||
result += "]"; | ||
return result; | ||
} | ||
|
||
void UpdateAppearanceAttemptEvent::OnFireSuccess(WorldState* worldState) | ||
{ | ||
} | ||
|
||
void UpdateAppearanceAttemptEvent::OnFireBlocked(WorldState* worldState) | ||
{ | ||
spdlog::warn( | ||
"UpdateAppearanceAttemptEvent::OnFireBlocked - Not implemented. Please " | ||
"consider never blocking {} event in gamemode", | ||
GetName()); | ||
} |
25 changes: 25 additions & 0 deletions
25
skymp5-server/cpp/server_guest_lib/gamemode_events/UpdateAppearanceAttemptEvent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include "GameModeEvent.h" | ||
|
||
class MpActor; | ||
|
||
#include "Appearance.h" | ||
|
||
class UpdateAppearanceAttemptEvent : public GameModeEvent | ||
{ | ||
public: | ||
UpdateAppearanceAttemptEvent(MpActor* actor_, const Appearance& appearance_, | ||
bool isAllowed_); | ||
|
||
const char* GetName() const override; | ||
|
||
std::string GetArgumentsJsonArray() const override; | ||
|
||
private: | ||
void OnFireSuccess(WorldState* worldState) override; | ||
void OnFireBlocked(WorldState* worldState) override; | ||
|
||
MpActor* actor = nullptr; | ||
Appearance appearance; | ||
bool isAllowed = false; | ||
}; |