示例#1
0
        public static bool Invite(string[] args, CommandGroup command)
        {
            if (args.Count() < 1)
            {
                return(false);
            }

            Player target;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(false);
            }

            string guildName = command.extractQuotedArg(args[0] == "\"" ? args[0] : args[1]);

            if (guildName == null)
            {
                return(false);
            }

            Guild targetGuild = GuildMgr.GetGuildByName(guildName);

            if (targetGuild == null)
            {
                return(false);
            }

            targetGuild.AddMember(target.GetGUIDLow());

            return(true);
        }
示例#2
0
        public static void HandleGuildInviteName(ref PacketReader packet, ref WorldSession session)
        {
            uint   length = packet.GetBits <uint>(7);
            string name   = packet.ReadString(length);

            Player plInvited = null;// ObjMgr.GetPlayer(name);

            if (plInvited == null)
            {
                SendCommandResult(ref session, GuildCommandType.Invite_S, GuildCommandErrors.PlayerNotFound_S, name);
                return;
            }

            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            if (plInvited.GuildGuid != 0)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.AlreadyInGuild_S, name);
                return;
            }

            plInvited.SetGuildInvited(guild.Guid);
            guild.SendInvite(pl, plInvited);

            guild.LogGuildEvent(GuildEventLogTypes.InvitePlayer, pl.GetGUIDLow(), plInvited.GetGUIDLow());
        }
示例#3
0
        public static bool Create(string[] args, CommandGroup command)
        {
            if (args.Count() < 1)
            {
                return(false);
            }

            Player target;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(false);
            }

            string guildname = command.extractQuotedArg(args[0].Contains("\"") ? args[0] : args[1]);

            if (guildname == null)
            {
                return(false);
            }

            if (target.GuildGuid != 0)
            {
                return(command.SendErrorMessage(CypherStrings.PlayerInGuild));
            }

            Guild guild = new Guild();

            if (!GuildMgr.CreateGuild(target, guildname))
            {
                return(command.SendErrorMessage(CypherStrings.GuildNotCreated));
            }

            return(true);
        }
示例#4
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                string str    = trigger.Text.NextModifiers();
                Unit   target = trigger.Args.Target;
                Guild  guild;

                if (!(target is Character) || str == "n")
                {
                    string name = trigger.Text.NextWord().Trim();
                    guild = GuildMgr.GetGuild(name);
                    if (guild == null)
                    {
                        trigger.Reply("Invalid Guild: " + name);
                        return;
                    }
                }
                else
                {
                    guild = ((Character)target).Guild;
                    if (guild == null)
                    {
                        trigger.Reply(target + " is not a member of any Guild.");
                        return;
                    }
                }

                guild.SendMessage(trigger.Args.User, trigger.Text.Remainder);
            }
示例#5
0
        public static bool UnInvite(string[] args, CommandGroup command)
        {
            if (args.Count() == 0)
            {
                return(false);
            }

            Player target;

            if (!command.extractPlayerTarget(args[0], out target))
            {
                return(command.SendErrorMessage(CypherStrings.NoPlayer));
            }

            Guild targetGuild = GuildMgr.GetGuildByGuid(target.GuildGuid);

            if (targetGuild == null)
            {
                return(false);
            }

            targetGuild.DeleteMember(target.GetGUIDLow());

            return(true);
        }
示例#6
0
        public static void RemoveHousePermissions(House house)
        {
            // clear the house number for the guild if this is a guild house
            if (house.DatabaseItem.GuildHouse)
            {
                Guild guild = GuildMgr.GetGuildByName(house.DatabaseItem.GuildName);
                if (guild != null)
                {
                    guild.GuildHouseNumber = 0;
                }
            }

            house.DatabaseItem.GuildHouse = false;
            house.DatabaseItem.GuildName  = null;

            IList <DBHousePermissions> pobjs = GameServer.Database.SelectObjects <DBHousePermissions>("`HouseNumber` = @HouseNumber", new QueryParameter("@HouseNumber", house.HouseNumber));

            GameServer.Database.DeleteObject(pobjs);
            house.PermissionLevels.Clear();

            IList <DBHouseCharsXPerms> cpobjs = GameServer.Database.SelectObjects <DBHouseCharsXPerms>("`HouseNumber` = @HouseNumber", new QueryParameter("@HouseNumber", house.HouseNumber));

            GameServer.Database.DeleteObject(cpobjs);
            house.CharXPermissions.Clear();
        }
示例#7
0
        public static void HandleGuildLeave(ref PacketReader packet, ref WorldSession session)
        {
            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            if (pl.GetGUIDLow() == guild.GetLeaderGuid())
            {
                if (guild.GetMemberSize() > 1)
                {
                    SendCommandResult(ref session, GuildCommandType.Quit_S, GuildCommandErrors.LeaderLeave);
                    return;
                }
                else
                {
                    SendCommandResult(ref session, GuildCommandType.Quit_S, GuildCommandErrors.Success, guild.Name);
                    guild.Disband();
                }
            }
            else
            {
                guild.DeleteMember(pl.GetGUIDLow());
                guild.LogGuildEvent(GuildEventLogTypes.LeaveGuild, pl.GetGUIDLow());
                guild.SendBroadcastEvent(GuildEvents.Left, pl.GetGUIDLow(), pl.GetName());
            }
            guild.SendRoster();
        }
示例#8
0
        public static void HandleGuildRewards(ref PacketReader packet, ref WorldSession session)
        {
            Guild guild = GuildMgr.GetGuildByGuid(session.GetPlayer().GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            packet.Skip(4);//time?

            if (GuildMgr.guildRewards.Count == 0)
            {
                return;
            }

            uint count = (uint)GuildMgr.guildRewards.Count;

            PacketWriter writer = new PacketWriter(Opcodes.SMSG_GuildRewardsList);

            writer.WriteBits(count, 21);
            writer.BitFlush();
            foreach (GuildRewards reward in GuildMgr.guildRewards)
            {
                writer.WriteUInt32(reward.Standing);
                writer.WriteUInt32(reward.Races);
                writer.WriteUInt32(reward.Entry);
                writer.WriteUInt64(reward.Price);
                writer.WriteUInt32(0);//always 0
                writer.WriteUInt32(reward.Achievement);
            }
            writer.WriteUnixTime();
            session.Send(writer);
        }
示例#9
0
        public static bool Level(string[] args, CommandGroup command)
        {
            if (args.Count() < 2)
            {
                return(false);
            }

            uint   level;
            string guildName = command.extractQuotedArg(args[0]);

            if (guildName == null)
            {
                return(false);
            }

            uint.TryParse(args[1], out level);

            Guild guild = GuildMgr.GetGuildByName(guildName);

            if (guild == null)
            {
                return(false);
            }

            guild.SetLevel(level);
            return(true);
        }
示例#10
0
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.Guild == null)
            {
                return;
            }

            if (!client.Player.Guild.HasRank(client.Player, Guild.eRank.Leader))
            {
                return;
            }

            int primarycolor   = packet.ReadByte() & 0x0F; // 4bits
            int secondarycolor = packet.ReadByte() & 0x07; // 3bits
            int pattern        = packet.ReadByte() & 0x03; // 2bits
            int logo           = packet.ReadByte();        // 8bits
            int oldemblem      = client.Player.Guild.Emblem;
            int newemblem      = (logo << 9) | (pattern << 7) | (primarycolor << 3) | secondarycolor;

            if (GuildMgr.IsEmblemUsed(newemblem))
            {
                client.Player.Out.SendMessage("This emblem is already in use by another guild, please choose another!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            GuildMgr.ChangeEmblem(client.Player, oldemblem, newemblem);
        }
示例#11
0
        public static void HandleGuildSetMaster(ref PacketReader packet, ref WorldSession session)
        {
            string name = packet.ReadString();

            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            if (pl.GetGUIDLow() != guild.GetLeaderGuid())
            {
                SendCommandResult(ref session, GuildCommandType.Invite_S, GuildCommandErrors.RankTooLow_S);
                return;
            }

            Guild.Member oldleader = guild.GetMember(pl.GetGUIDLow());
            Guild.Member newleader = guild.GetMember(name);

            if (newleader == null)
            {
                SendCommandResult(ref session, GuildCommandType.Invite_S, GuildCommandErrors.PlayerNotInGuild_S, name);
                return;
            }

            guild.SetLeader(newleader);
            oldleader.ChangeRank((uint)guild.GetLowestRank());
            guild.SendBroadcastEvent(GuildEvents.LeaderChanged, 0, oldleader.Name, name);
        }
示例#12
0
        public static void HandleGuildAddRank(ref PacketReader packet, ref WorldSession session)
        {
            uint   rankId   = packet.ReadUInt32();
            var    count    = packet.GetBits <uint>(7);
            string rankname = packet.ReadString(count);

            Player pl = session.GetPlayer();

            Guild guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            if (pl.GetGUIDLow() != guild.GetLeaderGuid())
            {
                SendCommandResult(ref session, GuildCommandType.Invite_S, GuildCommandErrors.RankTooLow_S);
                return;
            }

            guild.AddNewRank(ref session, rankname);

            guild.SendQuery(ref session);
            guild.SendRoster();
        }
示例#13
0
        /// <summary>
        /// Add newly created player to startup guild.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public static void AddNewbieToStarterGuild(DOLEvent e, object sender, EventArgs args)
        {
            if (!STARTING_GUILD)
            {
                return;
            }

            // Check Args
            var chArgs = args as CharacterEventArgs;

            if (chArgs == null)
            {
                return;
            }

            DOLCharacters ch      = chArgs.Character;
            Account       account = chArgs.GameClient.Account;

            if ((ePrivLevel)account.PrivLevel == ePrivLevel.Player)
            {
                var guildname = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, string.Format("Guild.StartupGuild.{0}", GlobalConstants.RealmToName((eRealm)ch.Realm)));
                ch.GuildID = GuildMgr.GuildNameToGuildID(guildname);

                if (ch.GuildID != "")
                {
                    ch.GuildRank = 8;
                }
            }
        }
 /// <summary>
 /// load keep from DB
 /// </summary>
 /// <param name="keep"></param>
 public virtual void LoadFromDatabase(DataObject keep)
 {
     m_dbkeep             = keep as DBKeep;
     InternalID           = keep.ObjectId;
     m_difficultyLevel[0] = m_dbkeep.AlbionDifficultyLevel;
     m_difficultyLevel[1] = m_dbkeep.MidgardDifficultyLevel;
     m_difficultyLevel[2] = m_dbkeep.HiberniaDifficultyLevel;
     if (m_dbkeep.ClaimedGuildName != null && m_dbkeep.ClaimedGuildName != "")
     {
         Guild myguild = GuildMgr.GetGuildByName(m_dbkeep.ClaimedGuildName);
         if (myguild != null)
         {
             this.m_guild = myguild;
             this.m_guild.ClaimedKeeps.Add(this);
             StartDeductionTimer();
         }
     }
     if (Level < ServerProperties.Properties.MAX_KEEP_LEVEL && m_guild != null)
     {
         StartChangeLevel((byte)ServerProperties.Properties.MAX_KEEP_LEVEL);
     }
     else if (Level <= ServerProperties.Properties.MAX_KEEP_LEVEL && Level > ServerProperties.Properties.STARTING_KEEP_LEVEL && m_guild == null)
     {
         StartChangeLevel((byte)ServerProperties.Properties.STARTING_KEEP_LEVEL);
     }
 }
示例#15
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                string name = trigger.Text.NextWord().Trim();

                if (GuildMgr.GetGuild(name) == null)
                {
                    trigger.Reply("Guild does not exist: " + name);
                }
                else
                {
                    Character target = trigger.Args.Target as Character;
                    if (target == null)
                    {
                        trigger.Reply("You did not select a valid member.");
                    }
                    else
                    {
                        if (target.GuildMember.RankId <= 0)
                        {
                            return;
                        }
                        --target.GuildMember.RankId;
                    }
                }
            }
示例#16
0
        public static void RemoveHousePermissions(House house)
        {
            // clear the house number for the guild if this is a guild house
            if (house.DatabaseItem.GuildHouse)
            {
                Guild guild = GuildMgr.GetGuildByName(house.DatabaseItem.GuildName);
                if (guild != null)
                {
                    guild.GuildHouseNumber = 0;
                }
            }

            house.DatabaseItem.GuildHouse = false;
            house.DatabaseItem.GuildName  = null;

            IList <DBHousePermissions> pobjs = DOLDB <DBHousePermissions> .SelectObjects(DB.Column(nameof(DBHousePermissions.HouseNumber)).IsEqualTo(house.HouseNumber));

            GameServer.Database.DeleteObject(pobjs);
            house.PermissionLevels.Clear();

            IList <DBHouseCharsXPerms> cpobjs = DOLDB <DBHouseCharsXPerms> .SelectObjects(DB.Column(nameof(DBHouseCharsXPerms.HouseNumber)).IsEqualTo(house.HouseNumber));

            GameServer.Database.DeleteObject(cpobjs);
            house.CharXPermissions.Clear();
        }
示例#17
0
        public static void RemoveHousePermissions(House house)
        {
            // clear the house number for the guild if this is a guild house
            if (house.DatabaseItem.GuildHouse)
            {
                Guild guild = GuildMgr.GetGuildByName(house.DatabaseItem.GuildName);
                if (guild != null)
                {
                    guild.GuildHouseNumber = 0;
                }
            }

            house.DatabaseItem.GuildHouse = false;
            house.DatabaseItem.GuildName  = null;

            IList <DBHousePermissions> pobjs = GameServer.Database.SelectObjects <DBHousePermissions>("HouseNumber = " + house.HouseNumber);

            foreach (DBHousePermissions item in pobjs)
            {
                GameServer.Database.DeleteObject(item);
            }
            house.PermissionLevels.Clear();

            IList <DBHouseCharsXPerms> cpobjs = GameServer.Database.SelectObjects <DBHouseCharsXPerms>("HouseNumber = " + house.HouseNumber);

            foreach (DBHouseCharsXPerms item in cpobjs)
            {
                GameServer.Database.DeleteObject(item);
            }
            house.CharXPermissions.Clear();
        }
示例#18
0
        public static void HandleGuildSetNote(ref PacketReader packet, ref WorldSession session)
        {
            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            byte[] guid = new byte[8];
            guid[1] = packet.GetBit();
            guid[4] = packet.GetBit();
            guid[5] = packet.GetBit();
            guid[3] = packet.GetBit();
            guid[0] = packet.GetBit();
            guid[7] = packet.GetBit();

            bool Public = packet.ReadBit();

            guid[6] = packet.GetBit();

            uint noteLen = packet.GetBits <uint>(8);

            guid[2] = packet.GetBit();

            packet.ReadXORByte(guid, 4);
            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 0);
            packet.ReadXORByte(guid, 3);
            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 7);

            string note = packet.ReadString(noteLen);

            packet.ReadXORByte(guid, 2);

            if (!guild.HasRankRight(guild.GetMember(pl.GetGUIDLow()).RankId, (uint)(Public ? GuildRankRights.EditPublicNote : GuildRankRights.EditOffNote)))
            {
                SendCommandResult(ref session, GuildCommandType.Invite_S, GuildCommandErrors.RankTooLow_S);
                return;
            }

            ulong Guid = packet.ReadGuid(guid);

            Guild.Member member = guild.GetMember(Guid);

            if (member == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            member.SetNote(Public, note);

            guild.SendRoster();
        }
示例#19
0
        public static void HandleGuildEmblem(ref PacketReader packet, ref WorldSession session)
        {
            //ulong vendorGuid = packet.ReadUInt64();
            uint _EmblemStyle     = packet.ReadUInt32();
            uint _EmblemColor     = packet.ReadUInt32();
            uint _BorderStyle     = packet.ReadUInt32();
            uint _BorderColor     = packet.ReadUInt32();
            uint _BackgroundColor = packet.ReadUInt32();

            Player pl = session.GetPlayer();

            //MSG_SAVE_GUILD_EMBLEM = 0x2404,
            PacketWriter writer = new PacketWriter();

            writer.WriteUInt16(0x2404);

            //Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER);
            //if (!pCreature)
            //{
            //"That's not an emblem vendor!"
            //SendSaveGuildEmblem(ERR_GUILDEMBLEM_INVALIDVENDOR);
            //return;
            //}

            // remove fake death
            //if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
            //GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);

            Guild guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                writer.WriteUInt32((uint)GuildEmblem.NoGuild);
                session.Send(writer);
                return;
            }

            if (pl.GetGUIDLow() != guild.GetLeaderGuid())
            {
                writer.WriteUInt32((uint)GuildEmblem.NotGuildMaster);
                session.Send(writer);
                return;
            }

            //pl.ModifyMoney(-10*GOLD);
            guild.EmblemStyle     = _EmblemStyle;
            guild.EmblemColor     = _EmblemColor;
            guild.BorderStyle     = _BorderStyle;
            guild.BorderColor     = _BorderColor;
            guild.BackgroundColor = _BackgroundColor;

            //"Guild Emblem saved."
            writer.WriteUInt32((uint)GuildEmblem.Success);
            session.Send(writer);
            guild.SendQuery(ref session);
        }
示例#20
0
 private static void DeleteFromGuild(uint charId, uint guildId)
 {
     if (guildId != 0)
     {
         var guild = GuildMgr.GetGuild(guildId);
         if (guild != null)
         {
             guild.RemoveMember(charId);
         }
     }
 }
示例#21
0
 /// <summary>
 /// This method checks if a guild exists
 /// if not, the guild is created with default values
 /// </summary>
 /// <param name="currentRealm">Current Realm being checked</param>
 /// <param name="guildName">The guild name that is being checked</param>
 private static void CheckGuild(eRealm currentRealm, string guildName)
 {
     if (!GuildMgr.DoesGuildExist(guildName))
     {
         Guild newguild = GuildMgr.CreateGuild(currentRealm, guildName);
         newguild.Ranks[8].OcHear = true;
         newguild.Motd            = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Guild.StartupGuild.Motd");
         newguild.Omotd           = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Guild.StartupGuild.Omotd");
         newguild.Ranks[8].Title  = LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Guild.StartupGuild.Title");
     }
 }
示例#22
0
        public static void HandleGuildEventLogQuery(ref PacketReader packet, ref WorldSession session)
        {
            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }
            guild.SendGuildEventLog(ref session);
        }
示例#23
0
        public static void HandleGuildQuery(ref PacketReader packet, ref WorldSession session)
        {
            ulong guildGuid  = packet.ReadUInt64();
            ulong playerGuid = packet.ReadUInt64();
            Guild guild      = GuildMgr.GetGuildByGuid(guildGuid);

            if (guild != null)
            {
                guild.SendQuery(ref session);
                return;
            }

            SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
        }
示例#24
0
        private static void DeleteFromGuild(uint charId, uint guildId)
        {
            if (guildId == 0U)
            {
                return;
            }
            Guild guild = GuildMgr.GetGuild(guildId);

            if (guild == null)
            {
                return;
            }
            guild.RemoveMember(charId);
        }
示例#25
0
        public static void HandleGuildRoster(ref PacketReader packet, ref WorldSession session)
        {
            //var mask = packet.GetGuidMask(2, 3, 0, 6, 4, 7, 5, 1);
            //var guid = packet.GetGuid(mask, 0, 4, 5, 7, 1, 3, 6, 2);

            Guild guild = GuildMgr.GetGuildByGuid(session.GetPlayer().GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            guild.SendRoster(session);
        }
示例#26
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var mod        = trigger.Text.NextModifiers();
                var leaderName = "";

                if (mod.Contains("n"))
                {
                    leaderName = trigger.Text.NextWord();
                }
                var name = trigger.Text.NextWord().Trim();

                if (!GuildMgr.CanUseName(name))
                {
                    trigger.Reply("Invalid name: " + name);
                    return;
                }

                if (leaderName.Length > 0)
                {
                    RealmServer.IOQueue.AddMessage(() =>
                    {
                        var leaderRecord = CharacterRecord.GetRecordByName(leaderName);
                        if (leaderRecord == null)
                        {
                            trigger.Reply("Character with name \"{0}\" does not exist.", leaderName);
                            return;
                        }
                        CreateGuild(trigger, name, leaderRecord);
                    });
                }
                else
                {
                    CharacterRecord leaderRecord;
                    var             chr = trigger.Args.Target as Character;
                    if (chr != null)
                    {
                        leaderRecord = chr.Record;
                    }
                    else
                    {
                        trigger.Reply("Could not create Guild. You did not select a Character to be the Guild leader. Use the -n switch to specify the leader by name.");
                        return;
                    }

                    var guild = CreateGuild(trigger, name, leaderRecord);
                    guild.Leader.Character = chr;
                }
            }
示例#27
0
        public static void HandleGuildAccept(ref PacketReader packet, ref WorldSession session)
        {
            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildInvited);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            guild.AddMember(pl.GetGUIDLow(), guild.GetLowestRank());

            guild.LogGuildEvent(GuildEventLogTypes.JoinGuild, pl.GetGUIDLow());
            guild.SendBroadcastEvent(GuildEvents.Joined, pl.GetGUIDLow(), pl.GetName());
        }
示例#28
0
        public static void HandleGuildSwitchRank(ref PacketReader packet, ref WorldSession session)
        {
            Player pl    = session.GetPlayer();
            Guild  guild = GuildMgr.GetGuildByGuid(pl.GuildGuid);

            if (guild == null)
            {
                SendCommandResult(ref session, GuildCommandType.Create_S, GuildCommandErrors.PlayerNotInGuild);
                return;
            }

            uint rankId    = packet.ReadUInt32();
            byte Direction = packet.GetBits <byte>(1);

            guild.SetRankOrder(rankId, Direction);
        }
示例#29
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                string str   = trigger.Text.NextModifiers();
                string name1 = "";

                if (str.Contains("n"))
                {
                    name1 = trigger.Text.NextWord();
                }
                string name2 = trigger.Text.NextWord().Trim();
                Guild  guild = GuildMgr.GetGuild(name2);

                if (guild == null)
                {
                    trigger.Reply("Guild does not exist: " + name2);
                }
                else
                {
                    if (name1.Length > 0)
                    {
                        if (!guild.RemoveMember(name1, false))
                        {
                            trigger.Reply("{0} is not a member of \"{1}\".", (object)name1, (object)guild.Name);
                            return;
                        }
                    }
                    else
                    {
                        Character target = trigger.Args.Target as Character;
                        if (target == null)
                        {
                            trigger.Reply(
                                "You did not select a valid member. Use the -n switch to specify the new member by name.");
                            return;
                        }

                        if (target.GuildMember == null || !guild.RemoveMember(target.GuildMember))
                        {
                            trigger.Reply("{0} is not a member of \"{1}\".", (object)target.Name, (object)guild.Name);
                            return;
                        }
                    }

                    trigger.Reply("Done.");
                }
            }
示例#30
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                string str        = trigger.Text.NextModifiers();
                string leaderName = "";

                if (str.Contains("n"))
                {
                    leaderName = trigger.Text.NextWord();
                }
                string name = trigger.Text.NextWord().Trim();

                if (!GuildMgr.CanUseName(name))
                {
                    trigger.Reply("Invalid name: " + name);
                }
                else if (leaderName.Length > 0)
                {
                    ServerApp <RealmServer> .IOQueue.AddMessage(() =>
                    {
                        CharacterRecord recordByName = CharacterRecord.GetRecordByName(leaderName);
                        if (recordByName == null)
                        {
                            trigger.Reply("Character with name \"{0}\" does not exist.", (object)leaderName);
                        }
                        else
                        {
                            CreateGuild(trigger, name, recordByName);
                        }
                    });
                }
                else
                {
                    Character target = trigger.Args.Target as Character;
                    if (target != null)
                    {
                        CharacterRecord record = target.Record;
                        CreateGuild(trigger, name, record).Leader.Character = target;
                    }
                    else
                    {
                        trigger.Reply(
                            "Could not create Guild. You did not select a Character to be the Guild leader. Use the -n switch to specify the leader by name.");
                    }
                }
            }