예제 #1
0
        public void AddMembershipRequest(ObjectGuid guildGuid, MembershipRequest request)
        {
            _membershipRequestsByGuild[guildGuid][request.GetPlayerGUID()]  = request;
            _membershipRequestsByPlayer[request.GetPlayerGUID()][guildGuid] = request;

            SQLTransaction    trans = new SQLTransaction();
            PreparedStatement stmt  = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_APPLICANT);

            stmt.AddValue(0, request.GetGuildGuid());
            stmt.AddValue(1, request.GetPlayerGUID());
            stmt.AddValue(2, request.GetAvailability());
            stmt.AddValue(3, request.GetClassRoles());
            stmt.AddValue(4, request.GetInterests());
            stmt.AddValue(5, request.GetComment());
            stmt.AddValue(6, request.GetSubmitTime());
            trans.Append(stmt);
            DB.Characters.CommitTransaction(trans);

            // Notify the applicant his submittion has been added
            Player player = Global.ObjAccessor.FindPlayer(request.GetPlayerGUID());

            if (player)
            {
                SendMembershipRequestListUpdate(player);
            }

            // Notify the guild master and officers the list changed
            Guild guild = Global.GuildMgr.GetGuildById(guildGuid.GetCounter());

            if (guild)
            {
                SendApplicantListUpdate(guild);
            }
        }
예제 #2
0
        public MembershipRequest(MembershipRequest settings)
        {
            _comment = settings.GetComment();

            _availability = settings.GetAvailability();
            _classRoles   = settings.GetClassRoles();
            _interests    = settings.GetInterests();
            _guildId      = settings.GetGuildGuid();
            _playerGUID   = settings.GetPlayerGUID();
            _time         = settings.GetSubmitTime();
        }
예제 #3
0
        void LoadMembershipRequests()
        {
            Log.outInfo(LogFilter.ServerLoading, "Loading guild finder membership requests...");
            //                                                      0         1           2            3           4         5         6
            SQLResult result = DB.Characters.Query("SELECT guildId, playerGuid, availability, classRole, interests, comment, submitTime FROM guild_finder_applicant");

            if (result.IsEmpty())
            {
                Log.outInfo(LogFilter.ServerLoading, "Loaded 0 guild finder membership requests. Table `guild_finder_applicant` is empty.");
                return;
            }

            uint count     = 0;
            uint oldMSTime = Time.GetMSTime();

            do
            {
                ObjectGuid guildId      = ObjectGuid.Create(HighGuid.Guild, result.Read <ulong>(0));
                ObjectGuid playerId     = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(1));
                byte       availability = result.Read <byte>(2);
                byte       classRoles   = result.Read <byte>(3);
                byte       interests    = result.Read <byte>(4);
                string     comment      = result.Read <string>(5);
                uint       submitTime   = result.Read <uint>(6);

                MembershipRequest request = new MembershipRequest(playerId, guildId, availability, classRoles, interests, comment, submitTime);

                if (!_membershipRequestsByGuild.ContainsKey(guildId))
                {
                    _membershipRequestsByGuild[guildId] = new Dictionary <ObjectGuid, MembershipRequest>();
                }

                _membershipRequestsByGuild[guildId][playerId] = request;

                if (!_membershipRequestsByPlayer.ContainsKey(playerId))
                {
                    _membershipRequestsByPlayer[playerId] = new Dictionary <ObjectGuid, MembershipRequest>();
                }

                _membershipRequestsByPlayer[playerId][guildId] = request;

                ++count;
            } while (result.NextRow());

            Log.outInfo(LogFilter.ServerLoading, "Loaded {0} guild finder membership requests in {1} ms.", count, Time.GetMSTimeDiffToNow(oldMSTime));
        }