999{
1001 {
1004 return b;
1005 }
1006
1008
1009 uint8 itemsShown = 0;
1010
1012
1013 std::size_t count_pos = b.
wpos();
1015
1016 switch (lv.permission)
1017 {
1021 {
1022 bool isMasterLooter = lv.viewer->GetGroup() && lv.viewer->GetGroup()->GetMasterLooterGuid() == lv.viewer->GetGUID();
1023
1024
1025
1027 {
1029 {
1030 uint8 slot_type = 0;
1031
1032 if (l.
items[i].is_blocked)
1033 {
1034 switch (lv.permission)
1035 {
1038 break;
1040 {
1041 if (lv.viewer->GetGroup())
1042 {
1043 if (lv.viewer->GetGroup()->GetMasterLooterGuid() == lv.viewer->GetGUID())
1045 else
1047 }
1048 break;
1049 }
1052 break;
1053 default:
1054 continue;
1055 }
1056 }
1057 else if (l.
items[i].rollWinnerGUID)
1058 {
1059 if (l.
items[i].rollWinnerGUID == lv.viewer->GetGUID())
1061 else
1062 continue;
1063 }
1065 {
1066
1067
1068
1070 }
1071 else
1072
1073 continue;
1074
1076 b <<
uint8(slot_type);
1077 ++itemsShown;
1078 }
1079 }
1080 break;
1081 }
1083 {
1085 {
1087 {
1089
1090 continue;
1091
1094 ++itemsShown;
1095 }
1096 }
1097 break;
1098 }
1101 {
1104 {
1106 {
1108 b <<
uint8(slot_type);
1109 ++itemsShown;
1110 }
1111 }
1112 break;
1113 }
1114 default:
1115 return b;
1116 }
1117
1119
1120
1122
1124 QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUID());
1125 if (q_itr != lootPlayerQuestItems.end())
1126 {
1128 for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
1129 {
1132 {
1133 bool showInLoot = true;
1134 bool hasQuestForItem = lv.viewer->HasQuestForItem(item.
itemid, 0,
false, &showInLoot);
1135 if (!hasQuestForItem)
1136 {
1137 if (!showInLoot)
1138 {
1139 const_cast<QuestItem*
>(&(*qi))->is_looted =
true;
1141 {
1143 }
1144 continue;
1145 }
1146
1147 b <<
uint8(l.
items.size() + (qi - q_list->begin()));
1148 b << item;
1150 }
1151 else
1152 {
1153 b <<
uint8(l.
items.size() + (qi - q_list->begin()));
1154 b << item;
1155
1156 if (item.follow_loot_rules)
1157 {
1158 switch (lv.permission)
1159 {
1162 break;
1165 break;
1168 if (!item.is_blocked)
1170 else
1172 break;
1173 default:
1174 b <<
uint8(slotType);
1175 break;
1176 }
1177 }
1178 else if (!item.freeforall)
1179 b <<
uint8(partySlotType);
1180 else
1181 b <<
uint8(slotType);
1182 }
1183
1184 ++itemsShown;
1185 }
1186 }
1187 }
1188
1190 QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(lv.viewer->GetGUID());
1191 if (ffa_itr != lootPlayerFFAItems.end())
1192 {
1194 for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
1195 {
1198 {
1199 b <<
uint8(fi->index);
1200 b << item;
1201
1203 ++itemsShown;
1204 }
1205 }
1206 }
1207
1209 QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUID());
1210 if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
1211 {
1213 for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
1214 {
1217 {
1218 b <<
uint8(ci->index);
1219 b << item;
1220 if (item.follow_loot_rules)
1221 {
1222 switch (lv.permission)
1223 {
1226 break;
1229 break;
1232 if (!item.is_blocked)
1234 else
1236 break;
1237 default:
1238 b <<
uint8(slotType);
1239 break;
1240 }
1241 }
1242 else if (!item.freeforall)
1243 b <<
uint8(partySlotType);
1244 else
1245 b <<
uint8(slotType);
1246 ++itemsShown;
1247 }
1248 }
1249 }
1250
1251
1252 b.
put<
uint8>(count_pos, itemsShown);
1253
1254 return b;
1255}
std::uint8_t uint8
Definition: Define.h:109
@ OWNER_PERMISSION
Definition: LootMgr.h:72
@ ALL_PERMISSION
Definition: LootMgr.h:67
@ RESTRICTED_PERMISSION
Definition: LootMgr.h:70
@ NONE_PERMISSION
Definition: LootMgr.h:73
@ ROUND_ROBIN_PERMISSION
Definition: LootMgr.h:71
@ MASTER_PERMISSION
Definition: LootMgr.h:69
@ GROUP_PERMISSION
Definition: LootMgr.h:68
std::map< ObjectGuid, QuestItemList * > QuestItemMap
Definition: LootMgr.h:200
LootSlotType
Definition: LootMgr.h:113
@ LOOT_SLOT_TYPE_MASTER
Definition: LootMgr.h:116
@ LOOT_SLOT_TYPE_ROLL_ONGOING
Definition: LootMgr.h:115
@ LOOT_SLOT_TYPE_ALLOW_LOOT
Definition: LootMgr.h:114
@ LOOT_SLOT_TYPE_OWNER
Definition: LootMgr.h:118
@ LOOT_SLOT_TYPE_LOCKED
Definition: LootMgr.h:117
std::vector< QuestItem > QuestItemList
Definition: LootMgr.h:198
Definition: LootMgr.h:154
uint32 itemid
Definition: LootMgr.h:155
bool is_looted
Definition: LootMgr.h:163
bool freeforall
Definition: LootMgr.h:165
Definition: LootMgr.h:185
Definition: LootMgr.h:312
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:329
ObjectGuid roundRobinPlayer
Definition: LootMgr.h:323
uint32 gold
Definition: LootMgr.h:321
QuestItemMap const & GetPlayerQuestItems() const
Definition: LootMgr.h:315
std::vector< LootItem > items
Definition: LootMgr.h:319
QuestItemMap const & GetPlayerFFAItems() const
Definition: LootMgr.h:316
QuestItemMap const & GetPlayerNonQuestNonFFAConditionalItems() const
Definition: LootMgr.h:317
std::vector< LootItem > quest_items
Definition: LootMgr.h:320
std::size_t wpos() const
Definition: ByteBuffer.h:330
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:137