// Token: 0x06001C47 RID: 7239 RVA: 0x00084580 File Offset: 0x00082780 public static string GetBestBodyNameColored(GameObject bodyObject) { if (bodyObject) { CharacterBody component = bodyObject.GetComponent <CharacterBody>(); if (component) { CharacterMaster master = component.master; if (master) { PlayerCharacterMasterController component2 = master.GetComponent <PlayerCharacterMasterController>(); if (component2) { GameObject networkUserObject = component2.networkUserObject; if (networkUserObject) { NetworkUser component3 = networkUserObject.GetComponent <NetworkUser>(); if (component3) { return(Util.GenerateColoredString(component3.userName, component3.userColor)); } } } } } IDisplayNameProvider component4 = bodyObject.GetComponent <IDisplayNameProvider>(); if (component4 != null) { return(component4.GetDisplayName()); } } return("???"); }
// Token: 0x06001044 RID: 4164 RVA: 0x00047887 File Offset: 0x00045A87 private void OnPostNetworkUserStartCallback(NetworkUser networkUser) { if (NetworkServer.active) { networkUser.ServerRequestUnlockables(); } }
// Token: 0x06000BF2 RID: 3058 RVA: 0x0003A288 File Offset: 0x00038488 public static GameObject GetPreviousSpectateGameObject(NetworkUser viewer, GameObject currentGameObject) { ReadOnlyCollection <CharacterBody> readOnlyCollection = CharacterBody.readOnlyInstancesList; if (readOnlyCollection.Count == 0) { return(null); } CharacterBody characterBody = currentGameObject ? currentGameObject.GetComponent <CharacterBody>() : null; int num = characterBody ? readOnlyCollection.IndexOf(characterBody) : 0; for (int i = num - 1; i >= 0; i--) { if (CameraRigController.CanUserSpectateBody(viewer, readOnlyCollection[i])) { return(readOnlyCollection[i].gameObject); } } for (int j = readOnlyCollection.Count - 1; j >= num; j--) { if (CameraRigController.CanUserSpectateBody(viewer, readOnlyCollection[j])) { return(readOnlyCollection[j].gameObject); } } return(null); }
// Token: 0x06001041 RID: 4161 RVA: 0x00047811 File Offset: 0x00045A11 private void OnNetworkUserUnlockablesUpdatedCallback(NetworkUser networkUser) { if (NetworkServer.active) { this.RecalculateModifierAvailability(); } }
// Token: 0x06000B84 RID: 2948 RVA: 0x0004C0C4 File Offset: 0x0004A2C4 private UnlockableDef GetInteractorNextUnlockable(GameObject activatorGameObject) { NetworkUser networkUser = Util.LookUpBodyNetworkUser(activatorGameObject); if (networkUser) { LocalUser localUser = networkUser.localUser; if (localUser != null) { for (int i = 0; i < this.unlockableProgressionDefs.Length; i++) { UnlockableDef unlockableDef = this.unlockableProgressionDefs[i]; if (!localUser.userProfile.HasUnlockable(unlockableDef)) { return(unlockableDef); } } } else { for (int j = 0; j < this.unlockableProgressionDefs.Length; j++) { UnlockableDef unlockableDef2 = this.unlockableProgressionDefs[j]; if (!networkUser.unlockables.Contains(unlockableDef2)) { return(unlockableDef2); } } } } return(null); }
// Token: 0x060009ED RID: 2541 RVA: 0x00031718 File Offset: 0x0002F918 public void Update() { if (this.serverAchievementTrackingMaskDirty) { this.serverAchievementTrackingMaskDirty = false; this.TransmitAchievementRequestsToServer(); } int num = this.achievementsList.Count - 1; while (num >= 0 && this.dirtyGrantsCount > 0) { BaseAchievement baseAchievement = this.achievementsList[num]; if (baseAchievement.shouldGrant) { this.dirtyGrantsCount--; this.achievementsList.RemoveAt(num); this.userProfile.AddAchievement(baseAchievement.achievementDef.identifier, true); baseAchievement.OnGranted(); baseAchievement.OnUninstall(); NetworkUser currentNetworkUser = this.localUser.currentNetworkUser; if (currentNetworkUser != null) { currentNetworkUser.CallCmdReportAchievement(baseAchievement.achievementDef.nameToken); } } num--; } }
// Token: 0x06001886 RID: 6278 RVA: 0x00069B9C File Offset: 0x00067D9C public static void IssueQuitCommand(NetworkUser sender, string consoleCmd) { QuitConfirmationHelper.< > c__DisplayClass2_0 CS$ < > 8__locals1 = new QuitConfirmationHelper.< > c__DisplayClass2_0(); CS$ < > 8__locals1.sender = sender; CS$ < > 8__locals1.consoleCmd = consoleCmd; QuitConfirmationHelper.IssueQuitCommand(new Action(CS$ < > 8__locals1.< IssueQuitCommand > g__RunCmd | 0)); }
// try and setup our character, if we hit an error we set it to false //TODO: Find a way to stop it from checking whilst in main menu/lobby menu private static void GetCharacter() { try { LocalNetworkUser = null; foreach (NetworkUser readOnlyInstance in NetworkUser.readOnlyInstancesList) { //localplayer == you! if (readOnlyInstance.isLocalPlayer) { LocalNetworkUser = readOnlyInstance; LocalPlayer = LocalNetworkUser.master; LocalPlayerInv = LocalPlayer.GetComponent <Inventory>(); LocalHealth = LocalPlayer.GetBody().GetComponent <HealthComponent>(); LocalSkills = LocalPlayer.GetBody().GetComponent <SkillLocator>(); if (LocalHealth.alive) { _CharacterCollected = true; } else { _CharacterCollected = false; } } } } catch (Exception e) { _CharacterCollected = false; } }
// Token: 0x06000A59 RID: 2649 RVA: 0x00033CAB File Offset: 0x00031EAB public static void SendPlayerDisconnectedMessage(NetworkUser user) { Chat.SendBroadcastChat(new Chat.PlayerChatMessage { networkPlayerName = user.GetNetworkPlayerName(), baseToken = "PLAYER_DISCONNECTED" }); }
// Token: 0x06001001 RID: 4097 RVA: 0x0004653C File Offset: 0x0004473C private void FixedUpdate() { NetworkUser networkUser = this.networkUser; if (this.bodyInputs) { if (networkUser && networkUser.localUser != null && !networkUser.localUser.isUIFocused) { Player inputPlayer = networkUser.localUser.inputPlayer; bool flag = false; if (this.body) { flag = this.body.isSprinting; if (this.sprintInputPressReceived) { this.sprintInputPressReceived = false; flag = !flag; } if (flag) { Vector3 aimDirection = this.bodyInputs.aimDirection; aimDirection.y = 0f; aimDirection.Normalize(); Vector3 moveVector = this.bodyInputs.moveVector; moveVector.y = 0f; moveVector.Normalize(); if ((this.body.bodyFlags & CharacterBody.BodyFlags.SprintAnyDirection) == CharacterBody.BodyFlags.None && Vector3.Dot(aimDirection, moveVector) < PlayerCharacterMasterController.sprintMinAimMoveDot) { flag = false; } } } this.bodyInputs.skill1.PushState(inputPlayer.GetButton("PrimarySkill")); this.bodyInputs.skill2.PushState(inputPlayer.GetButton("SecondarySkill")); this.bodyInputs.skill3.PushState(inputPlayer.GetButton("UtilitySkill")); this.bodyInputs.skill4.PushState(inputPlayer.GetButton("SpecialSkill")); this.bodyInputs.interact.PushState(inputPlayer.GetButton("Interact")); this.bodyInputs.jump.PushState(inputPlayer.GetButton("Jump")); this.bodyInputs.sprint.PushState(flag); this.bodyInputs.activateEquipment.PushState(inputPlayer.GetButton("Equipment")); this.bodyInputs.ping.PushState(inputPlayer.GetButton("Ping")); } else { this.bodyInputs.skill1.PushState(false); this.bodyInputs.skill2.PushState(false); this.bodyInputs.skill3.PushState(false); this.bodyInputs.skill4.PushState(false); this.bodyInputs.interact.PushState(false); this.bodyInputs.jump.PushState(false); this.bodyInputs.sprint.PushState(false); this.bodyInputs.activateEquipment.PushState(false); this.bodyInputs.ping.PushState(false); } this.CheckPinging(); } }
// Token: 0x060014E7 RID: 5351 RVA: 0x00064704 File Offset: 0x00062904 private void Update() { if (Stage.instance) { int num = 0; ReadOnlyCollection <NetworkUser> readOnlyLocalPlayersList = NetworkUser.readOnlyLocalPlayersList; for (int i = 0; i < readOnlyLocalPlayersList.Count; i++) { NetworkUser networkUser = readOnlyLocalPlayersList[i]; CameraRigController cameraRigController = this.cameras[num]; if (!cameraRigController) { cameraRigController = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/Main Camera")).GetComponent <CameraRigController>(); this.cameras[num] = cameraRigController; } cameraRigController.viewer = networkUser; networkUser.cameraRigController = cameraRigController; GameObject networkUserBodyObject = RunCameraManager.GetNetworkUserBodyObject(networkUser); if (networkUserBodyObject) { cameraRigController.target = networkUserBodyObject; cameraRigController.cameraMode = CameraRigController.CameraMode.PlayerBasic; } else if (!cameraRigController.disableSpectating) { cameraRigController.cameraMode = CameraRigController.CameraMode.SpectateUser; if (!cameraRigController.target) { cameraRigController.target = CameraRigController.GetNextSpectateGameObject(networkUser, null); } } else { cameraRigController.cameraMode = CameraRigController.CameraMode.None; } num++; } int num2 = num; for (int j = num; j < this.cameras.Length; j++) { ref CameraRigController ptr = ref this.cameras[num]; if (ptr != null) { if (ptr) { UnityEngine.Object.Destroy(this.cameras[num].gameObject); } ptr = null; } } Rect[] array = RunCameraManager.screenLayouts[num2]; for (int k = 0; k < num2; k++) { this.cameras[k].viewport = array[k]; } return; }
// Token: 0x06001059 RID: 4185 RVA: 0x00047C1C File Offset: 0x00045E1C public static void CreateForNetworkUserServer(NetworkUser networkUser) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/PreGameRuleVoteController")); PreGameRuleVoteController component = gameObject.GetComponent <PreGameRuleVoteController>(); component.networkUserNetworkIdentity = networkUser.GetComponent <NetworkIdentity>(); component.networkUser = networkUser; component.localUser = networkUser.localUser; NetworkServer.Spawn(gameObject); }
/// <summary> /// returns NetworkUsers associated to a NetworkConnection /// </summary> /// <param name="conn"></param> /// <returns>returns NetworkUsers associated to a NetworkConnection</returns> private static RoR2.NetworkUser[] GetConnectionNetworkUsers(UnityEngine.Networking.NetworkConnection conn) { System.Collections.Generic.List <UnityEngine.Networking.PlayerController> playerControllers = conn.playerControllers; RoR2.NetworkUser[] array = new RoR2.NetworkUser[playerControllers.Count]; for (int i = 0; i < playerControllers.Count; i++) { array[i] = playerControllers[i].gameObject.GetComponent <RoR2.NetworkUser>(); } return(array); }
// Token: 0x06001030 RID: 4144 RVA: 0x00047215 File Offset: 0x00045415 private void GenerateRuleVoteController(NetworkUser networkUser) { if (NetworkServer.active) { if (PreGameRuleVoteController.FindForUser(networkUser)) { return; } PreGameRuleVoteController.CreateForNetworkUserServer(networkUser); } }
// Token: 0x0600138C RID: 5004 RVA: 0x0005F66C File Offset: 0x0005D86C public bool CanBeAffordedByInteractor(Interactor activator) { switch (this.costType) { case CostType.None: return(true); case CostType.Money: { CharacterBody component = activator.GetComponent <CharacterBody>(); if (component) { CharacterMaster master = component.master; if (master) { return((ulong)master.money >= (ulong)((long)this.cost)); } } return(false); } case CostType.PercentHealth: { HealthComponent component2 = activator.GetComponent <HealthComponent>(); return(component2 && component2.health / component2.fullHealth * 100f >= (float)this.cost); } case CostType.Lunar: { NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject); return(networkUser && (ulong)networkUser.lunarCoins >= (ulong)((long)this.cost)); } case CostType.WhiteItem: case CostType.GreenItem: case CostType.RedItem: { ItemTier itemTier = PurchaseInteraction.CostTypeToItemTier(this.costType); CharacterBody component3 = activator.gameObject.GetComponent <CharacterBody>(); if (component3) { Inventory inventory = component3.inventory; if (inventory) { return(inventory.HasAtLeastXTotalItemsOfTier(itemTier, this.cost)); } } return(false); } default: return(false); } }
// Token: 0x06000A7D RID: 2685 RVA: 0x000341C0 File Offset: 0x000323C0 protected bool IsSecondPerson() { if (LocalUserManager.readOnlyLocalUsersList.Count == 1 && this.subject) { NetworkUser component = this.subject.GetComponent <NetworkUser>(); if (component && component.localUser != null) { return(true); } } return(false); }
// Token: 0x060014E6 RID: 5350 RVA: 0x000646CC File Offset: 0x000628CC private static TeamIndex GetNetworkUserTeamIndex(NetworkUser networkUser) { if (networkUser.masterObject) { CharacterMaster component = networkUser.masterObject.GetComponent <CharacterMaster>(); if (component) { return(component.teamIndex); } } return(TeamIndex.Neutral); }
public static void ServerHandleClientVoteUpdate(NetworkMessage netMsg) { string format = "Received vote from {0}"; object[] array = new object[1]; int num = 0; NetworkUser networkUser = NetworkUser.readOnlyInstancesList.FirstOrDefault((NetworkUser v) => v.connectionToClient == netMsg.conn); array[num] = ((networkUser != null) ? networkUser.userName : null); Debug.LogFormat(format, array); GameObject gameObject = netMsg.reader.ReadGameObject(); if (!gameObject) { Debug.Log("PreGameRuleVoteController.ServerHandleClientVoteUpdate() failed: preGameRuleVoteControllerObject=null"); return; } PreGameRuleVoteController component = gameObject.GetComponent <PreGameRuleVoteController>(); if (!component) { Debug.Log("PreGameRuleVoteController.ServerHandleClientVoteUpdate() failed: preGameRuleVoteController=null"); return; } NetworkIdentity networkUserNetworkIdentity = component.networkUserNetworkIdentity; if (!networkUserNetworkIdentity) { Debug.Log("PreGameRuleVoteController.ServerHandleClientVoteUpdate() failed: No NetworkIdentity"); return; } NetworkUser component2 = networkUserNetworkIdentity.GetComponent <NetworkUser>(); if (!component2) { Debug.Log("PreGameRuleVoteController.ServerHandleClientVoteUpdate() failed: No NetworkUser"); return; } if (component2.connectionToClient != netMsg.conn) { Debug.LogFormat("PreGameRuleVoteController.ServerHandleClientVoteUpdate() failed: {0}!={1}", new object[] { component.connectionToClient, netMsg.conn }); return; } Debug.LogFormat("Accepting vote from {0}", new object[] { component2.userName }); component.ReadVotes(netMsg.reader); }
// Token: 0x06000A69 RID: 2665 RVA: 0x00033F14 File Offset: 0x00032114 public override string ConstructChatString() { if (this.sender) { NetworkUser component = this.sender.GetComponent <NetworkUser>(); if (component) { return(string.Format(CultureInfo.InvariantCulture, "<color=#e5eefc>{0}: {1}</color>", Util.EscapeRichTextForTextMeshPro(component.userName), Util.EscapeRichTextForTextMeshPro(this.text))); } } return(null); }
// Token: 0x060014E5 RID: 5349 RVA: 0x00064694 File Offset: 0x00062894 private static GameObject GetNetworkUserBodyObject(NetworkUser networkUser) { if (networkUser.masterObject) { CharacterMaster component = networkUser.masterObject.GetComponent <CharacterMaster>(); if (component) { return(component.GetBodyObject()); } } return(null); }
// Token: 0x06000987 RID: 2439 RVA: 0x00029714 File Offset: 0x00027914 public void SubmitCmd(NetworkUser sender, string cmd, bool recordSubmit = false) { if (recordSubmit) { Console.Log log = new Console.Log { message = string.Format(CultureInfo.InvariantCulture, "<color=#C0C0C0>] {0}</color>", cmd), stackTrace = "", logType = LogType.Log }; Console.logs.Add(log); if (Console.onLogReceived != null) { Console.onLogReceived(log); } Console.userCmdHistory.Add(cmd); } Queue <string> tokens = new Console.Lexer(cmd).GetTokens(); List <string> list = new List <string>(); bool flag = false; while (tokens.Count != 0) { string text = tokens.Dequeue(); if (text == ";") { flag = false; if (list.Count > 0) { string concommandName = list[0].ToLower(CultureInfo.InvariantCulture); list.RemoveAt(0); this.RunCmd(sender, concommandName, list); list.Clear(); } } else { if (flag) { text = this.GetVstrValue(sender, text); flag = false; } if (text == "vstr") { flag = true; } else { list.Add(text); } } } }
// Token: 0x06001000 RID: 4096 RVA: 0x0004632C File Offset: 0x0004452C private void Update() { if (this.netid.hasAuthority) { this.SetBody(this.master.GetBodyObject()); NetworkUser networkUser = this.networkUser; if (this.bodyInputs && networkUser && networkUser.inputPlayer != null) { this.sprintInputPressReceived |= networkUser.inputPlayer.GetButtonDown("Sprint"); CameraRigController cameraRigController = networkUser.cameraRigController; if (cameraRigController) { if (networkUser.localUser != null && !networkUser.localUser.isUIFocused) { Vector2 vector = new Vector2(networkUser.inputPlayer.GetAxis("MoveHorizontal"), networkUser.inputPlayer.GetAxis("MoveVertical")); float sqrMagnitude = vector.sqrMagnitude; if (sqrMagnitude > 1f) { vector /= Mathf.Sqrt(sqrMagnitude); } if (this.bodyIsFlier) { this.bodyInputs.moveVector = cameraRigController.transform.right * vector.x + cameraRigController.transform.forward * vector.y; } else { float y = cameraRigController.transform.eulerAngles.y; this.bodyInputs.moveVector = Quaternion.Euler(0f, y, 0f) * new Vector3(vector.x, 0f, vector.y); } } else { this.bodyInputs.moveVector = Vector3.zero; } this.bodyInputs.aimDirection = (cameraRigController.crosshairWorldPosition - this.bodyInputs.aimOrigin).normalized; } CharacterEmoteDefinitions component = this.bodyInputs.GetComponent <CharacterEmoteDefinitions>(); if (component) { if (Input.GetKeyDown("g")) { this.bodyInputs.emoteRequest = component.FindEmoteIndex("Point"); return; } if (Input.GetKeyDown("t")) { this.bodyInputs.emoteRequest = component.FindEmoteIndex("Surprise"); } } } } }
// Token: 0x0600131A RID: 4890 RVA: 0x0005D830 File Offset: 0x0005BA30 private void GenerateRuleVoteController(NetworkUser networkUser) { if (NetworkServer.active) { if (PreGameRuleVoteController.FindForUser(networkUser)) { return; } GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/PreGameRuleVoteController"), base.transform); gameObject.GetComponent <PreGameRuleVoteController>().networkUserNetworkIdentity = networkUser.GetComponent <NetworkIdentity>(); NetworkServer.Spawn(gameObject); } }
// Token: 0x06001058 RID: 4184 RVA: 0x00047BA0 File Offset: 0x00045DA0 public static PreGameRuleVoteController FindForUser(NetworkUser networkUser) { GameObject gameObject = networkUser.gameObject; foreach (PreGameRuleVoteController preGameRuleVoteController in PreGameRuleVoteController.instancesList) { if (preGameRuleVoteController.networkUserNetworkIdentity && preGameRuleVoteController.networkUserNetworkIdentity.gameObject == gameObject) { return(preGameRuleVoteController); } } return(null); }
// Token: 0x06001003 RID: 4099 RVA: 0x00046828 File Offset: 0x00044A28 public string GetDisplayName() { string result = ""; if (this.networkUserObject) { NetworkUser component = this.networkUserObject.GetComponent <NetworkUser>(); if (component) { result = component.userName; } } return(result); }
// Token: 0x060010AB RID: 4267 RVA: 0x0004913C File Offset: 0x0004733C private static bool ActivatorHasUnlockable(Interactor activator, string unlockableName) { NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject); if (networkUser) { LocalUser localUser = networkUser.localUser; if (localUser != null) { return(localUser.userProfile.HasUnlockable(unlockableName)); } } return(true); }
// Token: 0x06000983 RID: 2435 RVA: 0x00029434 File Offset: 0x00027634 private string GetVstrValue(NetworkUser user, string identifier) { string result; if (!(user == null)) { result = ""; return(result); } if (this.vstrs.TryGetValue(identifier, out result)) { return(result); } return(""); }
// Token: 0x06000B85 RID: 2949 RVA: 0x0004C150 File Offset: 0x0004A350 private static bool ActivatorHasUnlockable(Interactor activator, string unlockableName) { NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject); if (!networkUser) { return(true); } LocalUser localUser = networkUser.localUser; if (localUser != null) { return(localUser.userProfile.HasUnlockable(unlockableName)); } return(networkUser.unlockables.Contains(UnlockableCatalog.GetUnlockableDef(unlockableName))); }
// Token: 0x060018B8 RID: 6328 RVA: 0x00076E8D File Offset: 0x0007508D public void LinkNetworkUser(NetworkUser newNetworkUser) { if (this.currentNetworkUser) { return; } this.currentNetworkUser = newNetworkUser; newNetworkUser.localUser = this; Action <NetworkUser> action = this.onNetworkUserFound; if (action == null) { return; } action(newNetworkUser); }
// Token: 0x06001517 RID: 5399 RVA: 0x0005A198 File Offset: 0x00058398 public virtual void SetFromMaster(CharacterMaster master) { if (master) { PlayerCharacterMasterController component = master.GetComponent <PlayerCharacterMasterController>(); if (component) { NetworkUser networkUser = component.networkUser; this.SetFromSteamId(networkUser.id.value); return; } } this.userSteamId = 0UL; this.sourceType = SocialUserIcon.SourceType.None; this.Refresh(); }