Ejemplo n.º 1
0
        void HandlePetitionShowSignatures(PetitionShowSignatures packet)
        {
            Log.outDebug(LogFilter.Network, "Received opcode CMSG_PETITION_SHOW_SIGNATURES");

            // if has guild => error, return;
            if (GetPlayer().GetGuildId() != 0)
            {
                return;
            }

            PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PETITION_SIGNATURE);

            stmt.AddValue(0, packet.Item.GetCounter());
            SQLResult result = DB.Characters.Query(stmt);

            ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures();

            signaturesPacket.Item           = packet.Item;
            signaturesPacket.Owner          = GetPlayer().GetGUID();
            signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(GetPlayer().GetGUID()));
            signaturesPacket.PetitionID     = (int)packet.Item.GetCounter(); // @todo verify that...

            do
            {
                ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(0));

                ServerPetitionShowSignatures.PetitionSignature signature = new ServerPetitionShowSignatures.PetitionSignature();
                signature.Signer = signerGUID;
                signature.Choice = 0;
                signaturesPacket.Signatures.Add(signature);
            }while (result.NextRow());

            SendPacket(signaturesPacket);
        }
Ejemplo n.º 2
0
        void HandlePetitionShowSignatures(PetitionShowSignatures packet)
        {
            Petition petition = Global.PetitionMgr.GetPetition(packet.Item);

            if (petition == null)
            {
                Log.outDebug(LogFilter.PlayerItems, $"Petition {packet.Item} is not found for player {GetPlayer().GetGUID().GetCounter()} {GetPlayer().GetName()}");
                return;
            }

            // if has guild => error, return;
            if (_player.GetGuildId() != 0)
            {
                return;
            }

            SendPetitionSigns(petition, _player);
        }
Ejemplo n.º 3
0
        void HandlePetitionShowSignatures(PetitionShowSignatures packet)
        {
            Log.outDebug(LogFilter.Network, "Received opcode CMSG_PETITION_SHOW_SIGNATURES");

            byte signs = 0;

            // if has guild => error, return;
            if (GetPlayer().GetGuildId() != 0)
            {
                return;
            }

            PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PETITION_SIGNATURE);

            stmt.AddValue(0, packet.Item.GetCounter());
            SQLResult result = DB.Characters.Query(stmt);

            // result == NULL also correct in case no sign yet
            if (!result.IsEmpty())
            {
                signs = (byte)result.GetRowCount();
            }

            ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures();

            signaturesPacket.Item           = packet.Item;
            signaturesPacket.Owner          = GetPlayer().GetGUID();
            signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, ObjectManager.GetPlayerAccountIdByGUID(GetPlayer().GetGUID()));
            signaturesPacket.PetitionID     = (int)packet.Item.GetCounter(); // @todo verify that...

            for (byte i = 1; i <= signs; ++i)
            {
                ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(0));

                ServerPetitionShowSignatures.PetitionSignature signature = new ServerPetitionShowSignatures.PetitionSignature();
                signature.Signer = signerGUID;
                signature.Choice = 0;
                signaturesPacket.Signatures.Add(signature);

                result.NextRow();
            }
            SendPacket(signaturesPacket);
        }