diff options
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 82 |
1 files changed, 25 insertions, 57 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index e898112a75d..948c29294f4 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -327,14 +327,14 @@ void ObjectMgr::RemoveArenaTeam(ArenaTeam* arenaTeam) mArenaTeamMap.erase( arenaTeam->GetId() ); } -AuctionHouseObject * ObjectMgr::GetAuctionsMap( uint32 location ) +AuctionHouseObject * ObjectMgr::GetAuctionsMap( AuctionLocation location ) { switch ( location ) { - case 6: //horde + case AUCTION_HORDE: return & mHordeAuctions; break; - case 2: //alliance + case AUCTION_ALLIANCE: return & mAllianceAuctions; break; default: //neutral @@ -342,18 +342,18 @@ AuctionHouseObject * ObjectMgr::GetAuctionsMap( uint32 location ) } } -uint32 ObjectMgr::GetAuctionCut(uint32 location, uint32 highBid) +uint32 ObjectMgr::GetAuctionCut(AuctionLocation location, uint32 highBid) { - if (location == 7 && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + if (location == AUCTION_NEUTRAL && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) return (uint32) (0.15f * highBid * sWorld.getRate(RATE_AUCTION_CUT)); else return (uint32) (0.05f * highBid * sWorld.getRate(RATE_AUCTION_CUT)); } -uint32 ObjectMgr::GetAuctionDeposit(uint32 location, uint32 time, Item *pItem) +uint32 ObjectMgr::GetAuctionDeposit(AuctionLocation location, uint32 time, Item *pItem) { float percentance; // in 0..1 - if ( location == 7 && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + if (location == AUCTION_NEUTRAL && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) percentance = 0.75f; else percentance = 0.15f; @@ -1660,18 +1660,31 @@ void ObjectMgr::LoadAuctions() aItem->bid = fields[8].GetUInt32(); aItem->startbid = fields[9].GetUInt32(); aItem->deposit = fields[10].GetUInt32(); - aItem->location = fields[11].GetUInt8(); - //check if sold item exists - if ( GetAItem( aItem->item_guidlow ) ) + + uint32 loc = fields[11].GetUInt8(); + if(!IsValidAuctionLocation(loc)) { - GetAuctionsMap( aItem->location )->AddAuction(aItem); + CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",aItem->Id); + sLog.outError("Auction %u has wrong auction location (%u)", aItem->Id, loc); + delete aItem; + continue; } - else + aItem->location = AuctionLocation(loc); + + // check if sold item exists for guid + // and item_template in fact (GetAItem will fail if problematic in result check in ObjectMgr::LoadAuctionItems) + if ( !GetAItem( aItem->item_guidlow ) ) { CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",aItem->Id); sLog.outError("Auction %u has not a existing item : %u", aItem->Id, aItem->item_guidlow); delete aItem; + continue; } + + if(aItem->location) + + GetAuctionsMap( aItem->location )->AddAuction(aItem); + } while (result->NextRow()); delete result; @@ -6721,51 +6734,6 @@ int ObjectMgr::GetOrNewIndexForLocale( LocaleConstant loc ) return m_LocalForIndex.size()-1; } -void ObjectMgr::LoadBattleMastersEntry() -{ - mBattleMastersMap.clear(); // need for reload case - - QueryResult *result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" ); - - uint32 count = 0; - - if( !result ) - { - barGoLink bar( 1 ); - bar.step(); - - sLog.outString(); - sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" ); - return; - } - - barGoLink bar( result->GetRowCount() ); - - do - { - ++count; - bar.step(); - - Field *fields = result->Fetch(); - - uint32 entry = fields[0].GetUInt32(); - uint32 bgTypeId = fields[1].GetUInt32(); - if (bgTypeId >= MAX_BATTLEGROUND_TYPE_ID) - { - sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId); - continue; - } - - mBattleMastersMap[entry] = bgTypeId; - - } while( result->NextRow() ); - - delete result; - - sLog.outString(); - sLog.outString( ">> Loaded %u battlemaster entries", count ); -} - void ObjectMgr::LoadGameObjectForQuests() { mGameObjectForQuestSet.clear(); // need for reload case |