Changeset 285 for binary-improvements
- Timestamp:
- Jul 1, 2016, 7:18:00 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/CoppisAdditions/src/Commands/ListPlayersFriends.cs
r273 r285 31 31 } else { 32 32 if (_params.Count == 0) { 33 Dictionary<int, EntityPlayer>.Enumerator playerEnum = GameManager.Instance.World.Players.dict.GetEnumerator (); 34 while (playerEnum.MoveNext ()) { 35 try { 36 KeyValuePair<int, EntityPlayer> pair = playerEnum.Current; 37 ClientInfo ci1 = ConsoleHelper.ParseParamIdOrName (pair.Value.entityId.ToString ()); 38 PersistentPlayerData data = GameManager.Instance.persistentPlayers.GetPlayerData (ci1.playerId); 39 HashSet<string>.Enumerator enumeratorFriends = data.ACL.GetEnumerator (); 40 String friends = ""; 41 while (enumeratorFriends.MoveNext ()) { 42 string str = enumeratorFriends.Current; 43 if (str != null) { 44 if (!friends.Equals ("")) { 45 friends += ","; 46 } 47 friends += str; 48 } 49 } 50 SdtdConsole.Instance.Output ("FriendsOf id=" + pair.Value.entityId + ", friends=" + friends); 51 } catch (Exception e) { 52 33 foreach (string steamid in GameManager.Instance.persistentPlayers.Players.Keys) { 34 PrintFriendsOfPlayer (steamid); 35 } 36 } else { 37 string steamid = null; 38 39 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 40 if (ci != null) { 41 steamid = ci.playerId; 42 } 43 44 if (steamid == null) { 45 if (ConsoleHelper.ParseParamSteamIdValid (_params [0])) { 46 steamid = _params [0]; 53 47 } 54 48 } 55 } else { 56 ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]); 57 if (ci == null) { 49 50 if (steamid == null) { 58 51 SdtdConsole.Instance.Output ("Playername or entity/steamid id not found."); 59 52 return; 60 53 } 61 EntityPlayer ep = GameManager.Instance.World.Players.dict [ci.entityId];62 PersistentPlayerData data = GameManager.Instance.persistentPlayers.GetPlayerDataFromEntityID (ci.entityId);63 54 64 HashSet<string>.Enumerator enumerator = data.ACL.GetEnumerator (); 65 //int count = 0; 66 String friends = ""; 67 while (enumerator.MoveNext ()) { 68 string str = enumerator.Current; 69 if (!friends.Equals ("")) { 70 friends += ","; 71 } 72 friends += str; 73 74 //Player p = PersistentContainer.Instance.Players[str, false]; 75 //if (p == null) 76 //{ 77 // continue; 78 //} 79 //count++; 80 //SdtdConsole.Instance.Output(count + ": " + p.EntityID + " - " + p.Name); 81 } 82 SdtdConsole.Instance.Output ("FriendsOf id=" + ci.entityId + ", friends=" + friends); 55 PrintFriendsOfPlayer (steamid); 83 56 } 84 57 } … … 87 60 } 88 61 } 62 63 private void PrintFriendsOfPlayer (string _steamid) { 64 PersistentPlayerData data = GameManager.Instance.persistentPlayers.GetPlayerData (_steamid); 65 string friends = ""; 66 if (data != null && data.ACL != null) { 67 foreach (string friend in data.ACL) { 68 if (!string.IsNullOrEmpty (friend)) { 69 if (!friends.Equals ("")) { 70 friends += ","; 71 } 72 friends += friend; 73 } 74 } 75 } 76 SdtdConsole.Instance.Output ("FriendsOf id=" + _steamid + ", friends=" + friends); 77 } 78 89 79 } 90 80 }
Note:
See TracChangeset
for help on using the changeset viewer.