Skip to content

Commit

Permalink
Fixed up some discord messages for dark souls 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
TLeonardUK committed Jan 10, 2024
1 parent f43772c commit 26e5bed
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ MessageHandleResult DS2_PlayerDataManager::Handle_RequestUpdatePlayerStatus(Game
return MessageHandleResult::Error;
}

State.SetHasInitialState(true);


#if 0

static DiffTracker Tracker;
Expand Down Expand Up @@ -320,6 +317,37 @@ MessageHandleResult DS2_PlayerDataManager::Handle_RequestUpdatePlayerStatus(Game

#endif

// Send discord notification when the user lights a bonfire.
if (State.GetPlayerStatus().has_stats_info())
{
std::vector<uint32_t>& litBonfires = State.GetLitBonfires_Mutable();

for (size_t i = 0; i < State.GetPlayerStatus().stats_info().unlocked_bonfires_size(); i++)
{
uint32_t bonfireId = State.GetPlayerStatus().stats_info().unlocked_bonfires(i);
if (auto Iter = std::find(litBonfires.begin(), litBonfires.end(), bonfireId); Iter == litBonfires.end())
{
if (State.GetHasInitialState())
{
std::string BonfireName = GetEnumString<DS2_BonfireId>((DS2_BonfireId)bonfireId);

LogS(Client->GetName().c_str(), "Has lit bonfire %i (%s).", bonfireId, BonfireName.c_str());

if (!BonfireName.empty())
{
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::BonfireLit,
StringFormat("Lit the '%s' bonfire.", BonfireName.c_str())
);
}
}

litBonfires.push_back(bonfireId);
}
}
}

State.SetHasInitialState(true);

return MessageHandleResult::Handled;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,24 @@ MessageHandleResult DS2_QuickMatchManager::Handle_RequestRegisterQuickMatch(Game
return MessageHandleResult::Error;
}

if (ServerInstance->GetConfig().SendDiscordNotice_QuickMatch)
{
std::string ModeName = "";
switch (NewMatch->GameMode)
{
case DS2_Frpg2RequestMessage::QuickMatchGameMode::QuickMatchGameMode_Blue: ModeName = "Blue Sentinel"; break;
case DS2_Frpg2RequestMessage::QuickMatchGameMode::QuickMatchGameMode_Brotherhood: ModeName = "Brotherhood of Blood"; break;
}

ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::UndeadMatch,
StringFormat("Started a public '%s' undead match.", ModeName.c_str()),
0,
{
{ "Soul Memory", std::to_string(Client->GetPlayerState().GetSoulMemory()), true },
}
);
}

return MessageHandleResult::Handled;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ MessageHandleResult DS2_SignManager::Handle_RequestCreateSign(GameClient* Client
if (Sign->Type == DS2_Frpg2RequestMessage::SignType_RedSoapstone)
{
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSignPvP,
StringFormat("Placed a red summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
StringFormat("Placed a red summon sign in '%s'.", GetEnumString((DS2_OnlineAreaId)Sign->OnlineAreaId).c_str()),
0,
{
{ "Soul Memory", std::to_string(Client->GetPlayerState().GetSoulMemory()), true },
Expand All @@ -272,7 +272,7 @@ MessageHandleResult DS2_SignManager::Handle_RequestCreateSign(GameClient* Client
else
{
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSign,
StringFormat("Placed a summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
StringFormat("Placed a summon sign in '%s'.", GetEnumString((DS2_OnlineAreaId)Sign->OnlineAreaId).c_str()),
0,
{
{ "Soul Memory", std::to_string(Client->GetPlayerState().GetSoulMemory()), true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ MessageHandleResult DS3_SignManager::Handle_RequestCreateSign(GameClient* Client
if (Sign->Type == DS3_Frpg2RequestMessage::SignType_RedSoapstone)
{
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSignPvP,
StringFormat("Placed a public red summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
StringFormat("Placed a public red summon sign in '%s'.", GetEnumString((DS3_OnlineAreaId)Sign->OnlineAreaId).c_str()),
0,
{
{ "Soul Level", std::to_string(Client->GetPlayerState().GetSoulLevel()), true },
Expand All @@ -280,7 +280,7 @@ MessageHandleResult DS3_SignManager::Handle_RequestCreateSign(GameClient* Client
else
{
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSign,
StringFormat("Placed a public summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
StringFormat("Placed a public summon sign in '%s'.", GetEnumString((DS3_OnlineAreaId)Sign->OnlineAreaId).c_str()),
0,
{
{ "Soul Level", std::to_string(Client->GetPlayerState().GetSoulLevel()), true },
Expand Down

0 comments on commit 26e5bed

Please sign in to comment.