Changeset 213 for binary-improvements/7dtd-server-fixes
- Timestamp:
- Dec 14, 2014, 1:52:00 AM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r208 r213 48 48 <HintPath>..\7dtd-binaries\UnityEngine.dll</HintPath> 49 49 </Reference> 50 <Reference Include="Assembly-CSharp">51 <HintPath>..\7dtd-binaries\Assembly-CSharp.dll</HintPath>52 </Reference>53 50 <Reference Include="EasyAntiCheat.Client"> 54 51 <HintPath>..\7dtd-binaries\EasyAntiCheat.Client.dll</HintPath> … … 62 59 <Reference Include="LogLibrary"> 63 60 <HintPath>..\7dtd-binaries\LogLibrary.dll</HintPath> 61 </Reference> 62 <Reference Include="Assembly-CSharp"> 63 <HintPath>..\7dtd-binaries\Assembly-CSharp.dll</HintPath> 64 64 </Reference> 65 65 </ItemGroup> -
binary-improvements/7dtd-server-fixes/src/CommonMappingFunctions.cs
r211 r213 20 20 public static string GetPlayerName (ClientInfo _ci) 21 21 { 22 try { 23 int entityId = GetConnectionManager ().mapClientToEntity [_ci.clientId]; 24 return GetGameManager ().World.playerEntities.dict [entityId].EntityName; 25 } catch (Exception e) { 26 Log.Out ("Error getting player name for ClientInfo: " + e); 27 } 28 return null; 22 return _ci.playerName; 29 23 } 30 24 31 25 public static EntityPlayer GetEntityPlayer (ClientInfo _ci) 32 26 { 33 try { 34 int entityId = GetConnectionManager ().mapClientToEntity [_ci.clientId]; 35 return GetGameManager ().World.playerEntities.dict [entityId]; 36 } catch (Exception e) { 37 Log.Out ("Error getting entity player for ClientInfo: " + e); 38 } 39 return null; 27 return GetGameManager ().World.playerEntities.dict [_ci.entityId]; 40 28 } 41 29 42 30 public static string GetSteamID (ClientInfo _ci) 43 31 { 44 return Steam.Authentication.Server.GetPlayerId (GetPlayerName (_ci)); 45 } 46 47 public static string GetSteamID (string _playerName) 48 { 49 return Steam.Authentication.Server.GetPlayerId (_playerName); 32 return _ci.playerId; 50 33 } 51 34 52 35 public static int GetClientID (ClientInfo _ci) 53 36 { 54 if (_ci != null) { 55 if (GetConnectionManager ().connectedClients.ContainsKey (_ci.clientId)) 56 return _ci.clientId; 57 } 58 return -1; 37 return _ci.clientId; 59 38 } 60 39 61 40 public static int GetEntityID (ClientInfo _ci) 62 41 { 63 try { 64 ConnectionManager cm = GetConnectionManager (); 65 66 if (cm.mapClientToEntity.ContainsKey (_ci.clientId)) 67 return cm.mapClientToEntity [_ci.clientId]; 68 else 69 return -1; 70 } catch (Exception e) { 71 Log.Out ("Error getting entity ID for ClientInfo: " + e); 72 } 73 return -1; 42 return _ci.entityId; 74 43 } 75 44 … … 79 48 ConnectionManager cm = GetConnectionManager (); 80 49 81 if (cm.mapClientToEntity.ContainsValue (_entityId)) { 82 foreach (KeyValuePair<int, int> kvp in cm.mapClientToEntity) { 83 if (kvp.Value == _entityId) { 84 return cm.connectedClients [kvp.Key]; 85 } 86 } 87 } 88 89 return null; 50 return cm.GetClientInfoForEntityId (_entityId); 90 51 } catch (Exception e) { 91 52 Log.Out ("Error getting ClientInfo for entity ID: " + e); … … 157 118 public static ClientInfo GetClientInfoFromSteamID (string _steamId) 158 119 { 159 try { 160 foreach (string name in Steam.Authentication.Server.usersToIDs.Keys) { 161 string curId = string.Empty + Steam.Authentication.Server.usersToIDs[name].steamID.m_SteamID; 162 if (curId.Equals (_steamId)) { 163 return GetClientInfoFromPlayerName (name, false); 164 } 165 } 166 } catch (Exception e) { 167 Log.Out ("Error getting ClientInfo for steam ID: " + e); 168 } 169 return null; 120 return GetConnectionManager ().GetClientInfoForPlayerId (_steamId); 170 121 } 171 122 -
binary-improvements/7dtd-server-fixes/src/NetConnections/ConsoleOutputSeparator.cs
r190 r213 24 24 private static IConnection issuerOfCurrentCommand; 25 25 26 public static void C_ExecuteCmdFromClient (ConsoleSdtd console, NetworkPlayer _networkPlayer, string _player ID, string _command)26 public static void C_ExecuteCmdFromClient (ConsoleSdtd console, NetworkPlayer _networkPlayer, string _playerName, string _playerID, string _command) 27 27 { 28 Log.Out ("Executed command \"" + _command + "\" from player \"" + _player ID+ "\"");28 Log.Out ("Executed command \"" + _command + "\" from player \"" + _playerName + "\""); 29 29 30 30 lock (netCommandQueue) { 31 31 isCurrentCommandFromClient = true; 32 32 console.issuerOfCurrentClientCommand = _networkPlayer; 33 console.ExecuteClientCmdInternal (_player ID, _command);33 console.ExecuteClientCmdInternal (_playerName, _playerID, _command); 34 34 isCurrentCommandFromClient = false; 35 35 }
Note:
See TracChangeset
for help on using the changeset viewer.