diff options
| -rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 15 | ||||
| -rw-r--r-- | src/server/game/Entities/Item/Item.h | 2 | ||||
| -rw-r--r-- | src/server/game/Handlers/LootHandler.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Loot/LootMgr.h | 2 | ||||
| -rw-r--r-- | src/server/shared/Database/Implementation/CharacterDatabase.cpp | 4 | 
5 files changed, 13 insertions, 12 deletions
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 5303fb8dc38..dd54a3d39db 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1210,7 +1210,6 @@ bool Item::CheckSoulboundTradeExpire()  void Item::ItemContainerSaveLootToDB()  {      // Saves the money and item loot associated with an openable item to the DB -      if (loot.isLooted()) // no money and no loot          return; @@ -1235,7 +1234,7 @@ void Item::ItemContainerSaveLootToDB()      // Save items      if (!loot.isLooted())      { -         +          PreparedStatement* stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS);          stmt_items->setUInt32(0, container_id);          trans->Append(stmt_items); @@ -1272,7 +1271,6 @@ void Item::ItemContainerSaveLootToDB()  bool Item::ItemContainerLoadLootFromDB()  {      // Loads the money and item loot associated with an openable item from the DB -      // Default. If there are no records for this item then it will be rolled for in Player::SendLoot()      m_lootGenerated = false; @@ -1335,18 +1333,19 @@ bool Item::ItemContainerLoadLootFromDB()                  // Finally add the LootItem to the container                  loot.items.push_back(loot_item); -                 +                  // Increment unlooted count                  loot.unlootedCount++; -            } while (item_result->NextRow()); +            } +            while (item_result->NextRow());          }      } -   // Mark the item if it has loot so it won't be generated again on open -   m_lootGenerated = !loot.isLooted(); +    // Mark the item if it has loot so it won't be generated again on open +    m_lootGenerated = !loot.isLooted(); -   return m_lootGenerated; +    return m_lootGenerated;  }  void Item::ItemContainerDeleteLootItemsFromDB() diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 2e1956250f3..ffe31ed765e 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -231,7 +231,7 @@ class Item : public Object          static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);          virtual void DeleteFromDB(SQLTransaction& trans);          static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid); -         +          // Lootable items and their contents          void ItemContainerSaveLootToDB();          bool ItemContainerLoadLootFromDB(); diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index b15636e75d2..92ba5237c68 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -393,8 +393,10 @@ void WorldSession::DoLootRelease(uint64 lguid)              player->DestroyItemCount(pItem, count, true);          }          else +        {              if (pItem->loot.isLooted()) // Only delete item if no loot or money (unlooted loot is saved to db)                  player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true); +        }          return;                                             // item can be looted only single player      }      else diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index cfa5d370e3b..89425e1ee66 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -290,7 +290,7 @@ struct Loot      uint8 unlootedCount;      uint64 roundRobinPlayer;                                // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.      LootType loot_type;                                     // required for achievement system -     +      // GUIDLow of container that holds this loot (item_instance.entry)      //  Only set for inventory items that can be right-click looted      uint32 containerID; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 3ef94f3aafd..b36513ba3bb 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -544,10 +544,10 @@ void CharacterDatabaseConnection::DoPrepareStatements()      PREPARE_STATEMENT(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix FROM item_loot_items WHERE container_id = ?", CONNECTION_SYNCH);      PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_ITEMS, "DELETE FROM item_loot_items WHERE container_id = ?", CONNECTION_ASYNC);      PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_ITEM, "DELETE FROM item_loot_items WHERE container_id = ? AND item_id = ?", CONNECTION_ASYNC); -    PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix) VALUES (?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); +    PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);      PREPARE_STATEMENT(CHAR_SEL_ITEMCONTAINER_MONEY, "SELECT money FROM item_loot_money WHERE container_id = ?", CONNECTION_SYNCH);      PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_MONEY, "DELETE FROM item_loot_money WHERE container_id = ?", CONNECTION_ASYNC); -    PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_MONEY," INSERT INTO item_loot_money (container_id, money) VALUES (?,?)", CONNECTION_ASYNC); +    PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_MONEY, "INSERT INTO item_loot_money (container_id, money) VALUES (?, ?)", CONNECTION_ASYNC);      // Calendar      PREPARE_STATEMENT(CHAR_REP_CALENDAR_EVENT, "REPLACE INTO calendar_events (id, creator, title, description, type, dungeon, eventtime, flags, time2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);  | 
