Skip to content

Commit 26e5bed

Browse files
committed
Fixed up some discord messages for dark souls 2.
1 parent f43772c commit 26e5bed

File tree

4 files changed

+53
-7
lines changed

4 files changed

+53
-7
lines changed

Source/Server.DarkSouls2/Server/GameService/GameManagers/PlayerData/DS2_PlayerDataManager.cpp

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,6 @@ MessageHandleResult DS2_PlayerDataManager::Handle_RequestUpdatePlayerStatus(Game
265265
return MessageHandleResult::Error;
266266
}
267267

268-
State.SetHasInitialState(true);
269-
270-
271268
#if 0
272269

273270
static DiffTracker Tracker;
@@ -320,6 +317,37 @@ MessageHandleResult DS2_PlayerDataManager::Handle_RequestUpdatePlayerStatus(Game
320317

321318
#endif
322319

320+
// Send discord notification when the user lights a bonfire.
321+
if (State.GetPlayerStatus().has_stats_info())
322+
{
323+
std::vector<uint32_t>& litBonfires = State.GetLitBonfires_Mutable();
324+
325+
for (size_t i = 0; i < State.GetPlayerStatus().stats_info().unlocked_bonfires_size(); i++)
326+
{
327+
uint32_t bonfireId = State.GetPlayerStatus().stats_info().unlocked_bonfires(i);
328+
if (auto Iter = std::find(litBonfires.begin(), litBonfires.end(), bonfireId); Iter == litBonfires.end())
329+
{
330+
if (State.GetHasInitialState())
331+
{
332+
std::string BonfireName = GetEnumString<DS2_BonfireId>((DS2_BonfireId)bonfireId);
333+
334+
LogS(Client->GetName().c_str(), "Has lit bonfire %i (%s).", bonfireId, BonfireName.c_str());
335+
336+
if (!BonfireName.empty())
337+
{
338+
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::BonfireLit,
339+
StringFormat("Lit the '%s' bonfire.", BonfireName.c_str())
340+
);
341+
}
342+
}
343+
344+
litBonfires.push_back(bonfireId);
345+
}
346+
}
347+
}
348+
349+
State.SetHasInitialState(true);
350+
323351
return MessageHandleResult::Handled;
324352
}
325353

Source/Server.DarkSouls2/Server/GameService/GameManagers/QuickMatch/DS2_QuickMatchManager.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,24 @@ MessageHandleResult DS2_QuickMatchManager::Handle_RequestRegisterQuickMatch(Game
206206
return MessageHandleResult::Error;
207207
}
208208

209+
if (ServerInstance->GetConfig().SendDiscordNotice_QuickMatch)
210+
{
211+
std::string ModeName = "";
212+
switch (NewMatch->GameMode)
213+
{
214+
case DS2_Frpg2RequestMessage::QuickMatchGameMode::QuickMatchGameMode_Blue: ModeName = "Blue Sentinel"; break;
215+
case DS2_Frpg2RequestMessage::QuickMatchGameMode::QuickMatchGameMode_Brotherhood: ModeName = "Brotherhood of Blood"; break;
216+
}
217+
218+
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::UndeadMatch,
219+
StringFormat("Started a public '%s' undead match.", ModeName.c_str()),
220+
0,
221+
{
222+
{ "Soul Memory", std::to_string(Client->GetPlayerState().GetSoulMemory()), true },
223+
}
224+
);
225+
}
226+
209227
return MessageHandleResult::Handled;
210228
}
211229

Source/Server.DarkSouls2/Server/GameService/GameManagers/Signs/DS2_SignManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ MessageHandleResult DS2_SignManager::Handle_RequestCreateSign(GameClient* Client
262262
if (Sign->Type == DS2_Frpg2RequestMessage::SignType_RedSoapstone)
263263
{
264264
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSignPvP,
265-
StringFormat("Placed a red summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
265+
StringFormat("Placed a red summon sign in '%s'.", GetEnumString((DS2_OnlineAreaId)Sign->OnlineAreaId).c_str()),
266266
0,
267267
{
268268
{ "Soul Memory", std::to_string(Client->GetPlayerState().GetSoulMemory()), true },
@@ -272,7 +272,7 @@ MessageHandleResult DS2_SignManager::Handle_RequestCreateSign(GameClient* Client
272272
else
273273
{
274274
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSign,
275-
StringFormat("Placed a summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
275+
StringFormat("Placed a summon sign in '%s'.", GetEnumString((DS2_OnlineAreaId)Sign->OnlineAreaId).c_str()),
276276
0,
277277
{
278278
{ "Soul Memory", std::to_string(Client->GetPlayerState().GetSoulMemory()), true },

Source/Server.DarkSouls3/Server/GameService/GameManagers/Signs/DS3_SignManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ MessageHandleResult DS3_SignManager::Handle_RequestCreateSign(GameClient* Client
269269
if (Sign->Type == DS3_Frpg2RequestMessage::SignType_RedSoapstone)
270270
{
271271
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSignPvP,
272-
StringFormat("Placed a public red summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
272+
StringFormat("Placed a public red summon sign in '%s'.", GetEnumString((DS3_OnlineAreaId)Sign->OnlineAreaId).c_str()),
273273
0,
274274
{
275275
{ "Soul Level", std::to_string(Client->GetPlayerState().GetSoulLevel()), true },
@@ -280,7 +280,7 @@ MessageHandleResult DS3_SignManager::Handle_RequestCreateSign(GameClient* Client
280280
else
281281
{
282282
ServerInstance->SendDiscordNotice(Client->shared_from_this(), DiscordNoticeType::SummonSign,
283-
StringFormat("Placed a public summon sign in '%s'.", GetEnumString(Sign->OnlineAreaId).c_str()),
283+
StringFormat("Placed a public summon sign in '%s'.", GetEnumString((DS3_OnlineAreaId)Sign->OnlineAreaId).c_str()),
284284
0,
285285
{
286286
{ "Soul Level", std::to_string(Client->GetPlayerState().GetSoulLevel()), true },

0 commit comments

Comments
 (0)