Пример #1
0
        /// <summary>
        /// Delete's a member from this Guild
        /// </summary>
        /// <param name="removername">the player (client) removing</param>
        /// <param name="member">the player named beeing remove</param>
        /// <returns>true or false</returns>
        public bool RemovePlayer(string removername, GamePlayer member)
        {
            try
            {
                GuildMgr.RemovePlayerFromAllGuildPlayersList(member);
                RemoveOnlineMember(member);
                member.GuildName = "";
                member.GuildNote = "";
                member.GuildID   = "";
                member.GuildRank = null;
                member.Guild     = null;
                member.SaveIntoDatabase();

                member.Out.SendObjectGuildID(member, member.Guild);
                // Send message to removerClient about successful removal
                if (removername == member.Name)
                {
                    member.Out.SendMessage("You leave the guild.", DOL.GS.PacketHandler.eChatType.CT_System, DOL.GS.PacketHandler.eChatLoc.CL_SystemWindow);
                }
                else
                {
                    member.Out.SendMessage(removername + " removed you from " + this.Name, PacketHandler.eChatType.CT_System, PacketHandler.eChatLoc.CL_SystemWindow);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("RemovePlayer", e);
                }
                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Removes a player from the guild
        /// </summary>
        /// <param name="player">GamePlayer to be removed</param>
        /// <returns>true if removed, false if not</returns>
        public bool RemoveOnlineMember(GamePlayer player)
        {
            lock (m_memberListLock)
            {
                if (m_onlineGuildPlayers.ContainsKey(player.InternalID))
                {
                    m_onlineGuildPlayers.Remove(player.InternalID);

                    // now update the all member list to display lastonline time instead of zone
                    Dictionary <string, GuildMgr.GuildMemberDisplay> memberList = GuildMgr.GetAllGuildMembers(player.GuildID);

                    if (memberList != null && memberList.ContainsKey(player.InternalID))
                    {
                        memberList[player.InternalID].ZoneOrOnline = DateTime.Now.ToShortDateString();
                    }

                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
        public static void StartCheckThread()
        {
            foreach (Guild checkGuild in GuildMgr.GetAllGuilds())
            {
                if (checkGuild.BonusType != Guild.eBonusType.None)
                {
                    TimeSpan bonusTime = DateTime.Now.Subtract(checkGuild.BonusStartTime);

                    if (bonusTime.Days > 0)
                    {
                        checkGuild.BonusType = Guild.eBonusType.None;

                        checkGuild.SaveIntoDatabase();

                        string message = "[Guild Buff] Your guild buff has now worn off!";
                        foreach (GamePlayer player in checkGuild.GetListOfOnlineMembers())
                        {
                            player.Out.SendMessage(message, eChatType.CT_Guild, eChatLoc.CL_ChatWindow);
                        }
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Add a player to a guild with the specified rank
        /// </summary>
        /// <param name="addPlayer"></param>
        /// <param name="rank"></param>
        /// <returns></returns>
        public bool AddPlayer(GamePlayer addPlayer, DBRank rank)
        {
            if (addPlayer == null || addPlayer.Guild != null)
            {
                return(false);
            }

            if (log.IsDebugEnabled)
            {
                log.Debug("Adding player to the guild, guild name=\"" + Name + "\"; player name=" + addPlayer.Name);
            }

            try
            {
                AddOnlineMember(addPlayer);
                addPlayer.GuildName = Name;
                addPlayer.GuildID   = GuildID;
                addPlayer.GuildRank = rank;
                addPlayer.Guild     = this;
                addPlayer.SaveIntoDatabase();
                GuildMgr.AddPlayerToAllGuildPlayersList(addPlayer);
                addPlayer.Out.SendMessage("You have agreed to join " + Name + "!", eChatType.CT_Group, eChatLoc.CL_SystemWindow);
                addPlayer.Out.SendMessage("Your current rank is " + addPlayer.GuildRank.Title + "!", eChatType.CT_Group, eChatLoc.CL_SystemWindow);
                SendMessageToGuildMembers(addPlayer.Name + " has joined the guild!", eChatType.CT_Group, eChatLoc.CL_SystemWindow);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("AddPlayer", e);
                }

                return(false);
            }

            return(true);
        }