aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Packets/TaxiPackets.cpp
blob: a2220de80cf150a58d6bc77f91f6e7467ff83bea (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
84
85
86
87
88
89
/*
* 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 "TaxiPackets.h"
#include "PacketOperators.h"

namespace WorldPackets::Taxi
{
void TaxiNodeStatusQuery::Read()
{
    _worldPacket >> UnitGUID;
}

WorldPacket const* TaxiNodeStatus::Write()
{
    _worldPacket << Unit;
    _worldPacket << Bits<2>(Status);
    _worldPacket.FlushBits();

    return &_worldPacket;
}

WorldPacket const* ShowTaxiNodes::Write()
{
    _worldPacket << OptionalInit(WindowInfo);
    _worldPacket.FlushBits();

    _worldPacket << uint32(CanLandNodes.size() / 8); // client reads this in uint64 blocks, size is ensured to be divisible by 8 in TaxiMask constructor
    _worldPacket << uint32(CanUseNodes.size() / 8);  // client reads this in uint64 blocks, size is ensured to be divisible by 8 in TaxiMask constructor

    if (WindowInfo)
    {
        _worldPacket << WindowInfo->UnitGUID;
        _worldPacket << uint32(WindowInfo->CurrentNode);
    }

    _worldPacket.append(CanLandNodes.data(), CanLandNodes.size());
    _worldPacket.append(CanUseNodes.data(), CanUseNodes.size());

    return &_worldPacket;
}

void EnableTaxiNode::Read()
{
    _worldPacket >> Unit;
}

void TaxiQueryAvailableNodes::Read()
{
    _worldPacket >> Unit;
}

void ActivateTaxi::Read()
{
    _worldPacket >> Vendor;
    _worldPacket >> Node;
    _worldPacket >> GroundMountID;
    _worldPacket >> FlyingMountID;
}

WorldPacket const* NewTaxiPath::Write()
{
    _worldPacket << int32(TaxiNodesID);

    return &_worldPacket;
}

WorldPacket const* ActivateTaxiReply::Write()
{
    _worldPacket << Bits<4>(Reply);
    _worldPacket.FlushBits();

    return &_worldPacket;
}
}