void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) { uint32 id; std::stringstream ss; WorldPacket data; recv_data >> id; // will it work on sqlite? need to check it ss << "SELECT totrigger FROM areatriggers WHERE totrigger IS NOT NULL AND totrigger != 0 AND id = " << id ; printf("\nQUERY (%s)\n ",ss.str().c_str()); QueryResult *result = sDatabase.Query( ss.str().c_str() ); if(result != NULL) { Field *fields = result->Fetch(); printf("\nD: %u = %u\n",id,fields[0].GetUInt32()); std::stringstream ss1; ss1 << "SELECT mapid ,coord_x ,coord_y ,coord_z FROM areatriggers WHERE mapid IS NOT NULL AND coord_x IS NOT NULL AND coord_y IS NOT NULL AND coord_z IS NOT NULL AND id = " << fields[0].GetUInt32(); printf("\nQUERY (%s) \n",ss1.str().c_str()); QueryResult *result1 = sDatabase.Query( ss1.str().c_str() ); if(result1 != NULL) { Field *fields1 = result1->Fetch(); GetPlayer()->SetDontMove(true); printf("\nAreaTrigger: %u %u %u %u\n", fields[0].GetUInt32(),fields1[0].GetUInt32(),fields1[1].GetFloat(),fields1[2].GetFloat(),fields1[3].GetFloat()); data.Initialize(SMSG_TRANSFER_PENDING); data << uint32(0); SendPacket(&data); GetPlayer()->RemoveFromMap(); data.Initialize(SMSG_NEW_WORLD); data << fields1[0].GetUInt32() << fields1[1].GetFloat() << fields1[2].GetFloat() << fields1[3].GetFloat() << (float)0.0f; SendPacket(&data); GetPlayer()->SetMapId(fields1[0].GetUInt32()); GetPlayer()->SetPosition(fields1[1].GetFloat() , fields1[2].GetFloat() , fields1[3].GetFloat(), 0); GetPlayer()->SetDontMove(false); } } }