예제 #1
0
            static bool OnGuildQuery(LoginClient client, CMSG msgID, BinReader data)
            {
                uint      guildId = data.ReadUInt32();
                BinWriter pkg     = LoginClient.NewPacket(SMSG.GUILD_QUERY_RESPONSE);

                Chat.System(client, "Guild Query");
                DBGuild guild = (DBGuild)DataServer.Database.FindObjectByKey(typeof(DBGuild), guildId);

                if (guild == null)
                {
                    return(true);
                }
                else
                {
                    pkg.Write(guild.ObjectId);
                    pkg.Write(guild.Name);
                    for (uint i = 0; i < 10; i++)
                    {
                        pkg.Write(guild.getRankName(i));
                    }
                    pkg.Write((uint)guild.Icon);
                    pkg.Write((uint)guild.IconColor);
                    pkg.Write((uint)guild.Border);
                    pkg.Write((uint)guild.BorderColor);
                    pkg.Write((uint)guild.Color);
                }
                client.Send(pkg);
                return(true);
            }            //OnGuildQuery
예제 #2
0
            static bool OnGuildLeader(LoginClient client, CMSG msgID, BinReader data)
            {
                DBGuild guild = client.Character.Guild;

                if (guild == null || client.Character.GuildID == 0)
                {
                    SendResult(client, 2, " ", (int)GUILDRESULT.NOT_IN_GUILD);
                    return(true);
                }

                if (client.Character.GuildRank != 0)
                {
                    SendResult(client, 1, " ", (int)GUILDRESULT.PERMISSIONS);
                    ; return(true);
                }

                string name = data.ReadString();

                DBCharacter tChar = (DBCharacter)DataServer.Database.FindObjectByKey(typeof(DBCharacter), name.ToLower());

                if (tChar == null)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.NOT_FOUND);
                    return(true);
                }

                else if (client.Character.GuildID != tChar.GuildID)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.NOT_IN_GUILD_S);
                    return(true);
                }

                DBGuildMembers tMember = (DBGuildMembers)DataServer.Database.FindObjectByKey(typeof(DBGuildMembers), tChar.ObjectId);

                if (tMember == null)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.INTERNAL);
                    return(true);
                }

                tChar.GuildRank            = 0;
                tMember.Rank               = 0;
                guild.Leader               = tChar.ObjectId;
                client.Character.GuildRank = 1;
                DBGuildMembers oldLeader = (DBGuildMembers)DataServer.Database.FindObjectByKey(typeof(DBGuildMembers), client.Character.ObjectId);

                if (oldLeader == null)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.INTERNAL);
                    return(true);
                }
                oldLeader.Rank = 1;

                SendToWorld(client, tChar);
                SendToWorld(client, client.Character);

                GuildMessage(guild, tChar.Name + " has been promoted to the rank of " + guild.getRankName(tChar.GuildRank) + " by " + client.Character.Name);
                SendRoster(client, guild);
                return(true);
            }            //OnGuildLeader
예제 #3
0
            static bool OnGuildDemote(LoginClient client, CMSG msgID, BinReader data)
            {
                DBGuild guild = client.Character.Guild;

                if (guild == null || client.Character.GuildID == 0)
                {
                    SendResult(client, 2, " ", (int)GUILDRESULT.NOT_IN_GUILD);
                    return(true);
                }

                if ((guild.getRankFlags(client.Character.GuildRank) & (uint)GUILDFLAGS.DEMOTE) != (uint)GUILDFLAGS.DEMOTE)
                {
                    SendResult(client, 1, " ", (int)GUILDRESULT.PERMISSIONS);
                    ; return(true);
                }

                string name = data.ReadString();

                DBCharacter tChar = (DBCharacter)DataServer.Database.FindObjectByKey(typeof(DBCharacter), name.ToLower());

                if (tChar == null)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.NOT_FOUND);
                    return(true);
                }

                else if (client.Character.GuildID != tChar.GuildID)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.NOT_IN_GUILD_S);
                    return(true);
                }
                //		2					1
                if (tChar.GuildRank <= client.Character.GuildRank)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.RANK_TO_HIGH);
                    return(true);
                }
                else if (tChar.GuildRank >= guild.MaxRank)
                {
                    SendResult(client, 1, name, (int)GUILDRESULT.RANK_TO_LOW);
                    return(true);
                }

                DBGuildMembers tMember = (DBGuildMembers)DataServer.Database.FindObjectByKey(typeof(DBGuildMembers), tChar.ObjectId);

                if (tMember != null)
                {
                    tChar.GuildRank++;
                }
                tMember.Rank++;
                SendToWorld(client, tChar);
                GuildMessage(guild, tChar.Name + "has been demoted to the rank of " + guild.getRankName(tChar.GuildRank) + " by " + client.Character.Name);
                SendRoster(client, guild);
                return(true);
            }            //OnGuildDemote