aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Packets/CraftingPacketsCommon.cpp
blob: a8a50d36cbc02cbfb6f850d8e397067bd4336ae4 (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
/*
 * 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 "CraftingPacketsCommon.h"
#include "PacketOperators.h"

namespace WorldPackets::Crafting
{
ByteBuffer& operator<<(ByteBuffer& data, SpellReducedReagent const& spellReducedReagent)
{
    data << int32(spellReducedReagent.ItemID);
    data << int32(spellReducedReagent.Quantity);

    return data;
}

ByteBuffer& operator<<(ByteBuffer& data, CraftingData const& craftingData)
{
    data << int32(craftingData.CraftingQualityID);
    data << float(craftingData.QualityProgress);
    data << int32(craftingData.SkillLineAbilityID);
    data << int32(craftingData.CraftingDataID);
    data << int32(craftingData.Multicraft);
    data << int32(craftingData.SkillFromReagents);
    data << int32(craftingData.Skill);
    data << int32(craftingData.CritBonusSkill);
    data << float(craftingData.field_1C);
    data << uint64(craftingData.field_20);
    data << Size<uint32>(craftingData.ResourcesReturned);
    data << uint32(craftingData.OperationID);
    data << craftingData.ItemGUID;
    data << int32(craftingData.Quantity);
    data << int32(craftingData.EnchantID);
    data << int32(craftingData.ConcentrationCurrencyID);
    data << int32(craftingData.ConcentrationSpent);
    data << int32(craftingData.IngenuityRefund);

    for (SpellReducedReagent const& spellReducedReagent : craftingData.ResourcesReturned)
        data << spellReducedReagent;

    data << Bits<1>(craftingData.IsCrit);
    data << Bits<1>(craftingData.field_29);
    data << Bits<1>(craftingData.field_2A);
    data << Bits<1>(craftingData.BonusCraft);
    data << Bits<1>(craftingData.HasIngenuityProc);
    data << Bits<1>(craftingData.ApplyConcentration);
    data.FlushBits();

    data << craftingData.OldItem;
    data << craftingData.NewItem;

    return data;
}
}