예제 #1
0
void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
	return;
#endif
	//!!!!!!!!!!!!! CATA !!!!!!!!!!! 
	// this seems to deadlock maps, disabling it until properly implemented
	return;
	//!!!!!!!!!!!!! CATA !!!!!!!!!!! 

	Log.Notice("ObjectMgr", "Loading Transports...");
	QueryResult * QR = WorldDatabase.Query("SELECT entry FROM gameobject_names WHERE type = %u", GAMEOBJECT_TYPE_MO_TRANSPORT);
	if(!QR) return;

	int32 total = QR->GetRowCount();
	do 
	{
		uint32 entry = QR->Fetch()[0].GetUInt32();

		//never do this !
//		Transporter * pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER<<32 | entry); //wtf ?
		uint32 lowguid = objmgr.GenerateLowGuid( HIGHGUID_TYPE_TRANSPORTER );
		Transporter * pTransporter = new Transporter(((uint64)HIGHGUID_TYPE_TRANSPORTER<<32) | lowguid);
		if(!pTransporter->CreateAsTransporter(entry, ""))
		{
			sLog.outDebug("Transporter %d failed creation for some reason.", entry);
			delete pTransporter;
			pTransporter = NULL;
		}else
		{
            AddTransport(pTransporter);

			QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
			if(result2)
			{
				do 
				{
					pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
						result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
						result2->Fetch()[5].GetFloat());

				} while (result2->NextRow());
				delete result2;
				result2 = NULL;
			}
		}

	} while(QR->NextRow());
	delete QR;
	QR = NULL;
}
예제 #2
0
void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
	return;
#endif
	Log.Notice("ObjectMgr", "Loading Transports...");
	QueryResult * QR = WorldDatabase.Query("SELECT entry FROM gameobject_names WHERE type = %u", GAMEOBJECT_TYPE_MO_TRANSPORT);
	if(!QR)
		return;

	int64 total = QR->GetRowCount();
	TransportersCount = total;
	uint32 entry = NULL;
	Transporter* pTransporter = NULL;
	do
	{
		entry = QR->Fetch()[0].GetUInt32();

		pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER<<32 | entry);
		pTransporter->Init();
		if(!pTransporter->CreateAsTransporter(entry, ""))
		{
			Log.Warning("ObjectMgr","Skipped invalid transporterid %d.", entry);
			pTransporter->Destruct();
			pTransporter = NULL;
		}
		else
		{
			AddTransport(pTransporter);

			QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
			if(result2)
			{
				do
				{
					pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
						result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
						result2->Fetch()[5].GetFloat());

				} while (result2->NextRow());
				delete result2;
			}
		}

	} while(QR->NextRow());
	delete QR;
}
예제 #3
0
void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
    return;
#endif
    Log.Notice("ObjectMgr", "Loading Transports...");
    QueryResult * QR = WorldDatabase.Query("SELECT * FROM transport_data");
    if (!QR) return;

    int64 total = QR->GetRowCount();
    TransportersCount = total;
    do
    {
        uint32 entry = QR->Fetch()[0].GetUInt32();
        int32 period = QR->Fetch()[2].GetInt32();

        Transporter * pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | entry);
        if (!pTransporter->CreateAsTransporter(entry, "", period))
        {
            sLog.outError("Transporter %s failed creation for some reason.", QR->Fetch()[1].GetString());
            delete pTransporter;
        }
        else
        {
            AddTransport(pTransporter);

            QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
            if (result2)
            {
                do
                {
                    pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
                                         result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
                                         result2->Fetch()[5].GetFloat());

                }
                while (result2->NextRow());
                delete result2;
            }
        }

    }
    while (QR->NextRow());
    delete QR;
}