internal static Player _GetPlayerById(string uid, out bool isNothingOverlooked) { Player plr = null; int len = Main.player.Length; isNothingOverlooked = true; for (int i = 0; i < len; i++) { plr = Main.player[i]; if (plr == null || !plr.active) { continue; } bool mysuccess; string myuid = PlayerIdentityHelpers._GetUniqueId(plr, out mysuccess); if (!mysuccess) { isNothingOverlooked = false; continue; } if (myuid == uid) { isNothingOverlooked = true; break; } } return(plr); }
public static string GetProperUniqueId(Player player) { var mymod = ModHelpersMod.Instance; string id; if (!mymod.PlayerIdentityHelpers.PlayerIds.TryGetValue(player.whoAmI, out id)) { if (Main.netMode != 2 && player.whoAmI == Main.myPlayer) { id = PlayerIdentityHelpers.GetMyProperUniqueId(); mymod.PlayerIdentityHelpers.PlayerIds[player.whoAmI] = id; } else { //throw new HamstarException( "!ModHelpers.PlayerIdentityHelpers.GetProperUniqueId - Could not find player " + player.name + "'s id." ); return(null); } } return(id); }
public static Player GetPlayerByProperId(string uid) { int len = Main.player.Length; for (int i = 0; i < len; i++) { Player plr = Main.player[i]; //LogHelpers.Log( "GetPlayerByProperId: "+PlayerIdentityHelpers.GetProperUniqueId( plr )+" == "+uid+": "+plr.name+" ("+plr.whoAmI+")" ); if (plr == null /*|| !plr.active*/) { continue; } // <- This is WEIRD! if (PlayerIdentityHelpers.GetProperUniqueId(plr) == uid) { return(plr); } } return(null); }
public static string GetUniqueId(Player player, out bool success) { return(PlayerIdentityHelpers._GetUniqueId(player, out success)); }
public static Player GetPlayerById(string uid, out bool isNothingOverlooked) { return(PlayerIdentityHelpers._GetPlayerById(uid, out isNothingOverlooked)); }