@@ -171,6 +171,40 @@ namespace
171
171
}
172
172
}
173
173
174
+ // lazy and dumb function to convert player marks to string
175
+ std::string marksToString (PlayerMarks& marks) {
176
+ PlayerAttributesList attribute{ 0 };
177
+
178
+ // combine all the m_Marks to one attributeList
179
+ for (const auto & mark : marks.m_Marks )
180
+ {
181
+ attribute |= mark.m_Attributes ;
182
+ }
183
+
184
+ // only one attrib
185
+ if (attribute.count () == 1 ) {
186
+ std::size_t idx = 0 ;
187
+ while (idx < static_cast <std::size_t >(PlayerAttribute::COUNT) && !attribute.HasAttribute (static_cast <PlayerAttribute>(idx))) { ++idx; }
188
+
189
+ // if (idx == static_cast<std::size_t>(PlayerAttribute::COUNT)) {
190
+ // return "#Error!";
191
+ // }
192
+
193
+ return to_string (static_cast <PlayerAttribute>(idx));
194
+ }
195
+
196
+ std::string attrib_summary = " -----" ;
197
+
198
+ // loop over the attributes and combine using first character.
199
+ for (std::size_t i = 0 ; i < static_cast <std::size_t >(PlayerAttribute::COUNT); ++i) {
200
+ if (attribute.HasAttribute (static_cast <PlayerAttribute>(i))) {
201
+ attrib_summary.at (i) = to_string (PlayerAttribute::Cheater).at (0 );
202
+ }
203
+ }
204
+
205
+ return attrib_summary;
206
+ }
207
+
174
208
std::unique_ptr<IModeratorLogic> IModeratorLogic::Create (IWorldState& world,
175
209
const Settings& settings, IRCONActionManager& actionManager)
176
210
{
@@ -279,16 +313,54 @@ void ModeratorLogic::OnLocalPlayerInitialized(IWorldState & world, bool initiali
279
313
mh::fmtstr<128 > chatMsg;
280
314
281
315
int markedPlayerCount = 0 ;
316
+ std::vector<std::string> players;
317
+
282
318
for (IPlayer& player : m_World->GetLobbyMembers ())
283
319
{
284
320
if (!m_PlayerList.GetPlayerAttributes (player).empty ()) {
321
+ mh::fmtstr<128 > message;
322
+
323
+ auto marks = GetPlayerAttributes (player);
324
+
325
+ std::string username = player.GetNameSafe ();
326
+
327
+ // if username is none try getting data from steamapi
328
+ if (username == " " ) {
329
+ auto summary = player.GetPlayerSummary ();
330
+
331
+
332
+ if (summary.has_value ()) {
333
+ username = summary.value ().m_Nickname ;
334
+ }
335
+ else {
336
+ // steamapi didn't get the name either so gg
337
+ username = player.GetSteamID ().str ();
338
+ }
339
+ }
340
+
341
+ players.push_back (
342
+ message.fmt (
343
+ " {}: {} - {} ({})" ,
344
+ markedPlayerCount,
345
+ username,
346
+ marksToString (marks),
347
+ marks.m_Marks .front ().m_FileName
348
+ ).c_str ()
349
+ );
285
350
++markedPlayerCount;
351
+
352
+ // don't warn again, we're gona warn here.
353
+ player.GetOrCreateData <PlayerExtraData>().m_PartyWarned = true ;
286
354
}
287
355
}
288
356
289
357
chatMsg.fmt (" [tf2bd] Currently {} players are marked in this lobby." , markedPlayerCount);
290
358
291
- m_ActionManager->QueueAction <ChatMessageAction>(chatMsg.str (), ChatMessageType::PartyChat);
359
+ m_ActionManager->QueueAction <PartyChatMessageAction>(chatMsg.str ());
360
+
361
+ for (std::string player : players) {
362
+ m_ActionManager->QueueAction <PartyChatMessageAction>(player);
363
+ }
292
364
}
293
365
}
294
366
@@ -568,40 +640,6 @@ void ModeratorLogic::HandleConnectingEnemyCheaters(const std::vector<Cheater>& c
568
640
}
569
641
}
570
642
571
- // lazy and dumb function to convert player marks to string
572
- std::string marksToString (PlayerMarks& marks) {
573
- PlayerAttributesList attribute{ 0 };
574
-
575
- // combine all the m_Marks to one attributeList
576
- for (const auto & mark : marks.m_Marks )
577
- {
578
- attribute |= mark.m_Attributes ;
579
- }
580
-
581
- // only one attrib
582
- if (attribute.count () == 1 ) {
583
- std::size_t idx = 0 ;
584
- while (idx < static_cast <std::size_t >(PlayerAttribute::COUNT) && !attribute.HasAttribute (static_cast <PlayerAttribute>(idx))) ++idx;
585
-
586
- // if (idx == static_cast<std::size_t>(PlayerAttribute::COUNT)) {
587
- // return "#Error!";
588
- // }
589
-
590
- return to_string (static_cast <PlayerAttribute>(idx));
591
- }
592
-
593
- std::string attrib_summary = " -----" ;
594
-
595
- // loop over the attributes and combine using first character.
596
- for (std::size_t i = 0 ; i < static_cast <std::size_t >(PlayerAttribute::COUNT); ++i) {
597
- if (attribute.HasAttribute (static_cast <PlayerAttribute>(i))) {
598
- attrib_summary.at (i) = to_string (PlayerAttribute::Cheater).at (0 );
599
- }
600
- }
601
-
602
- return attrib_summary;
603
- }
604
-
605
643
void ModeratorLogic::HandleConnectingMarkedPlayers (const std::vector<Cheater>& connectingEnemyCheaters)
606
644
{
607
645
if (!m_Settings->m_AutoChatWarningsConnectingParty || connectingEnemyCheaters.size () < 1 ) {
@@ -648,7 +686,7 @@ void ModeratorLogic::HandleConnectingMarkedPlayers(const std::vector<Cheater>& c
648
686
username.replace (pos, 1 , " " );
649
687
}
650
688
651
- chatMsg.fmt (" [tf2bd] WARN: Marked Player ({}) Joining. ({})." , username, marksToString (marks));
689
+ chatMsg.fmt (" [tf2bd] WARN: Marked Player ({}) Joining ({} - {} )." , username, marksToString (marks), marks. m_Marks . front (). m_FileName );
652
690
}
653
691
else
654
692
{
@@ -684,7 +722,7 @@ void ModeratorLogic::HandleConnectingMarkedPlayers(const std::vector<Cheater>& c
684
722
name += " .." ;
685
723
}
686
724
687
- msg += mh::format (" {} - {}, " , name, marksToString (marks));
725
+ msg += mh::format (" {} - {}, " , name, marksToString (marks), marks. m_Marks . front (). m_FileName );
688
726
}
689
727
690
728
msg.pop_back ();
0 commit comments