/// <summary>
        /// Reads the <see cref="ClanCompleteMessageComponent"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="ClanCompleteMessageComponent"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadMessageComponent(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            Id             = reader.ReadInt64();
            Name           = reader.ReadString();
            Role           = (ClanMemberRole)reader.ReadInt32();
            Level          = reader.ReadInt32();
            LeagueLevel    = reader.ReadInt32();
            Trophies       = reader.ReadInt32();
            TroopsDonated  = reader.ReadInt32();
            TroopsReceived = reader.ReadInt32();
            Rank           = reader.ReadInt32();
            PreviousRank   = reader.ReadInt32();
            NewMember      = reader.ReadBoolean();
            WarCoolDown    = reader.ReadInt32();
            WarPreference  = reader.ReadInt32();

            Unknown1 = reader.ReadByte();
            Unknown2 = reader.ReadByte();
            Unknown3 = reader.ReadByte();
            Unknown4 = reader.ReadByte();
            if (Unknown4 == 1)
            {
                Id2 = reader.ReadInt64();
            }
        }
        /// <summary>
        /// Reads the <see cref="AllianceChangeRoleOkMessage"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="AllianceChangeRoleOkMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadMessage(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            UserId = reader.ReadInt64();
            Role   = (ClanMemberRole)reader.ReadInt32();
        }
Exemplo n.º 3
0
        /// Reads the <see cref="AllianceRoleUpdatedCommand"/> from the specified <see cref="MessageReader"/>.
        /// <summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="AllianceRoleUpdatedCommand"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        /// </summary>
        public override void ReadCommand(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            ClanId = reader.ReadInt64();

            Unknown1 = reader.ReadInt32();

            Role = (ClanMemberRole)reader.ReadInt32();
            Tick = reader.ReadInt32();
        }
Exemplo n.º 4
0
        public void Promote(long userId, ClanMemberRole newRole)
        {
            var member = Get(userId);

            // If a new member is promoted, he is not considered new anymore.
            if (member.NewMember)
            {
                member.NewMember = false;
            }

            member.Role = newRole;
        }
        /// <summary>
        /// Reads the <see cref="AllianceStreamEntry"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="AllianceStreamEntry"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadStreamEntry(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            EntryId = reader.ReadInt64();

            Unknown2 = reader.ReadByte();

            UserId       = reader.ReadInt64();
            HomeId       = reader.ReadInt64();
            Name         = reader.ReadString();
            ExpLevels    = reader.ReadInt32();
            League       = reader.ReadInt32();
            Role         = (ClanMemberRole)reader.ReadInt32();
            SinceOccured = TimeSpan.FromSeconds(reader.ReadInt32());
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="mc"></param>
        public void Set(bl_ClanInfo.ClanMember info, bl_MyClan mc)
        {
            MyClan        = mc;
            MemberInfo    = info;
            NameText.text = MemberInfo.GetNameWithRole();
#if CLANS
            var            localUser = bl_DataBase.Instance.LocalUser;
            ClanMemberRole pr        = localUser.Clan.PlayerRole();
            if (pr != ClanMemberRole.Member)
            {
                int ph = (int)pr;
                int uh = (int)MemberInfo.Role;
                if (ph > uh)
                {
                    KickButton.SetActive(MemberInfo.ID != localUser.ID); //don't allow kick ourselves
                    DesendButton.SetActive(uh > 0);
                    if ((ph - uh) >= 2)                                  //parent ranks can't accent others just one above him.
                    {
                        AscendButton.SetActive(true);
                    }
                }
            }
#endif
        }