wServer.realm.entities.player.Player.JoinGuild C# (CSharp) Method

JoinGuild() public method

public JoinGuild ( RealmTime t, wServer.cliPackets.JoinGuildPacket pkt ) : void
t RealmTime
pkt wServer.cliPackets.JoinGuildPacket
return void
        public void JoinGuild(RealmTime t, JoinGuildPacket pkt)
        {
            var db = new Database();
            var gStruct = db.GetGuild(pkt.GuildName);
            if (psr.Player.Invited == false)
            {
                SendInfo("You need to be invited to join a guild!");
            }
            if (gStruct != null)
            {
                var g = db.ChangeGuild(psr.Account, gStruct.Id, 0, 0, false);
                if (g != null)
                {
                    psr.Account.Guild = g;
                    Guild = g.Name;
                    GuildRank = g.Rank;
                    UpdateCount++;
                    foreach (var p in RealmManager.GuildMembersOf(g.Name))
                    {
                        p.Client.SendPacket(new TextPacket()
                        {
                            BubbleTime = 0,
                            Stars = -1,
                            //Name = "@" + psr.Account.Name + " has joined the guild!"
                            Name = "",
                            Recipient = "*Guild*",
                            Text = psr.Account.Name + " has joined the guild!"
                        });
                    }
                }
            }
        }