aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Packets/DuelPackets.cpp
blob: d2eeb7a31ab7c8fbdcbbc70e6d5804f68366e648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include "DuelPackets.h"
#include "PacketOperators.h"

namespace WorldPackets::Duel
{
void CanDuel::Read()
{
    _worldPacket >> TargetGUID;
    _worldPacket >> Bits<1>(ToTheDeath);
}

WorldPacket const* CanDuelResult::Write()
{
    _worldPacket << TargetGUID;
    _worldPacket << Bits<1>(Result);
    _worldPacket.FlushBits();

    return &_worldPacket;
}

WorldPacket const* DuelComplete::Write()
{
    _worldPacket << Bits<1>(Started);
    _worldPacket.FlushBits();

    return &_worldPacket;
}

WorldPacket const* DuelCountdown::Write()
{
    _worldPacket << uint32(Countdown);

    return &_worldPacket;
}

WorldPacket const* DuelRequested::Write()
{
    _worldPacket << ArbiterGUID;
    _worldPacket << RequestedByGUID;
    _worldPacket << RequestedByWowAccount;
    _worldPacket << Bits<1>(ToTheDeath);
    _worldPacket.FlushBits();

    return &_worldPacket;
}

void DuelResponse::Read()
{
    _worldPacket >> ArbiterGUID;
    _worldPacket >> Bits<1>(Accepted);
    _worldPacket >> Bits<1>(Forfeited);
}

WorldPacket const* DuelWinner::Write()
{
    _worldPacket << SizedString::BitsSize<6>(BeatenName);
    _worldPacket << SizedString::BitsSize<6>(WinnerName);
    _worldPacket << Bits<1>(Fled);
    _worldPacket << uint32(BeatenVirtualRealmAddress);
    _worldPacket << uint32(WinnerVirtualRealmAddress);
    _worldPacket << SizedString::Data(BeatenName);
    _worldPacket << SizedString::Data(WinnerName);

    return &_worldPacket;
}
}