private void GetGuildMembers(string data)
        {
            string backup = data.Substring(1);
            int index = -1;
            Guild guild = null;

            try
            {
                index = backup.IndexOf(',');
                int guildID = Convert.ToInt32(backup.Substring(0, index));
                backup = backup.Substring(index + 1);

                if (guildID == myGuild.guildId)
                {
                    guild = myGuild;
                }
                else
                {
            #if DEBUG
                    guiController.ShowMessageBox("Got info about a guild the player is not part of.");
            #endif
                }

                index = -1;
                index = backup.IndexOf(']');
                int count = Convert.ToInt32(backup.Substring(0, index));
                backup = backup.Substring(index + 1);

                if (count == 0)
                {
                    guild.ClearMembers();
                }

                index = -1;
                index = backup.IndexOf('|');
                while (index != -1)
                {
                    string backup2 = backup.Substring(0, index);
                    int index2 = -1;
                    index2 = backup2.IndexOf(',');
                    int id = Convert.ToInt32(backup2.Substring(0, index2));
                    backup2 = backup2.Substring(index2 + 1);

                    index2 = -1;
                    index2 = backup2.IndexOf(',');
                    byte flags = Convert.ToByte(backup2.Substring(0, index2));
                    backup2 = backup2.Substring(index2 + 1);

                    index2 = -1;
                    index2 = backup2.IndexOf('|');
                    string screenName = backup2;

                    GuildMember member = new GuildMember(guild.guildId, id, flags, screenName);
                    if (member.accountId == myAccount.accountId)
                    {
                        myAccount.SetGuildFlags(flags);
                    }
                    guild.AddMember(member);

                    backup = backup.Substring(index + 1);
                    index = -1;
                    index = backup.IndexOf('|');
                }

                index = -1;
                index = backup.IndexOf(',');
                int id2 = Convert.ToInt32(backup.Substring(0, index));
                backup = backup.Substring(index + 1);

                index = -1;
                index = backup.IndexOf(',');
                byte flags2 = Convert.ToByte(backup.Substring(0, index));
                backup = backup.Substring(index + 1);

                index = -1;
                index = backup.IndexOf('|');
                string screenName2 = backup;

                GuildMember member2 = new GuildMember(guild.guildId, id2, flags2, screenName2);
                guild.AddMember(member2);

                guiController.SetDebugText("Guild data added!");
            }
            catch (Exception e)
            {
                guiController.SetDebugText(e.ToString());
                throw;
            }
        }
示例#2
0
 public void UpdateMemberList(GuildMember member)
 {
 }
示例#3
0
 public void AddMember(GuildMember member)
 {
     userList.Add(member);
 }