Spodii / netgore

Cross platform online rpg engine using C# and SFML
http://www.netgore.com/
40 stars 16 forks source link

Guild chat doesn't work. #307

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I noticed that the guild chat (/guildsay) doesn't work, as in no message 
displays. I debugged and found that the line 'guildMember.Send' in the guild 
say method never gets called. 

/// <summary>
        /// Sends a message to all online fellow guild members.
        /// </summary>
        /// <param name="message">The message to send.</param>
        [SayHandlerCommand("GuildSay")]
        public void GuildSay(string message)
        {
            if (!RequireUserInGuild())
                return;

            foreach (var guildMember in User.Guild.GetMembers().OfType<User>())
            {
                // TODO: Fix! This doesn't ever get called, thus making guild chat not work.
                guildMember.SendToGuild(GameMessage.GuildSay, ServerMessageType.GUIChat, User.Name, message);
            }
        }

So I'm assuming the logic in this method is wrong??

public IEnumerable<GuildMemberNameRank> Execute(GuildID guildID)
        {
            var ret = new List<GuildMemberNameRank>();

            using (var r = ExecuteReader(guildID))
            {
                while (r.Read())
                {
                    var name = r.GetString("name");
                    var rank = r.GetByte("rank");
                    var value = new GuildMemberNameRank(name, rank);
                    ret.Add(value);
                }
            }

            return ret;
        }

Original issue reported on code.google.com by darksumm...@gmail.com on 9 Feb 2011 at 5:55

GoogleCodeExporter commented 9 years ago
Note: Ignore that my code says 'SendToGuild" (vanilla NetGore is "Send"), 
that's just some extra code I've done - which isn't anything relating to the 
problem.

Original comment by darksumm...@gmail.com on 9 Feb 2011 at 5:57

GoogleCodeExporter commented 9 years ago
Fixed, strange error :P probably a moments lapse in concentration, but the 
GuildMemberRank can not be OfType(User) therefore nothing is ever found or sent.

Issue fixed by r4492

Original comment by aphro.cag on 31 Mar 2011 at 9:36