TrinityCore
CraftingPacketsCommon.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
19
21{
22ByteBuffer& operator<<(ByteBuffer& data, SpellReducedReagent const& spellReducedReagent)
23{
24 data << int32(spellReducedReagent.ItemID);
25 data << int32(spellReducedReagent.Quantity);
26
27 return data;
28}
29
30ByteBuffer& operator<<(ByteBuffer& data, CraftingData const& craftingData)
31{
32 data << int32(craftingData.CraftingQualityID);
33 data << float(craftingData.QualityProgress);
34 data << int32(craftingData.SkillLineAbilityID);
35 data << int32(craftingData.CraftingDataID);
36 data << int32(craftingData.Multicraft);
37 data << int32(craftingData.SkillFromReagents);
38 data << int32(craftingData.Skill);
39 data << int32(craftingData.CritBonusSkill);
40 data << float(craftingData.field_1C);
41 data << uint64(craftingData.field_20);
42 data << uint32(craftingData.ResourcesReturned.size());
43 data << uint32(craftingData.OperationID);
44 data << craftingData.ItemGUID;
45 data << int32(craftingData.Quantity);
46 data << int32(craftingData.EnchantID);
47
48 for (SpellReducedReagent const& spellReducedReagent : craftingData.ResourcesReturned)
49 data << spellReducedReagent;
50
51 data.WriteBit(craftingData.IsCrit);
52 data.WriteBit(craftingData.field_29);
53 data.WriteBit(craftingData.field_2A);
54 data.WriteBit(craftingData.BonusCraft);
55 data.FlushBits();
56
57 data << craftingData.OldItem;
58 data << craftingData.NewItem;
59
60 return data;
61}
62}
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
bool WriteBit(bool bit)
Definition: ByteBuffer.h:175
void FlushBits()
Definition: ByteBuffer.h:155
ByteBuffer & operator<<(ByteBuffer &data, SpellReducedReagent const &spellReducedReagent)
std::vector< SpellReducedReagent > ResourcesReturned