public MedalInfoTranslator GetRankPresenceField(BnetGameAccount gameAccount) { byte[] buffer; if ((gameAccount == null) || !gameAccount.TryGetGameFieldBytes(0x12, out buffer)) { return(null); } if (buffer == null) { return(null); } if (buffer.Length < 3) { return(null); } int rank = Convert.ToInt32(buffer[0]); return(new MedalInfoTranslator(rank, BitConverter.ToUInt16(buffer, 1))); }
private PresenceStatus GetStatus_Internal(BnetPlayer player, ref string statusKey, List <string> stringArgs = null, List <Enum> enumVals = null) { byte[] buffer; PresenceStatus uNKNOWN = PresenceStatus.UNKNOWN; if (player == null) { return(uNKNOWN); } if (player.GetBestGameAccount() == null) { return(uNKNOWN); } BnetGameAccount hearthstoneGameAccount = player.GetHearthstoneGameAccount(); if (hearthstoneGameAccount == null) { return(uNKNOWN); } if (!hearthstoneGameAccount.TryGetGameFieldBytes(0x11, out buffer)) { return(uNKNOWN); } Enum enumVal = 0; using (MemoryStream stream = new MemoryStream(buffer)) { using (BinaryReader reader = new BinaryReader(stream)) { if (this.DecodeStatusVal(reader, ref enumVal, ref statusKey)) { uNKNOWN = (PresenceStatus)((int)enumVal); if (enumVals != null) { enumVals.Add(uNKNOWN); } if ((stringArgs == null) && (enumVals == null)) { return(uNKNOWN); } while (stream.Position < buffer.Length) { string key = null; if (!this.DecodeStatusVal(reader, ref enumVal, ref key)) { return(uNKNOWN); } if (enumVals != null) { enumVals.Add(enumVal); } if (stringArgs != null) { string item = GameStrings.Get(key); stringArgs.Add(item); } } } return(uNKNOWN); } } }