Fix AHBot crashes. Patch based on code from Xeross' repo
Closes issue 1649 --HG-- branch : trunk
This commit is contained in:
@@ -692,23 +692,9 @@ void AuctionHouseBot::Update()
|
||||
|
||||
WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS);
|
||||
Player _AHBplayer(&_session);
|
||||
_AHBplayer.MinimalLoadFromDB(QueryResult_AutoPtr(NULL), AHBplayerGUID);
|
||||
_AHBplayer.Initialize(AHBplayerGUID);
|
||||
ObjectAccessor::Instance().AddObject(&_AHBplayer);
|
||||
|
||||
// Only for testing, this can likely be removed, once I know it's working as expected.
|
||||
/*
|
||||
AuctionHouseObject* auctionHouse1 = auctionmgr.GetAuctionsMap(55);
|
||||
AuctionHouseObject* auctionHouse2 = auctionmgr.GetAuctionsMap(29);
|
||||
AuctionHouseObject* auctionHouse3 = auctionmgr.GetAuctionsMap(120);
|
||||
uint32 totalItemsAH = (auctionHouse1->Getcount() + auctionHouse2->Getcount() + auctionHouse3->Getcount());
|
||||
uint32 totalItems = (AllianceConfig.TotalItemCounts() + HordeConfig.TotalItemCounts() + NeutralConfig.TotalItemCounts());
|
||||
if (totalItemsAH != totalItems)
|
||||
{
|
||||
sLog.outError("AHBot: The AuctionHouses say there are %u auctions, but, I think there are %u auctions...", totalItemsAH, totalItems);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// Add New Bids
|
||||
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
{
|
||||
|
||||
+2
-43
@@ -15359,50 +15359,9 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, ui
|
||||
/*** LOAD SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
bool Player::MinimalLoadFromDB(QueryResult_AutoPtr result, uint32 guid)
|
||||
void Player::Initialize(uint32 guid)
|
||||
{
|
||||
if (!result)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7
|
||||
result = CharacterDatabase.PQuery("SELECT name, position_x, position_y, position_z, map, totaltime, leveltime, at_login FROM characters WHERE guid = '%u'",guid);
|
||||
if (!result)
|
||||
return false;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
// overwrite possible wrong/corrupted guid
|
||||
SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
|
||||
|
||||
m_name = fields[0].GetCppString();
|
||||
|
||||
Relocate(fields[1].GetFloat(),fields[2].GetFloat(),fields[3].GetFloat());
|
||||
Map *map = MapManager::Instance().CreateMap(fields[4].GetUInt32(), this, 0);
|
||||
SetMap(map);
|
||||
|
||||
// randomize first save time in range [CONFIG_INTERVAL_SAVE] around [CONFIG_INTERVAL_SAVE]
|
||||
// this must help in case next save after mass player load after server startup
|
||||
m_nextSave = urand(m_nextSave/2,m_nextSave*3/2);
|
||||
|
||||
// the instance id is not needed at character enum
|
||||
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = fields[5].GetUInt32();
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = fields[6].GetUInt32();
|
||||
|
||||
m_atLoginFlags = fields[7].GetUInt32();
|
||||
|
||||
// I don't see these used anywhere ..
|
||||
/*_LoadGroup();
|
||||
|
||||
_LoadBoundInstances();*/
|
||||
|
||||
for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
|
||||
m_items[i] = NULL;
|
||||
|
||||
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
m_deathState = DEAD;
|
||||
|
||||
return true;
|
||||
Object::_Create(guid, 0, HIGHGUID_PLAYER);
|
||||
}
|
||||
|
||||
void Player::_LoadDeclinedNames(QueryResult_AutoPtr result)
|
||||
|
||||
+1
-1
@@ -1419,7 +1419,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool LoadFromDB(uint32 guid, SqlQueryHolder *holder);
|
||||
bool isBeingLoaded() const { return GetSession()->PlayerLoading();}
|
||||
|
||||
bool MinimalLoadFromDB(QueryResult_AutoPtr result, uint32 guid);
|
||||
void Initialize(uint32 guid);
|
||||
static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
|
||||
static float GetFloatValueFromArray(Tokens const& data, uint16 index);
|
||||
static uint32 GetZoneIdFromDB(uint64 guid);
|
||||
|
||||
Reference in New Issue
Block a user